Form PARAM is wierd (to me)

2004-12-10 Thread Robert
I am getting a wierd value. When I submit the form I am getting 
position=VALUE++ back in the URL. I have no idea where the ++ is coming 
from and I can't find a darn thing about it.

Robert 



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




Re: Form PARAM is wierd (to me)

2004-12-10 Thread Bill Stephenson
You need to send a snippet of your html that contains the form element 
and sending the script, or the snippet, that outputs the response for 
us to see what the problem is

Kindest Regards,
Bill Stephenson
417-546-5593
On Dec 10, 2004, at 1:04 PM, Robert wrote:
I am getting a wierd value. When I submit the form I am getting
position=VALUE++ back in the URL. I have no idea where the ++ is 
coming
from and I can't find a darn thing about it.

Robert

--
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


Re: confusing warnings and void values

2004-12-10 Thread John W. Krahn
RichT wrote:
Hi all,
Hello,
its time again for me to hassle you, i have my script mostly working,
but iv have been bashing my head against a wall trying to fix the last
bits...
its a script for extracting data from a file and exporting it to another.
Problems:
1) i keep getting the warning Use of uninitialized value in numeric
eq (==) at ./scanDCI.pl line 122, DCIFILE line 28. but it should
never execute ./scanDCI.pl line 122 for DCIFILE line 28. as thats
the DE line...
The reason that all the warnings say DCIFILE line 28 instead of the actual 
line number is because you are using a foreach loop instead of a while loop.

 foreach my $line (DCIFILE) {
Should be:
while ( my $line = DCIFILE ) {

2) i get void as the 3rd value in the output
[shelf-1-slot-12-port-1,15552,void,] but that should be the same
as the 2nd value in this case.
It looks like you may have an off-by-one error.

i guess my logic is some what off, could some one please point me in
the right direction,
for fixing there problems. or even show me how to do all this in one line =)
[NOTE sorry if my English is off I'm dyslexic}
[snip]
 dci data  file===
 IR,2,UndefinedContent,0,12/08/2004,14:02:37,UndefinedDbName

 [snip]

 DS,,Elements,
1,shelf-1-slot-12-port-1,1381514,port-122.1.13.1,Yes,,,122:1:13:1,,alcatelNm-imp-atm-oc3-port.mtf,X.X.X.X,,,Yes,,122:1:13:1,122,1,13,1,concord,,,AlcatelNm,,label--STM1-XX1234,,alcatelNm-imp-atm-oc3-port.mtf,XX1234,Active,,,15552,15552,,gmt0bst,1sr6d9fgs67097sv,,
 DE

 /dci data  file===
Is the line following DS,,Elements, supposed to be on a separate line?

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



Mod_Perl Pass Associative Arrays

2004-12-10 Thread James Taylor
Hi everyone, wondering if anyone knew how to pass an associative array 
via POST to mod_perl.  Something like:

input type=text name=search[name] /
input type=text name=search[email /
then it posts to say.. example.pl

my $r=Apache-request;
my $req=Apache::Request-new(shift);
my %stuff=$req-param('search');
That for example doesn't work, but... I'd like it to :)  Anyone know how 
to get this going?  By the way, I *need* the names to preserve, having 
search[] would defeat the purpose of what I'm trying to do here.  Thanks

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



cpan vs. perl -MCPAN -e

2004-12-10 Thread Jan Eden
Hi,

I used to use

perl -MCPAN -e install 'Some::Module'

to install modules. Now I discovered the cpan tool (by chance) which allows me 
to do:

cpan Some::Module

The manual page (date: 2003-09-12) is pretty self-explaining - but the script 
was never mentioned on this list.

Is there any reason not to use it?

Thanks,

Jan
-- 
These are my principles and if you don't like them... well, I have others. - 
Groucho Marx

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




Run Shell Script Using Perl.............roime

2004-12-10 Thread roime puniran
Hi all...
I have a shell script used to transfer files into the
other machine and i need shell script runnigg my
script..
How cai i do that?..

Thanks



__ 
Do you Yahoo!? 
Dress up your holiday email, Hollywood style. Learn more. 
http://celebrity.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




Run Shell Script Using Perl.............roime

2004-12-10 Thread roime puniran
Hi all...
I have a linux shell script used to transfer files
into the other machine and i need PERL running my
script..
How can i do that?..did some one know?

Thanks

__
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: want to get the count of rows of a table from oracle database using perl script

2004-12-10 Thread Priyanka krishnaraj
Thanks a lot.

Tor Hildrum [EMAIL PROTECTED] wrote:On Wed, 8 Dec 2004 22:49:25 -0800 (PST), 
Priyanka krishnaraj

wrote:
 Hi All
 
 I want to get the count of rows in paticular table of the oracle database. 

You want DBI and DBD::Oracle.

http://www.orafaq.com/faqperl.htm

Tor

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.

Re: confusing warnings and void values

2004-12-10 Thread RichT
On Thu, 09 Dec 2004 23:29:21 -0500, Randy W. Sims
[EMAIL PROTECTED] wrote:
 RichT wrote:
 
 
  Hi all,
 
  its time again for me to hassle you, i have my script mostly working,
  but iv have been bashing my head against a wall trying to fix the last
  bits...
 
  its a script for extracting data from a file and exporting it to another.
 
  Problems:
  1) i keep getting the warning Use of uninitialized value in numeric
  eq (==) at ./scanDCI.pl line 122, DCIFILE line 28. but it should
  never execute ./scanDCI.pl line 122 for DCIFILE line 28. as thats
  the DE line...
 
 initialize C$inElementSection:
 
 my $inElementSection = 0;
 
  2) i get void as the 3rd value in the output
  [shelf-1-slot-12-port-1,15552,void,] but that should be the same
  as the 2nd value in this case.
 
 The variable C%segmentFields should be an array since it is being used
 as an array. This was fixed when I made that change.
