was php Perl, now reusable page elements

2004-11-07 Thread Cat
Thanks Guys,

Will take a look soon.

No you didn't mention it before David.  But that's cool, I wasn't trying to do 
this in perl before.  lol

cat

RE: how to pass array and varaible

2004-11-07 Thread Charles K. Clarkson
Ajey Kulkarni [EMAIL PROTECTED] wrote:

: Make sure you pass var first, followed by array.
: There is no need to complicate with the array
: ref IMHO.


Once you are used to working with references,
they no longer complicate argument passing. An
array reference is always a single scalar while
the underlying array may be any length. Passing
a reference can take significantly less time.

HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: LWP::Parallel in other way

2004-11-07 Thread Ing. Branislav Gerzo
Ing. Branislav Gerzo [IBG], on Tuesday, November 2, 2004 at 16:50
(+0100) made these points:

IBG I'm using LWP::Parallel and it works good for me. But I have one
IBG curious problem - I want change PUA agent for every request. But I

so, maybe I have comlicated question, so no one answer me. Brano, try
look at Parallel::ForkManager, maybe this help you :)

-- 

 ...m8s, cu l8r, Brano.

[URA redneck if you entertain your friends with tapes of bowling.]



-=x=-
Skontrolované antivírovým programom NOD32


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: Getting perl to work on windows 98 se

2004-11-07 Thread Alexander
On M$ systems I've only used ActivePerl. Here's what I
can tell you:

First, c:\Perl\bin should have been added to your
%PATH environment variable by the installer. If not,
you have to do so by hand. The quickest way is to add
;c:\Perl\bin to end of the line that begins with
PATH= in your c:\autoexec.bat file. That way, when
you open a DOS prompt anywhere in your folder tree and
type perl myscript.pl, the system will use perl and
not anything else.

Second, windows scripts do not need a header like that
on Unix systems. You can either ommit it or use #!perl
, you'll have to see what works for you.
 
I hope that helped
Alexander




Do You Yahoo!?
   @yahoo.grhttp://www.otenet.gr

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




cpaninstall NET::SSH ---- Can't install NET::SSH don't know what it is?

2004-11-07 Thread Harold Castro
Good day!
  This is the first time I'll be using the cpan to
install modules. I run:

perl -MCPAN -e shell

and answer the questions one by one. When its done,
I issued install NET::SSH at the cpan prompt and I
got the message:

Can't install NET::SSH Don't know what it is.

Question:
How will I make cpan know what NET::SSH is? Is there
something I have to update first? How can I search for
some useful modules using cpan rather than using cpan
search in www.cpan.org?

What is auto bundle? And what does 'cpan -a' does?
When I ran it, I can some perl modules, scrolling. Are
they the ones installed in my system?
I've heard somewhere from perlfaq that cpan supports
proxy connection. Is this true? Because I'm at home
right now and tomorrow I would want to use perl at
work and also the cpan to install and search for some
useful modules, but my workstation is behind proxy.

Thanks a lot for your help.
Have a nice day!















__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: cpaninstall NET::SSH ---- Can't install NET::SSH don't know what it is?

2004-11-07 Thread Randy W. Sims
On 11/7/2004 8:35 AM, Harold Castro wrote:
Good day!
  This is the first time I'll be using the cpan to
install modules. I run:
perl -MCPAN -e shell
and answer the questions one by one. When its done,
I issued install NET::SSH at the cpan prompt and I
got the message:
cpan install Net::SSH
case matters
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Installing modules in Windows through -MCPAN and nmake problem

2004-11-07 Thread Edward WIJAYA
Hi,
I am trying to install a module Template::Extract
through this command
C: perl -MCPAN -e shell install Template::Extract
Since I can't find that(latest) modules in ActivePerl's PPM.
But somehow, I still fail to make install the module,
this are the error message I encontered:
  C:\Program Files\Microsoft Visual Studio\VC98\bin\nmake.EXE  -- OK
Running make test
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
  C:\Program Files\Microsoft Visual Studio\VC98\bin\nmake.EXE test -- NOT  
OK
Running make install
  make test had returned bad status, won't install without force
-

Even if I use force install I will still encounter the same message
Please advice how can I solve this.
Thanks so much for your time.
--
Regards,
Edward WIJAYA
SINGAPORE
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



position data

2004-11-07 Thread Michael S. Robeson II
Well, with much help I have ben able to come up with this currently not 
working code:

#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;
my(%gap, %gap_pos, $animal);
while (DATA) {
  if (/(\w+)/) {
$animal = $1;
  } else {
while (/(-+)/g) {
  my $gap_length = length $1;
  my $position = pos ($1);
  $gap{$animal}{$gap_length}++;
  push (@{$gap{$animal}{$gap_length}}, $position);
  }
  }
}
print Dumper \%gap;
__DATA__
human
acgtt---cgatacg---acgact-t
chimp
acgtacgatac---actgca---ac
mouse
acgata---acgatcgacgt
Actually, the code will work fine if you remark the second and last 
lines of the inner while loop. Anyway, I am having trouble adding 
position data to my Hashes. I would like Data Dumper to output data 
like this (I always get my syntax messed up so I will just show part of 
$VAR1, but hopefully, you'll understand):

$VAR1 = {
  'human' = {
   '5' = '1' =  {
25
}
   '3' = '2' =  {
6,
16,
 },
}
So, I am trying to figure out why the code I have does not work? What 
am I not getting? Any suggestions?

-Thanks
-Mike
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: how to pass array and varaible

2004-11-07 Thread Ajey Kulkarni
Alright, but what is the reason for less time when you pass
the ref? I always thought the perl optimizes by sending the
ref even if you use a direct array.

Where can i find more detailed info?

regards
~A

On Sun, 7 Nov 2004, Charles K. Clarkson wrote:

 Ajey Kulkarni [EMAIL PROTECTED] wrote:

 : Make sure you pass var first, followed by array.
 : There is no need to complicate with the array
 : ref IMHO.


 Once you are used to working with references,
 they no longer complicate argument passing. An
 array reference is always a single scalar while
 the underlying array may be any length. Passing
 a reference can take significantly less time.

 HTH,

 Charles K. Clarkson
 --
 Mobile Homes Specialist
 254 968-8328



 --
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 http://learn.perl.org/ http://learn.perl.org/first-response





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Parsing strings like the Windows shell

2004-11-07 Thread Randy W. Sims
[Fwd: Re: [Module::Build] ANNOUNCE: 0.2601 - CPAN]
Please forgive my lack or proper etiquette, but I want have access to a 
Windows machine for a few days, and I want to try to resolve this issue.

For the Module::Build project we need to be able to parse strings like 
the command shell. I'm not sure of all details of how the shell 
interprets commands, but I think the algorithm below is close. Can 
anyone verify this and maybe help provide a routine that implements it. 
I'll make sure you're credited for the contribution. =)

Thanks,
Randy.
 Original Message 
Subject: Re: [Module::Build] ANNOUNCE: 0.2601 - CPAN
Date: Sun, 07 Nov 2004 14:17:14 -0500
From: Randy W. Sims [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Ken Williams [EMAIL PROTECTED]
CC: [EMAIL PROTECTED],  [EMAIL PROTECTED],  Perl - 
Module-Build [EMAIL PROTECTED]
References: [EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 
[EMAIL PROTECTED]

Ken Williams wrote:
On Nov 7, 2004, at 11:32 AM, Randy W. Sims wrote:
If necessary we can either try to emulate it be experimenting or maybe 
we can dig some code out of ReactOS (a Windows NT clone) and FreeDOS 
(a DOS clone) and translate it to perl.

Okay - I'm happy with just a subset of it for now.  Let's do what we can 
with 2-3 lines of regexes and such in Windows-split_like_shell(), and 
wait until we get some legitimate complaints.  I think we've already 
fixed the most common problems.
Actually, I think I just stumbled across the algorithm. After sending my
previous message, I was looking at the results from the brief
experiments I posted [see sig], and I think I found an algorithm that 
works for those cases. But I'm not by a Windows box to test at the moment.

Scanning the string char by char:
Quote mode is alternately entered and exited upon find a d-quote
  unless the d-quote is preceeded with a b-slash or
  unless the d-quote is preceeded with a d-quote that terminates quote-mode
in both cases the d-quote is a literal part of the argument.
Given the previous used example: foo\bar foo\bar
  discard and enter quote-mode
f  shift
o  shift
o  shift
  discard and exit quote-mode
\  literal unless next char is d-quote
   escaped d-quote, discard b-slash, shift d-quote
b  shift
a  shift
r  shift
  discard and enter quote-mode
   quoted space
  discard and exit quote-mode
f  shift
o  shift
o  shift
\  literal unless next char is d-quote
   escaped d-quote, discard b-slash, shift d-quote
b  shift
a  shift
r  shift
  discard and enter quote-mode
Correctly produces the result:
foobar foobar
Open questions:
Does b-slash escape any other characters? spaces?
Does all versions follow this basic algorithm?
NT has circumflex as an additional escape char, we probably don't care.
Anybody by a Windoze box to try this out? If not, I'll try in a few days
when I get a chance.
Randy.
__END__
--
#!/usr/bin/perl
use strict;
use warnings;
print $_\n for @ARGV;
__END__
and I got the same results. I'm not quite sure how that line is being 
interpreted. What I do know about the cmd.exe shell is that:

1. circumflex is the escape character
2. you can get a quote inside a quoted string by repeating it x3, i.e. 
foobar = foobar  foobar = foobar

experimenting (w/ echoarg.pl):
The inner quotes quote the space, making it one arg:
echoarg foo\bar foo\bar
= foobar
= foobar
The outer quotes have the same effect:
echoarg foo\bar foo\bar
= foobar
= foobar
Removing outer and inner produces a single arg:
echoarg foo\bar foo\bar
= foobar foobar
No backslashes:
echoarg foobar foobar
= foobar foobar
Effects of inner quotes
w/ outer quotes w/o outer quotes
=   =
echoarg foobar   echoarg foobar
= foobar = foobar
echoarg foobar  echoarg foobar
= foobar= foobar
echoarg foobar echoarg foobar
= foobar= foobar
echoarg foobarechoarg foobar
= foobar= foobar
echoarg foobar   echoarg foobar
= foobar   = foobar
echoarg foobar  echoarg foobar
= foobar   = foobar
Ick, Ick, Ick. There are also differences between cmd.exe and 
command.com, not to mention differences in releases and differences that 
depend on extensions being enabled. Ick.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: position data

2004-11-07 Thread Zeus Odin

Michael S. Robeson II [EMAIL PROTECTED] wrote ...


 use warnings;
 use strict;

Excellent. Make sure all your programs inlude these line.

Three of the lines below have problems.

 while (DATA) {
if (/(\w+)/) {
  $animal = $1;
} else {
  while (/(-+)/g) {
my $gap_length = length $1;
my $position = pos ($1);

1. You really want
   my $position = pos $_;  # or just pos
   perldoc -f pos

$gap{$animal}{$gap_length}++;

2. First you tell Perl to create key called human. You then store a
reference to another hash as its value with a key named 3. So far so good.
You then tell Perl to increment the value that already there via the ++.
Since there is no defined value, it essentially increments undef to 1. It
might not be obvious but this is a problem. Read on.

push (@{$gap{$animal}{$gap_length}}, $position);

3. You now tell Perl to create an array where the scalar value of 1
already exists from above. You then receive a fatal error: 'Can't use string
(1) as an ARRAY ref while strict refs in use at dnagap6.pl line 16,
DATA line 2.'

Don't think in terms of lesser programming languages. Think Perlish. You can
safely delete the autoincrememt line from above and simply do:
   push @{$gap{$animal}{$gap_length}}, $position;

The lack of parens makes the prior statement slightly more legible. The
first time you execute this statement, the keys human, and 3 do not
exist. However, Perl creates them when you execute the push statement.

I assume that you want the autoincrement to keep track of the number of
occurrences of human gaps of length 3. This information is contained by the
array length at @{$gap{$animal}{$gap_length}}. Does that look familiar? It
should because you just pushed an element onto it above!

Furthermore, you never use the variable %gap_pos. You also record $position
and then read from it exactly one time. You can delete the my $position
line altogether and do instead:
   push @{$gap{$animal}{$gap_length}}, pos;   # pos really means pos($_)
as stated earlier

Make sure you read
perldoc perlref

-ZO




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: how to pass array and varaible

2004-11-07 Thread Gunnar Hjalmarsson
[ Please bottom-post! ]
Ajey Kulkarni wrote:
Charles K. Clarkson wrote:
Ajey Kulkarni [EMAIL PROTECTED] wrote:
Make sure you pass var first, followed by array. There is no need
to complicate with the array ref IMHO.
Once you are used to working with references, they no longer
complicate argument passing. An array reference is always a single
scalar while the underlying array may be any length. Passing a
reference can take significantly less time.
Alright, but what is the reason for less time when you pass the ref?
I always thought the perl optimizes by sending the ref even if you
use a direct array.
When you pass an array, Perl *copies* the array elements to @_, so you
get two instances of the data in memory.
Where can i find more detailed info?
perldoc perlsub
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



RE: more cookies in perl and asp

2004-11-07 Thread A Taylor

Anadi, are the Perl scripts and the ASPs on the same server (webhost,
not machine!)? In the same directory?
Maybe you have to specify the domain when creating the cookie.

Jenda

Hello Jenda, Both the perl scripts and the asp's are run on the same server
BUT the asp's are run from a different folder from the perlscripts.
I have just specified the domain in my cookie:

 $usrID = createUsrID();
 ## create cookie
 my $cookie = new CGI::Cookie(-name='usrID',
 -value=$usrID,
 -expires='+2h',
 -domain='.mydomain.com',
 -path='/');
 ## send cookie
 print Set-Cookie: $cookie\n;

And I can now read this cookie with my asp script :-)

usrID = Request.cookies(usrID)

Thank you for your help :-)

Anadi


Deleting File.........roy

2004-11-07 Thread roime puniran
Below is my script that read the content of flow
directory..I want to delete each file after
reading..But it failed...What's the problem?...can
anyone help me ...

#!/usr/bin/perl

use strict;
use warnings;
use DBI;
use DBD::mysql;

my $dir=/flow/;
my @files;
my $file;
my $record;
my @log;
my $packet;
my $counter = 0;
my $file_array;
my @flow;
my @line;
my $sth;


opendir(FILE, $dir) || die(Cannot open directory);
@files= readdir(FILE);
closedir(FILE);

foreach $file(@files)
{
unless ( ($file eq .flow) || ($file eq ..) )
{  

print \n$file\n;


}
unlink($file) || warn having trouble deleting $file:
$!;
}

Regards 

Roime



__ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: how to pass array and varaible

2004-11-07 Thread John W. Krahn
Gunnar Hjalmarsson wrote:
Ajey Kulkarni wrote:
Alright, but what is the reason for less time when you pass the ref?
I always thought the perl optimizes by sending the ref even if you
use a direct array.
When you pass an array, Perl *copies* the array elements to @_, so you
get two instances of the data in memory.
perl stores an alias of each element passed to it into @_ just like foreach 
does so the *data* is only stored once.

$ perl -le'
sub my_sub { $_ += 5 foreach @_ }
my @x = 10 .. 15;
my $x = 55;
print @x $x;
my_sub @x, $x;
print @x $x;
'
10 11 12 13 14 15 55
15 16 17 18 19 20 60

Where can i find more detailed info?
perldoc perlsub
perldoc perlsub
[snip]
Any arguments passed in show up in the array @_.  Therefore, if you called
a function with two arguments, those would be stored in $_[0] and $_[1].
The array @_ is a local array, but its elements are aliases for the actual
scalar parameters.  In particular, if an element $_[0] is updated, the
corresponding argument is updated (or an error occurs if it is not
updatable).  If an argument is an array or hash element which did not
exist when the function was called, that element is created only when (and
if) it is modified or a reference to it is taken.  (Some earlier versions
of Perl created the element whether or not the element was assigned to.)
Assigning to the whole array @_ removes that aliasing, and does not update
any arguments.

John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response