thank you 
i was under the impresion that the values in an array were not stored
in the order you put them in,  but of course they are, it way more
logical.
hence the over complication. 

thank you again. 

and again.

RichT

 
 Also, note that in all cases found in your code, you should be using
 Cmy instead of Cour.
 
 #!/bin/perl
 
 use strict;
 use warnings;
 use Getopt::Long;
 
 Getopt::Long::config qw(no_ignore_case);
 
 my ( $inputFile, $outputAllFields, $searchKey, $outputFields );
 my @foundSegments;
 
 
 {
 
  $outputFields = 'name,deviceSpeedIn,deviceSpeedOut';
 
  my $needHelp;
  GetOptions( 'dciInFile=s'  = \$inputFile,
  'findField=s'  = \$searchKey,
  'showFields=s' = \$outputFields,
  'listAllFields'= \$outputAllFields,
  'help|h|H|?|HELP'  = \$needHelp
);
  die usage() if $needHelp;
 }
 
 
 # Data collection
 #  using an input file
 #  else quit
 
 
 if ($inputFile) {
  findVars($inputFile);
 } else {
  die usage();
 }
 
 
 # Data output
 #if request for keys print all keys
 #else print results
 
 
 if ($outputAllFields) {
  foreach ( @foundSegments ) {
  foreach (keys %$_) {
  print $_, ;
  }
  print \n;
  }
 
 } else {
  foreach my $found (@foundSegments) {
  foreach my $showKey (split /,/, $outputFields) {
  print $found-{$showKey},;
  }
  print \n;
  }
 }
 
 sub usage {
  return USAGETEXT;
 usage: $0 -dciInFile filename
   -dciInFile filename is the dci file you want to scan
   the following options are also availble
   [ -findField fieldName ]this is the search key to be used (by
   default all elements will be returned)
   [ -showFields field names ] feilds to output (default is
   name,deviceSpeedIn,deviceSpeedOut)
   [ -listAllFields ]  list avalible fields
   [ -help]this help text
 USAGETEXT
 }
 
 sub findVars {
  
  # find infomation form Concord's dci files
  # usage:
  #  findVars(key to search in,value to search for)
  #
  # output:
  #  an aray of Hashes containing all matched segments and keys
  
 
 
  my ($dciFile, %segment, @segmentFields);
  my $inElementSection = 0;
 
 
 
  # read in dci filename from parent
 
  $dciFile=$_[0] || die qq( FindVars function: Missing dciInfile
 value $!);
 
  chomp $dciFile;
 
  open(DCIFILE, $dciFile) || die FindVars function: can not open
 : $!;
 
  foreach my $line (DCIFILE) {
  chomp $line;
 
  if ( $line =~ /^FN,Elements,/ ) {
  $line =~ s/FN\,Elements\,//g;
 @segmentFields = split(/\,/,$line);
 
 
  next;
  }
 
  if ( $line =~ /^DS,,Elements,/ ) {
  $inElementSection=1; next;
  }#marks start of elements
  if ( $line =~ /^DE/ ) {
  $inElementSection=0; next;
  }#marks end of elements
  if ($inElementSection==1) {
 my @segmentValues = split(/\,/,$line);
 for ( my $i = 0; $i  $#segmentValues; $i++ ) {
 $segment{$segmentFields[$i]} = $segmentValues[$i];
 
 
 }
  push @foundSegments, \%segment;
  next;
  }
  }
  close DCIFILE;
 
  return (@foundSegments); # return to main ruteen
 
 }
 
 


-- 
--
Fnord...
-- http://23.me.uk -- -- 

Re: confusing warnings and void values

2004-12-10 Thread RichT
On Fri, 10 Dec 2004 01:27:55 -0800, John W. Krahn [EMAIL PROTECTED] wrote:
 RichT wrote:
  Hi all,
 
 Hello,
 
 
 
  its time again for me to hassle you, i have my script mostly working,
  but iv have been bashing my head against a wall trying to fix the last
  bits...
 
  its a script for extracting data from a file and exporting it to another.
 
  Problems:
  1) i keep getting the warning Use of uninitialized value in numeric
  eq (==) at ./scanDCI.pl line 122, DCIFILE line 28. but it should
  never execute ./scanDCI.pl line 122 for DCIFILE line 28. as thats
  the DE line...
 
 The reason that all the warnings say DCIFILE line 28 instead of the actual
 line number is because you are using a foreach loop instead of a while loop.
 
   foreach my $line (DCIFILE) {
 
 Should be:
 
 while ( my $line = DCIFILE ) {
 
done.
 
  2) i get void as the 3rd value in the output
  [shelf-1-slot-12-port-1,15552,void,] but that should be the same
  as the 2nd value in this case.
 
 It looks like you may have an off-by-one error.
 
 
  i guess my logic is some what off, could some one please point me in
  the right direction,
  for fixing there problems. or even show me how to do all this in one line =)
  [NOTE sorry if my English is off I'm dyslexic}
 
 [snip]
 
   dci data  file===
   IR,2,UndefinedContent,0,12/08/2004,14:02:37,UndefinedDbName
  
   [snip]
  
   DS,,Elements,
  1,shelf-1-slot-12-port-1,1381514,port-122.1.13.1,Yes,,,122:1:13:1,,alcatelNm-imp-atm-oc3-port.mtf,X.X.X.X,,,Yes,,122:1:13:1,122,1,13,1,concord,,,AlcatelNm,,label--STM1-XX1234,,alcatelNm-imp-atm-oc3-port.mtf,XX1234,Active,,,15552,15552,,gmt0bst,1sr6d9fgs67097sv,,
   DE
  
   /dci data  file===
 
 Is the line following DS,,Elements, supposed to be on a separate line?
 

yes it just got a sneaky blank last value

these dci file are used for quite a lot of things in Concord, so there
are lots of extra fields.

Thanking you

RichT
 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
 
 


-- 
--
Fnord...
-- http://23.me.uk -- -- http://info-x.co.uk  -- --
http://seti23.org -- -- Get FireFox Now --

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




Re: Run Shell Script Using Perl

2004-12-10 Thread Chris Devers
On Fri, 10 Dec 2004, roime puniran wrote:

 I have a linux shell script used to transfer files
 into the other machine and i need PERL running my
 script..
 How can i do that?..did some one know?
 
You need to rewrite a shell script that does file transfer in Perl?

Ok, Perl can do that.

How are you trying to transfer the files? There are a lot of ways that 
would work -- ftp, scp, rsync, cp over NFS mount (or SMB mount, or DAV 
mount, or...), etc. We need to know what options to go with.

If the shell script isn't very long, can you paste it in a message to 
the list? If it is long, can you paste a section with the parts you need 
to rewrite in Perl?

Out of curiosity, if the shell script works, why rewrite it? I like Perl 
and all, but not to the point that every perfectly good script in some 
other language needs to be rewritten in Perl...


-- 
Chris Devers

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




Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Hi,

I use the following to read in lines from an uploaded file:

my $fh = $q-upload('input_file');
while ($fh) { push @urls, $_; }

It works fine when the file has UNIX or DOS linebreaks, but it fails with 
Macintosh linebreaks. What is the best method to read in a Macintosh file 
(other than splitting the file manually after reading it into one scalar)?

I obviously cannot send the input record separator to a pattern (awk has to be 
better at something, The Camel).

Second question:

I am also a little confused about which line endings come with text uploaded 
via a textarea. I use:

my $input = $q-param('input');
$input =~ s/[\r\n]{2,}/\n/g;
my @urls = split /\n/, $input;

to make sure I have not more than one linebreak. This works. But this also 
works:

my $input = $q-param('input');
$input =~ s/[\n]{2,}/\n/g;
my @urls = split /[\r\n]+/, $input;

Note that I use a simple \n now in line 2 and the character class in line 3. 
But some mixtures of these two versions do not work.

Where can I read up on linebreaks as transferred by web browsers?

Thanks,

Jan
-- 
There's no place like ~/

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




Re: Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Jan Eden wrote on 10.12.2004:

I am also a little confused about which line endings come with text uploaded 
via 
a textarea. I use:

my $input = $q-param('input');
$input =~ s/[\r\n]{2,}/\n/g;
my @urls = split /\n/, $input;

to make sure I have not more than one linebreak. This works. But this also 
works:

my $input = $q-param('input');
$input =~ s/[\n]{2,}/\n/g;
my @urls = split /[\r\n]+/, $input;

Note that I use a simple \n now in line 2 and the character class in line 3. 
But 
some mixtures of these two versions do not work.

I was able to sort this question myself. I only need

my @urls = split /[\r\n]+/, $input;

since it takes all possible combinations of linebreaking characters and splits 
on them.

Now it is just the linebreaks within the file which remain a problem for me.

Thanks,

Jan
-- 
How many Microsoft engineers does it take to screw in a lightbulb? None. They 
just redefine dark as the new standard.

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




Re: looking a one liner to return the value while clearing the argument

2004-12-10 Thread Edward WIJAYA
On Fri, 10 Dec 2004 09:48:26 -0500, Felix Li [EMAIL PROTECTED]  
wrote:

Is there a one liner that performs the equivalent of
sub ReturnAndClear {
   my $temp=$_[0];
   $_[0]=undef;
   return $temp;
};
Why would you need that?
While you just can simply use like:  $val = undef;
in the code?
--
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



RE: Run Shell Script Using Perl

2004-12-10 Thread ext-Chetak.Sasalu


-Original Message-
From: ext Chris Devers [mailto:[EMAIL PROTECTED]
Sent: Friday, 10. December 2004 15:58
To: roime puniran
Cc: Perl Beginners List
Subject: Re: Run Shell Script Using Perl


On Fri, 10 Dec 2004, roime puniran wrote:

 I have a linux shell script used to transfer files
 into the other machine and i need PERL running my
 script..
 How can i do that?..did some one know?
 
You need to rewrite a shell script that does file transfer in Perl?

Ok, Perl can do that.

How are you trying to transfer the files? There are a lot of ways that 
would work -- ftp, scp, rsync, cp over NFS mount (or SMB mount, or DAV 
mount, or...), etc. We need to know what options to go with.

If the shell script isn't very long, can you paste it in a message to 
the list? If it is long, can you paste a section with the parts you need 
to rewrite in Perl?

Out of curiosity, if the shell script works, why rewrite it? I like Perl 
and all, but not to the point that every perfectly good script in some 
other language needs to be rewritten in Perl...


I think he wants to call the shell script from a different perl script.
qx( shell script which does ftp)

right ?

Chetak


-- 
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




Re: looking a one liner to return the value while clearing the argument

2004-12-10 Thread mgoland


- Original Message -
From: Felix Li [EMAIL PROTECTED]
Date: Friday, December 10, 2004 9:48 am
Subject: looking a one liner to return the value while clearing the argument

 Hi,
Hello
 
 Is there a one liner that performs the equivalent of
usualy a one liner , is something that you from your shell, interest in how 
this can be used properly from the shell. You probebly mean, a shorter way of 
writing your function ??
 
 sub ReturnAndClear {
   my $temp=$_[0];
   $_[0]=undef;
   return $temp;
};
 

#you should call this (\SCALAR)
sub ReturnAndClear{ return $_[0]  undef ${$_[0]}  } 

 TIA
 
 felix li
 


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




CPAN error with MD5?

2004-12-10 Thread KEVIN ZEMBOWER
Hope this is a good place to ask beginner CPAN questions.

Seemingly just recently, I've begun getting errors like this while installing 
CPAN modules:

www:~# perl -MCPAN -e 'install Bundle::Slash'
CPAN: LWP::UserAgent loaded ok
snip
Fetching with LWP:
  
ftp://mirrors.kernel.org/pub/CPAN/authors/id/C/CN/CNANDOR/Bundle-Slash-2.35.tar.gz

  CPAN: MD5 security checks disabled because Digest::MD5 not installed.
  Please consider installing the Digest::MD5 module.

Scanning cache /root/.cpan/build for sizes
Deleting from cache: /root/.cpan/build/PathTools-3.01 (10.010.0 MB)
Bundle-Slash-2.35/
Bundle-Slash-2.35/Makefile.PL
Bundle-Slash-2.35/MANIFEST
Bundle-Slash-2.35/README
Bundle-Slash-2.35/Slash.pm
Bundle-Slash-2.35/t/
Bundle-Slash-2.35/t/slash.t
Net::Cmd is up to date.
Digest::MD5 is up to date.  NOTE this 
line.
Running install for module MD5
Running make for G/GA/GAAS/MD5-2.03.tar.gz
Undefined subroutine Digest::base::new called at /usr/share/perl/5.6.1/CPAN.pm 
line 4328.

Yet, when I try to install Digest::MD5, it says:

www:~# perl -MCPAN -e 'install Digest::MD5'
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Fri, 10 Dec 2004 16:51:03 GMT
CPAN: HTTP::Date loaded ok
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Digest::MD5 is up to date.
www:~# 

Any ideas what I'm doing wrong?

Thanks.

-Kevin

-
E. Kevin Zembower
Internet Systems Group manager
Johns Hopkins University
Bloomberg School of Public Health
Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139


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




Perl on Cygwin

2004-12-10 Thread Mandar Rahurkar
Hello,
  Has anyone used perl on windows machine through cygwin ?  Is the
usability same as that on linux box ?

Mandar


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




Re: Perl on Cygwin

2004-12-10 Thread Matthias Kraatz
On my home computer I only run perl through cygwin. That way I can 
readily export scripts to Unix, without changing paths.
Works great.

Have fun,
  -Matthias
Mandar Rahurkar wrote:
Hello,
 Has anyone used perl on windows machine through cygwin ?  Is the
usability same as that on linux box ?
Mandar
 


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



Re: Reading uploaded files and text blocks

2004-12-10 Thread John W. Krahn
Jan Eden wrote:
Jan Eden wrote on 10.12.2004:
I use the following to read in lines from an uploaded file:
  my $fh = $q-upload('input_file');
  while ($fh) { push @urls, $_; }
It works fine when the file has UNIX or DOS linebreaks, but it fails
with Macintosh linebreaks. What is the best method to read in a
Macintosh file (other than splitting the file manually after reading
it into one scalar)?
Sorry for generating unnecessary traffic, I found the solution myself:
while ($fh) {
my @line = split /[\r\n]+/; $_;
push @urls, @line;
}
This works with any line-ending - if there are \n linebreaks, the split
does nothing, if I have an [\r\n] combination, the split will find a \r
at the end of $_, but nothing behind it, if I only have \r, the whole
file will be one line to be split at once.
You should probably read the Newlines section of the Writing portable Perl 
document.

perldoc perlport
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



Re: [toread] Perl on Cygwin

2004-12-10 Thread Richard Scott
Yes, and perhaps not quite is the answer, as you can run into some
configuration etc. issues, and of course not quite the same, but can
certainly work fine, have been using it for quite a while.



On Sat, 2004-12-11 at 05:53, Mandar Rahurkar wrote:
 Hello,
   Has anyone used perl on windows machine through cygwin ?  Is the
 usability same as that on linux box ?
 
 Mandar
 


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




Currency Conversions

2004-12-10 Thread Mike Blezien
Hello,
Can some recommend a good Perl Module for converting pounds, euros, and yin to 
US dollars.

TIA,
--
Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Currency Conversions

2004-12-10 Thread Edward WIJAYA
On Fri, 10 Dec 2004 20:48:31 -0600, Mike Blezien [EMAIL PROTECTED]  
wrote:

Hello,
Can some recommend a good Perl Module for converting pounds, euros, and  
yin to US dollars.

TIA,
You can try searching CPAN http://search.cpan.org
Just by typing Currency Convert you can find many.
Like:
http://search.cpan.org/~barbie/Finance-Currency-Convert-XE-0.06/lib/Finance/Currency/Convert/XE.pm
OR
http://search.cpan.org/~janw/Finance-Currency-Convert-1.04/Convert.pm
--
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



Re: If you´re in the mood, help me.

2004-12-10 Thread Randy W. Sims
[EMAIL PROTECTED] wrote:
Hi guys,
As you know, i´m having some problems to make this thing work. I have to
write a script that automatically sends a code and get the some
information according to that code. I mean, this script has to
automatically fill in a formfield and get the result. But I just can´t get
it done. If you´re really really in the mood for helping me, I´m posting
down here the source code of the page of the form that the script must
fill in and get the result. The url is:
http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capital.dml
And here is the URL for the page that returns the result:
http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml
Take a look at the WWW::Mechanize module:
http://search.cpan.org/dist/WWW-Mechanize/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: cpan vs. perl -MCPAN -e

2004-12-10 Thread Paul Johnson
On Fri, Dec 10, 2004 at 11:03:37AM +0100, Jan Eden wrote:

 I used to use
 
 perl -MCPAN -e install 'Some::Module'
 
 to install modules. Now I discovered the cpan tool (by chance) which allows 
 me to do:
 
 cpan Some::Module
 
 The manual page (date: 2003-09-12) is pretty self-explaining - but the
 script was never mentioned on this list.
 
 Is there any reason not to use it?

No.  It's all the same code underneath.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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



html to xml (RSS)

2004-12-10 Thread Lincoln
Anybody know of a script to generate an rss feed from a regular static html 
document?  Maybe one that would update the feed when the page is updated?

Just an html page with CSS, Apache, Fedora...

Or is there a tool?

Thanks,

Lincoln

BTW great list, I'm still a lurker.


-- 
She is not refined.  She is not unrefined.  She keeps a parrot.
  -- Mark Twain

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



Re: cpan vs. perl -MCPAN -e

2004-12-10 Thread Chris Devers
On Fri, 10 Dec 2004, Jan Eden wrote:

 Is there any reason not to use it?

None at all.

I only steer people towards the `perl -MCPAN -e ...` version because 
that is very likely to work on any recentish copy of Perl. On the other 
hand, not all vendors seem to distrubute the `cpan` wrapper command, so 
for some people it isn't available. 

But by all means, if you've got it, use it! :-)
 

-- 
Chris Devers

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



Re: Mod_Perl Pass Associative Arrays

2004-12-10 Thread Chris Devers
On Fri, 10 Dec 2004, James Taylor wrote:

 Hi everyone, wondering if anyone knew how to pass an associative array 
 via POST to mod_perl.  Something like:

HTML forms don't really provide for complex data structures, so any 
solution is going to have to be cobbled together.

I think your best bet is to just have form elements with names like 
'searchname', 'searchemail', etc, and just have code on the server to 
organize it into a hash:

  $search{name}  = $req-param('searchname');
  $search{email} = $req-param('searchemail');

etc. 

 

-- 
Chris Devers

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



Re: Why the if loop does not work??

2004-12-10 Thread Jay
On Thu, 9 Dec 2004 15:01:11 -0500, Li, Aiguo (NIH/NCI)
[EMAIL PROTECTED] wrote:

[snip]

 while(DATA)
 {
 my $mykey;
 my $myvalue;
 my %Hash;
 my %mainhash = ();
 
 next unless /^SNP/;
 %Hash=getkeyvalue($mykey,$myvalue);
 
 foreach $mykey (keys(%Hash))
{

[snip]

 #__DATA__
 #SNP_A-1509443  3   3776202
 #SNP_A_1518557  3   3776202
 #SNP_A_1514538  5   5350951
 #SNP_A_1516403  1   5483872
 #BFFX-BioB-M_at  P P P P P A P
 #[snip]

/^/ matches the start of the string, but your string starts with '#',
so you need /^#SNP/ (or just /SNP/, which you use later).  You still
won't execute the foreach loop, though, because
'%Hash=getkeyvalue($mykey,$myvalue)' doesn't do anything, and
therefore %Hash has no keys:  You pass your function $mykey and
$myvalue, but you haven't assigned a value for eaither, so what you
would end up with, even if the subroutine were properly formed and
returned what you think it returns (see below) would be '%Hash =
([undef],[undef])'. This probably isn't what you want.

Also take a look at perldoc perlvar.  Inside getkeyvalue, you almost
certainly want @_, not $_, but take a look to see why.

HTH,

--jay savage

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



Re: Reading uploaded files and text blocks

2004-12-10 Thread Jan Eden
Jan Eden wrote on 10.12.2004:

Hi,

I use the following to read in lines from an uploaded file:

my $fh = $q-upload('input_file');
while ($fh) { push @urls, $_; }

It works fine when the file has UNIX or DOS linebreaks, but it fails
with Macintosh linebreaks. What is the best method to read in a
Macintosh file (other than splitting the file manually after reading
it into one scalar)?


Sorry for generating unnecessary traffic, I found the solution myself:

while ($fh) {
my @line = split /[\r\n]+/; $_;
push @urls, @line;
}

This works with any line-ending - if there are \n linebreaks, the split does 
nothing, if I have an [\r\n] combination, the split will find a \r at the end 
of $_, but nothing behind it, if I only have \r, the whole file will be one 
line to be split at once.

Thanks,

Jan
-- 
How many Microsoft engineers does it take to screw in a lightbulb? None. They 
just redefine dark as the new standard.

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



looking a one liner to return the value while clearing the argument

2004-12-10 Thread Felix Li
Hi,

Is there a one liner that performs the equivalent of

sub ReturnAndClear {
   my $temp=$_[0];
   $_[0]=undef;
   return $temp;
};

TIA

felix li

RE: array statistic (different)

2004-12-10 Thread Charles K. Clarkson
Ing. Branislav Gerzo [EMAIL PROTECTED] wrote:

: Charles K. Clarkson [CKC], on Wednesday, December 8, 2004 at
: 08:32 (-0600) wrote about: 
: 
: : What is it representative of? What is the application?
: : Will there be only didgits? What is the range of values
: : available.
: 
: ok, I rewrote that script a bit, the best solution to me is
: using sorted hashes, so my final code should looks like:
: 
: #advanced statistics
: use strict;
: use warnings;
: use Tie::Hash::Indexed;
: use Data::Dumper;
: 
: my $depth = 8;
: 
: #result should be 'a/b/c/d'; higher in @array - higher priority

print +(sort @array)[0];

__END__


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



If you´re in the mood, help me.

2004-12-10 Thread diogo . senai
Hi guys,

As you know, i´m having some problems to make this thing work. I have to
write a script that automatically sends a code and get the some
information according to that code. I mean, this script has to
automatically fill in a formfield and get the result. But I just can´t get
it done. If you´re really really in the mood for helping me, I´m posting
down here the source code of the page of the form that the script must
fill in and get the result. The url is:
http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capital.dml
And here is the URL for the page that returns the result:
http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml
After this source code, you´ll see the code of my script, please, help me!

html

head
meta name=GENERATOR content=Microsoft FrontPage 4.0
meta name=ProgId content=FrontPage.Editor.Document
titleConsulta Processos da Capital/title
script
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document;
if((p=n.indexOf(?))0parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])d.all) x=d.all[n]; for (i=0;!xid.forms.length;i++)
x=d.forms[i][n];
  for(i=0;!xd.layersid.layers.length;i++)
x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_changeProp(objName,x,theProp,theValue)
{
var obj = MM_findObj(objName);
if (obj  (theProp.indexOf(style.)==-1 || obj.style))
eval(obj.+theProp+='+theValue+');

}
MM_changeProp('principal?superior','','value','../../Tribunal/Processos/Consulta.dml','a');
var barranumero = /images/consulta/abarra3.jpg;
MM_changeProp('barra?superior','','src',barranumero,'a');


function valida(proc)
{
if (proc.length9)
{
alert('Processo deve ter mais de 9 caracteres.');
return(false);
}
if (isNaN(proc))
{
alert('Processo deve ser numerico');
return(false);
}
return(true);
}
function valida_oab()
{
troca_maiusculo(1);
return(true);
}
function valida_nome(nome)
{
troca_maiusculo(2);

var car = nome.charAt(0);
if ((car == ) || (car ==  ))
{
alert('Nome deve ser preenchido');
return(false);
}

if (nome.length3)
{
alert('Nome deve ter no mínimo 3 caracteres.');
return(false);
}

var vet_nome = nome.split( );

if ((vet_nome.length  2) || (vet_nome[1] == ''))
{
alert('Pelo menos 2 nomes devem ser preenchidos');
return(false);
}
return(true);
}
function troca_maiusculo(tipo)
{
if (tipo == 1) {
var oab = new String(document.form12.numroab.value);
document.form12.numroab.value = oab.toUpperCase();
}
if (tipo == 2) {
var nome = new String(document.form13.nomepessoa.value);
document.form13.nomepessoa.value = nome.toUpperCase();
}
return;
}
// --
/script
/head

body  style=background-image: url(/imagens/fundobandeira.jpg);
background-repeat: no-repeat leftmargin=0


div align=center
  table border=0 width=95% cellspacing=0 cellpadding=1
! === 1 GRAU == 
tr
  td width=100% align=left
  font face=verdana,tahoma,arial,helvetica size=2
color=#313073bProcessos de 1º Grau - Processos da
Capital/b/font
  /td
/tr
tr
  td width=100% align=left
form METHOD=GET
ACTION=../../Capital/Processos_SPG/Resp_Processo1.dml
NAME=form1 ONSUBMIT=return
valida(document.form1.numrproc.value);
  table width=100%
trbr/tr
tr
  td width=20%font face=verdana,tahoma,arial,helvetica
size=1 color=#313073nbsp;nbsp;Processo:/font/td
  td width=80%!--webbot bot=Validation
b-value-required=TRUE i-maximum-length=12 --INPUT
SIZE=14 MAXLENGTH=12 TYPE=text NAME=numrproc 
INPUT TYPE=submit VALUE=Consultar NAME=B1 /td
/tr
  /table
  INPUT TYPE=HIDDEN VALUE=SPG2301N NAME=nrot INPUT
TYPE=HIDDEN VALUE=P1 NAME=flag INPUT TYPE=HIDDEN
VALUE= NAME=numrinter INPUT VALUE TYPE=HIDDEN
NAME=mensagem 
/form
  /td
/tr
tr
  td width=100% align=left
form METHOD=GET
ACTION=../../Capital/Processos_SPG/Resp_Sel_Proc.dml
NAME=form12 ONSUBMIT=return
valida_oab(document.form12.numroab.value);
  table width=100%
tr
  td width=20%font face=verdana,tahoma,arial,helvetica
size=1 color=#313073nbsp;nbsp;Oab
Advogado:/font/td
  td width=80%!--webbot bot=Validation
b-value-required=TRUE i-maximum-length=7 --INPUT
SIZE=7 ONCHANGE=troca_maiusculo(1) MAXLENGTH=7
TYPE=text NAME=numroab 
select name=siglaoab size=1

Re: If you´re in the mood, help me.

2004-12-10 Thread Philipp Traeder
On Friday 10 December 2004 22:24, [EMAIL PROTECTED] wrote:
 Hi guys,

Hi Diogo,


 As you know, i´m having some problems to make this thing work. I have to
 write a script that automatically sends a code and get the some
 information according to that code. I mean, this script has to
 automatically fill in a formfield and get the result. 

Could you describe in more detail what exactly you're trying to do?
If I type the first URL you posted into my browser, I get a page with three 
pairs on input fields and submit buttons - which one do you want to fill out, 
and what should happen after you pressed the submit button?

 But I just can´t get it done. 

Why? What exactly is the problem? Do you get an error message? Do you have a 
specific question?

 If you´re really really in the mood for helping me, I´m posting 
 down here the source code of the page of the form that the script must
 fill in and get the result. The url is:
 http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capital
.dml And here is the URL for the page that returns the result:
 http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml
 After this source code, you´ll see the code of my script, please, help me!

[.. snipped approximately 3 GB of HTML source code ;-) ..]


 PERL Script
 #!/usr/bin/perl

Just a small hint: Always put the following lines at the beginning of a 
script:

use strict;
use warnings;

You've got to get used to it - e.g. you've got to declare all your variables 
before using them, like:
  my $ua = LWP::UserAgent-new();
instead of 
  $ua = ...
But in the long run, it will help you avoid making error)

   use LWP::UserAgent;
   $ua = LWP::UserAgent-new;
   $ua-agent(MyApp/0.1 );
   $ua-cookie_jar({});

 my $req = HTTP::Request-new(POST =
 'http://www.tj.go.gov.br/online/Capital/Processos_SPG/Resp_Processo1.dml');

Judging by the HTML code you posted, you probably do not want to submit a POST 
request, but a GET request instead. The relevant part of the HTML code is:

form METHOD=GET ACTION=../../Capital/Processos_SPG/Resp_Processo1.dml 
NAME=form1 ONSUBMIT=return valida(document.form1.numrproc.value);

Note the METHOD=GET part - this specifies that this form initiates a GET 
request when you press the submit button.I don't know off the top of my head 
how to send a GET request using LWP::UserAgent - the short version might be 
something like this (not tested, take a look at the module documentation for 
the correct syntax):

my $ua = new LWP::UserAgent();
my $url_to_send = 
'http://the_server.com/full/address/to/document?parameter=value';
my $response = $ua - get($url);
print response : $response\n;

 #my $req = HTTP::Request-new(POST =
 'http://www.tj.go.gov.br/online/Inicial/Processos/ConsultaProc_1Grau_Capita
l.dml'); $req-content_type('application/x-www-form-urlencoded');
 $req-content('numrproc=009600352534');
 #mode=dist');

   my $res = $ua-request($req);

   if ($res-is_success) {
   print $res-content;
   }
   else {
   print $res-status_line, \n;
   }

Hope this helps - if you run into problems with this, write to the list what 
you tried and what you got in result. I'm sure somebody can help you.

Philipp

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