Re: AW: Syntax of Foreach loop

2010-03-30 Thread Uri Guttman
> "TB" == Thomas Bätzler  writes:

  TB> Jon Forsyth  asked:
  >> I am truly a beginner.  Could someone help me understand this syntax
  >> out of a code example from "Learning Perl"?  On line 5 I'm confused
  >> as to why "my $number" is between "foreach" and the ()?  is "my
  >> $number part of the loop?

  TB> "my" declares a variable for the lexical scope. While Perl by
  TB> itself will happily let variables spring into existence whenever
  TB> you first refer to them, the accepted best practice is to run perl
  TB> with the -w switch or the "use warnings;" pragma which requires
  TB> variables to be declared before their first use.

that is the use strict pragma, not the warnings one.

uri

-- 
Uri Guttman  --  u...@stemsystems.com    http://www.sysarch.com --
-  Perl Code Review , Architecture, Development, Training, Support --
-  Gourmet Hot Cocoa Mix    http://bestfriendscocoa.com -

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




AW: Syntax of Foreach loop

2010-03-30 Thread Thomas Bätzler
Jon Forsyth  asked:
> I am truly a beginner.  Could someone help me understand this syntax
> out of a code example from "Learning Perl"?  On line 5 I'm confused
> as to why "my $number" is between "foreach" and the ()?  is "my
> $number part of the loop?

"my" declares a variable for the lexical scope. While Perl by itself will 
happily let variables spring into existence whenever you first refer to them, 
the accepted best practice is to run perl with the -w switch or the "use 
warnings;" pragma which requires variables to be declared before their first 
use.

The "foreach" loop iterates over each element in the argument list passed 
between the (). Unless there's a variable name between the keyword foreach and 
the braces, foreach makes the default variable $_ to an alias for each of the 
elements in the argument list. If there's a variable between "foreach" and the 
braces, that variable becomes the alias instead.

Please note that I said alias instead of copy - if you modify $_ or your loop 
variable, it'll change the contents of your array:

#!/usr/bin/perl -w

my @array = qw(foo baz bar);
print join(',',@array), "\n";

foreach (@array){
  $_ = uc($_);
}

print join(',',@array), "\n";
__END__

HTH,
Thomas

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Syntax of Foreach loop

2010-03-30 Thread Jon Forsyth
I am truly a beginner.  Could someone help me understand this syntax out of
a code example from "Learning Perl"?  On line 5 I'm confused as to why "my
$number" is between "foreach" and the ()?  is "my $number part of the loop?

sub running_sum {
   state $sum = 0;
   state @numbers;

  foreach my $number ( @_ ) {
   push @numbers, $number;
   $sum += $number;
  }

say "The sum of (@numbers) is $sum";
}


Thanks,

jon


Perl appears to be introducing whitespace when reading .txt files

2010-03-30 Thread Doug Cacialli
I'm completely baffled by this and not entirely sure where to start.

I have a plain text  file, testfile.txt, which contains a single line:

Very truly yours,

It is written exactly how you see it above, with a newline at the end.

I'm trying to write a script that will determine the number of words
in the file.  A snippet of what I have thus far is the following:

my $fh = new IO::File("$lvl2path/$filestng", "r") ||
die ("Can't open .txt file named at $lvl2path.  Exiting program.\n\n");
while (my $line = $fh->getline())
{
my @words = split /\s+/, $line;
my %count = ();
$count{$line} += @words;
print "$line";
print "The line above has " . scalar @words . " occurrences of 
something.\n";
}
$fh->close();

That outputs the following:

V e r y  t r u l y  y o u r s ,
The line above has 3 occurrences of something.

I understand that spilt /\s+/ is matching whitespace characters, and
I'm pleased that it comes back with 3 (two spaces and the newline).
What I don't understand is why the output has spaces between all the
letters.  I've looked at this and other .txt files in different
editors on different OS's; I can't find any hidden characters,
whitespace or other, anywhere they don't belong.  What's really
concerning is when I change the above such that:

my @words = split /\w+/, $line;

I get this:

V e r y  t r u l y  y o u r s ,
The line above has 15 occurrences of something.

Where is this whitespace coming from between the letters??  Is it
really whitespace (/\s+/ doesn't catch it, but /\w+/ is catching each
character as if there's whitespace between)??  A good part of my
dissertation hinges on being able to read thousands of .txt files
without the extraneous spaces that are being introduced somewhere.

By the way, only some files appear affected, but there's no obvious pattern.

Any hints would be wildly appreciated.

===
Douglas Cacialli, M.A. - Doctoral candidate
Clinical Psychology Training Program
University of Nebraska-Lincoln
Lincoln, Nebraska 68588-0308
===

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Hi all!

2010-03-30 Thread Shlomi Fish
On Tuesday 30 Mar 2010 20:02:54 Shawn H Corey wrote:
> On Tue, 30 Mar 2010 18:20:02 +0200
> 
> chew23  wrote:
> > > I hope you're going to like Perl 5 and will use it for years to
> > > come. [P6] Just a note - it's either "Perl" or "perl" but never
> > > "PERL":
> > > 
> > > http://perl.org.il/misc.html#pl_vs_pl
> > 
> > I apologize to the list, but I was not aware of this.
> 
> Few non-Perl mongers are.  (It's just that some mongers get really
> antsy if you get it wrong.)
> 

Well, you can blame the ghosts of the ancient Greek for thinking that 
introducing two parallel sets of letters - the uppercase and the lowercase 
ones was a good idea. Some alphabets such as the Hebrew Alphabet or the Arabic 
Alphabet only have one set of letters, and they work fine. That put aside, I 
still try to write in proper-case English and prefer to read properly-
capitalised English text, because I find it easier.

> FYI:  Perl is used for the language and anything related to it.  perl
> is the name of the program that runs Perl scripts.  If in doubt, use
> Perl.

My link explained that.

> 
> Also, Perl mongers are advocates for Perl.  See http://www.pm.org/ to
> find mongers near you.

Another thing - the word "monger". Compare:

1. Fish monger.

2. Perl monger.

3. Hate monger.

In Hebrew 1 would be "Mokher", 2 would be "Shocher" and 3 would be 
"Mecharcher". If we called ourselves "Mokhrey HaPerl" or "Mecharcherey HaPerl" 
people will get the wrong idea.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Stop Using MSIE - http://www.shlomifish.org/no-ie/

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Hi all!

2010-03-30 Thread Shawn H Corey
On Tue, 30 Mar 2010 18:20:02 +0200
chew23  wrote:
> >
> > I hope you're going to like Perl 5 and will use it for years to
> > come. [P6] Just a note - it's either "Perl" or "perl" but never
> > "PERL":
> >
> > http://perl.org.il/misc.html#pl_vs_pl
> 
> I apologize to the list, but I was not aware of this.

Few non-Perl mongers are.  (It's just that some mongers get really
antsy if you get it wrong.)

FYI:  Perl is used for the language and anything related to it.  perl
is the name of the program that runs Perl scripts.  If in doubt, use
Perl.

Also, Perl mongers are advocates for Perl.  See http://www.pm.org/ to
find mongers near you.


-- 
Just my 0.0002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

I like Perl; it's the only language where you can bless your
thingy.

Eliminate software piracy:  use only FLOSS.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Hi all!

2010-03-30 Thread chew23




Welcome to the Perl world , Perl community and this list. You can find many
resources and links to resources for Perl beginners on the Perl Beginners'
Site:

http://perl-begin.org/


Many thanks for this!


I hope you're going to like Perl 5 and will use it for years to come. [P6]
Just a note - it's either "Perl" or "perl" but never "PERL":

http://perl.org.il/misc.html#pl_vs_pl


I apologize to the list, but I was not aware of this.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




RE: Get result of a https page with SSL after login.

2010-03-30 Thread Bob McConnell
From: chew23

> To automate my work i have to get a html page by my company site after
a 
> login in an secure area.
> After a long googling job, I decided to use WWW:Selenium to do this.
> It seems to be bugged and i would ask to you if there is e clear
method 
> to do this.

I believe the first step is to go to the Selenium home site and get an
updated copy of Selenium.pm. (Last I checked they hadn't posted recent
updates to CPAN.)

You might also want to look over my wiki page about SeRC and Perl at
. You are
welcome to modify or add to it.

The other option is their Google group at
.

Bob McConnell

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Get result of a https page with SSL after login.

2010-03-30 Thread chew23

Hi all,
 just my first technical post on this list.
To automate my work i have to get a html page by my company site after a 
login in an secure area.

After a long googling job, I decided to use WWW:Selenium to do this.
It seems to be bugged and i would ask to you if there is e clear method 
to do this.


Many thanks in advance.

There is my code:

 CODE 

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;

#system ('/usr/bin/selenium-server &');

my $line = '';
my $users_file = "config_user.cfg" ;

open ( USERS , "$users_file" ) or die "Unable to open file: 
$users_file\n $!\n";



my $string = "";
## Perl trim function to remove whitespace from the start and end of the 
string

sub trim($) {
$string = shift;
$string =~ s/.*\>(.*?)\<.*/$1/ ;
return $string;
}

my $sel = Test::WWW::Selenium->new( host => "localhost",
port => ,
browser => "*firefox",
browser_url => 
"http://webmail.sorint.it/"; );


$sel->open_ok("http://x";);
$sel->title_is("Sun Java System Access Manager (Login)");
$sel->type_ok("IDToken1", "x");
$sel->type_ok("IDToken2", "x");
$sel->click_ok("Login.Submit");
$sel->wait_for_page_to_load_ok("3");
$sel->title_is("");
$sel->open_ok('https://x/http://its-cslpsr-01.sorint.it/nextstage/jsp/index.jsp');

my $i = "";

while ($i = ) {
my $field1 = "";
my $field2 = "";
my $field3 = "";
my $line = "$i";
($field1,$field2,$field3) = split ';', $line;
print "$field1\t"."$field2\t"."$field3\n";

my $compurl0 = 
'https://x/http://its-cslpsr-01.xx.it/nextstage/contratti/resoconto/RiepilogoOre.jsp?matricola='."$field2".'&mese_m=mar&anno_a=2010&tipo=';
my $compurl1 = 
'https://x/http://its-cslpsr-01.xx.it/nextstage/contratti/resoconto/RiepilogoOreCommercio.jsp?matricola='."$field2".'&mese_m=mar&anno_a=2010&tipo=';


if ( $field1 == 0 ) {
print "Il campo di controllo è 0 e quindi uso la stringa:\n 
$compurl0";

$sel->open_ok("$compurl0");
$sel->wait_for_page_to_load_ok("3");
sleep 30;
} else {
print "Il campo di controllo è 1 e quindi uso la stringai:\n 
$compurl1";

$sel->open_ok("$compurl1");
$sel->wait_for_page_to_load_ok("3");
sleep 30;
}

my $outfile = "out-$field2.htm";
my $output_page = $sel->get_html_source;
open(OUTFILE, ">$outfile");
print OUTFILE "$output_page";
close(OUTFILE);

open ( FILE , "$outfile" ) or die "Cannot open file: $outfile - $! \n";
open ( LINES , ">data-$field2.txt" ) or die "Cannot open file: 
data-$field2.txt - $! \n";
open ( PIPPO , ">original-$field2.txt" ) or die "Cannot open file 
original-$field2.txt: $! \n";

my $counter = 0;
my $row = "";
while ($row = ) {
$counter++;
if ($row =~ /$line/) {
$a = trim($row);
open ( LINES , ">>data-$field2.txt" ) or die "Cannot 
open file data-$field2.txt: $! \n";
open ( PIPPO , ">>original-$field2.txt" ) or die 
"Cannot open file original-$field2.txt: $! \n";

print PIPPO "$row";
print LINES "$a";
close LINES;
close PIPPO;
}
}
close FILE;
close LINES;
}
close USERS;
exit;


--
go ahead... be a heretic!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Hi all!

2010-03-30 Thread Shlomi Fish
On Tuesday 30 Mar 2010 13:38:12 chew23 wrote:
> Hi all guys,
>   I'm new to PERL, I'm now to the list.
> 
> This is just for a presentation...
> 

Hi chew23!

Welcome to the Perl world , Perl community and this list. You can find many 
resources and links to resources for Perl beginners on the Perl Beginners' 
Site:

http://perl-begin.org/

I hope you're going to like Perl 5 and will use it for years to come. [P6]
Just a note - it's either "Perl" or "perl" but never "PERL":

http://perl.org.il/misc.html#pl_vs_pl

Regards,

Shlomi Fish

[P6] - Perl 6 is entirely different, and as good as it may eventually be, 
still does not have a production-ready implementation, nor does it intend to 
completely eliminate Perl 5.

> See you soon.
> chew23

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Why I Love Perl - http://shlom.in/joy-of-perl

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Hi all!

2010-03-30 Thread chew23

Hi all guys,
 I'm new to PERL, I'm now to the list.

This is just for a presentation...

See you soon.
chew23


--
go ahead... be a heretic!

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




XS and link

2010-03-30 Thread Patrick Dupre

Hello,

I have a perl application calling c soubroutines. I use XS and makemaker 
to compile the code. Every thing OK.

Now, let say that I have 2 c libraries (dynamics) created by XS and
the makemaker, and I would like that one of the 2 c subroutines calls 
one of the subroubtine of the other library.
In other words, I have 1.so and 2.so which are normally called by 
master.pl, but I need that one routine of 1.so calls one subroutine of 
2.so.

I can do it by setting LIBS = '-llib1' in one on the makemaker file
but this requires to recreate a lib1.so file which is stupid because it
already exists.
How can I tell to one of the .so file that the routine that it needs is
in so.2 (by using the mamkemaker file) ?
I tried to use OBJECT but I was not successfull. I guess that it is a
better idea to keep the library dynamics.

Thank for your help.

--
---
==
 Patrick DUPRÉ  |   |
 Department of Chemistry|   |Phone: (44)-(0)-1904-434384
 The University of York |   |Fax:   (44)-(0)-1904-432516
 Heslington |   |
 York YO10 5DD  United Kingdom  |   |email: pd...@york.ac.uk
==
-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Compress a PNG File using PerlMagick

2010-03-30 Thread Christoph Friedrich

Hello there,

I currently try to write an image to a png file with compression. But it 
seems not to compress the image after all. The original filesize of the 
image is 132,2 kb and when I try to save it as a png file its filesize 
grows to 512,5 kb.
I use the following statement to save the image: $image->Write( filename 
=> 'png:example.png', compression => 'none', quality => 95 );
I also tried to set compression to 'JPEG2000' and tried with some other 
values for quality but I doesn't go below 512 kb


What I'm doing wrong?

Greets
Christoph

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Re: $_ substitution Question

2010-03-30 Thread Shlomi Fish
Hi Sarath,

I'm CCing to the list.

On Monday 29 Mar 2010 08:55:55 KKde wrote:
> HI Shlomi,
> 
> > system("/usr/bin/find \"$_\" -mtime 3 -print -exec ls '{}' \;");
> 
> I got confused. Can you plz explain me why $_ is surrounded by another
> double quotes? Why it isn't interpolated in the outer double quotes?

It is interpolated with or without the \"...\" inner delimiters. However, if 
you pass values to the shell, you need the double quotes to give some 
rudimentary protection from special characters. If you do:

system("find $_");

Then someone can put in $_ the following string:

. ; rm -fr $HOME

And you've just lost your home directory. I should note that putting values in 
double-qoutes is not enough as someone can put a double quotes and escape out 
of it. I've talked about it more here:

http://community.livejournal.com/shlomif_tech/35301.html ("Code/Markup 
Injection and Its Prevention")

Regards,

Shlomi Fish

> 
> Regards,
> Sarath

-- 
-
Shlomi Fish   http://www.shlomifish.org/
My Aphorisms - http://www.shlomifish.org/humour.html

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: error while installing win32::Registry module

2010-03-30 Thread Sisyphus


- Original Message - 
From: "Jyoti" 

To: 
Sent: Tuesday, March 30, 2010 5:50 PM
Subject: error while installing win32::Registry module



Dear All,
I was trying to run my script getip.pl . But when i run this script it
gives following error

C:\strawberry\perl\Test>perl GETIP.pl
Can't locate Win32/Registry.pm in @INC (@INC contains:
C:/strawberry/perl/lib C:
/strawberry/perl/site/lib C:\strawberry\perl\vendor\lib .) at GETIP.pl 
line

1.
BEGIN failed--compilation aborted at GETIP.pl line 1.

To resolve this error I downloaded module Win32-DriveInfo-0.06  from
cpan.org  and used following steps to install but again shows the same
problem.


Correct steps ... but wrong module :-)

You needed  to install Win32::Registry, not Win32::DriveInfo. You can grab 
the Win32::Registry source from 
http://search.cpan.org/~jdb/Win32-Registry-0.10/


Cheers,
Rob 



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Solved: First LWP::UserAgent and HTML::Form app.

2010-03-30 Thread Gary Stainburn
Sod's law folks.

Posted the question then reviewed what I'd done and found the problem.  Mixing 
three examples gave me the wrong code. Lifted the line straight from the 
HTML::Form perldoc and it worked.

$req=$ua->request($form->click);

Gary

On Tuesday 30 March 2010 09:41:54 Gary Stainburn wrote:
> Hi folks,
>
> I'm trying to write my first proper app using the above modules but
> following the perldocs/cookbooks I've come to a quick dead stop.
>
> According to the perldoc $form->click should generate an object I can pass
> straight to $ua->post, but when I try that I get the following:
>
> Code snippet:
>
> my $form=shift(@forms);
> my @inputs=$form->inputs;
>
> for (my $i=0; $i<$#inputs;$i++) {
>   my $inp=$inputs[$i];
>   my $type=$inp->type;
>   my $name=$inp->name;
>   my $value=$inp->value;
>   print "type='$type' name='$name' value='$value'\n";
> }
>
> $URL=$form->action;
> $form->value('userid','gary');
> $form->value('pw','secret');
> $form->value('submit','Continue');
>
> print "action=$URL\n";
> $req=$ua->post($URL,$form->click); # this is line 82
>
> Output:
>
> type='text' name='usersid' value=''
> type='password' name='pw' value=''
> type='submit' name='submit' value='Continue'
> type='hidden' name='fromHome' value='true'
> action=http://test.ringways.co.uk/formtest.html
> Not an ARRAY reference
> at /usr/lib/perl5/vendor_perl/5.10.0/HTTP/Request/Common.pm line 82.
>
> Any ideas what I'm doing wrong?
>
>
> --
> Gary Stainburn
>
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000



-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: How to process with Active Directory in windows from perl

2010-03-30 Thread Shlomi Fish
Hi xufengnju,

On Tuesday 30 Mar 2010 09:39:42 xufengnju wrote:
> Hi All,
> 
> I want to use Active Directory in Windows to authenticate my users from
> perl in Linux servers. Is there some way to do it?
> 

I don't understand. Where are the users' credentials stored? Where do you need 
to authenticate them? And what does Perl have to do with it? Please explain 
yourself better so we can help you.

Regards,

Shlomi Fish

> --
> xufengnju
> 2010-03-30

-- 
-
Shlomi Fish   http://www.shlomifish.org/
"The Human Hacking Field Guide" - http://shlom.in/hhfg

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: error while installing win32::Registry module

2010-03-30 Thread Shlomi Fish
Hi Jyoti!

Next time, please hit reply-to-all. You've sent a reply only to me. I'm CCing 
the list.

On Tuesday 30 Mar 2010 11:42:30 Jyoti wrote:
> hello shlomi,
> yes...but i'm not able to run script in which I use win32::Registry.
> 

Well, as opposed to some languages (BASIC/VB-Classic, Fortran, etc.) Perl is 
case-sensitive.

You need to do:

<<<
use Win32::Registry;

my $obj = Win32::Registry->new();
>>>

In the exact case.

Happy Spring Holidays.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




First LWP::UserAgent and HTML::Form app.

2010-03-30 Thread Gary Stainburn
Hi folks,

I'm trying to write my first proper app using the above modules but following 
the perldocs/cookbooks I've come to a quick dead stop.

According to the perldoc $form->click should generate an object I can pass 
straight to $ua->post, but when I try that I get the following:

Code snippet:

my $form=shift(@forms);
my @inputs=$form->inputs;

for (my $i=0; $i<$#inputs;$i++) {
  my $inp=$inputs[$i];
  my $type=$inp->type;
  my $name=$inp->name;
  my $value=$inp->value;
  print "type='$type' name='$name' value='$value'\n";
}

$URL=$form->action;
$form->value('userid','gary');
$form->value('pw','secret');
$form->value('submit','Continue');

print "action=$URL\n";
$req=$ua->post($URL,$form->click); # this is line 82

Output:

type='text' name='usersid' value=''
type='password' name='pw' value=''
type='submit' name='submit' value='Continue'
type='hidden' name='fromHome' value='true'
action=http://test.ringways.co.uk/formtest.html
Not an ARRAY reference 
at /usr/lib/perl5/vendor_perl/5.10.0/HTTP/Request/Common.pm line 82.

Any ideas what I'm doing wrong?


-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: error while installing win32::Registry module

2010-03-30 Thread Shlomi Fish
Hi Jyoti,

On Tuesday 30 Mar 2010 09:50:39 Jyoti wrote:
> Dear All,
>  I was trying to run my script getip.pl . But when i run this script it
> gives following error
> 
> C:\strawberry\perl\Test>perl GETIP.pl
> Can't locate Win32/Registry.pm in @INC (@INC contains:
> C:/strawberry/perl/lib C:
> /strawberry/perl/site/lib C:\strawberry\perl\vendor\lib .) at GETIP.pl line
> 1.
> BEGIN failed--compilation aborted at GETIP.pl line 1.
> 
> To resolve this error I downloaded module Win32-DriveInfo-0.06  from
> cpan.org  and used following steps to install but again shows the same
> problem.
> 
> 
> C:\strawberry\perl>cd Win32-DriveInfo-0.06
> 
> C:\strawberry\perl\Win32-DriveInfo-0.06>perl Makefile.pl
> Writing Makefile for Win32::DriveInfo
> 
> C:\strawberry\perl\Win32-DriveInfo-0.06>dmake install
> cp DriveInfo.pm blib\lib\Win32\DriveInfo.pm
> Installing C:\strawberry\perl\site\lib\Win32\DriveInfo.pm
> Appending installation info to C:\strawberry\perl\lib/perllocal.pod
> 
> C:\strawberry\perl\Win32-DriveInfo-0.06>dmake test
> C:\strawberry\perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl
> 1..11
> ok 1
> ok 2
> ok 3
> ok 4
> ok 5
> ok 6
> ok 7
> ok 8
> ok 9
> ok 10
> Drive C: `dir' and module returned the same
> Drive D: `dir' and module returned the same
> Drive F: `dir' and module returned the same
> Drive G: `dir' and module returned the same
> ok 11

Is that everything you wanted to say? If so, it seems that everything was 
successful. Are you using Strawberry Perl or ActivePerl or something else?

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Funny Anti-Terrorism Story - http://shlom.in/enemy

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Where is the error

2010-03-30 Thread Shlomi Fish
Hi Harry,

On Tuesday 30 Mar 2010 05:36:09 Uri Guttman wrote:
> > "HP" == Harry Putnam  writes:
>   HP> "Uri Guttman"  writes:
>   >>> "HP" == Harry Putnam  writes:
>   HP> About that module Mail::Mailer.  I still have lots of trouble reading
>   HP> code or docu written in the OOp format like the docs for that module.
>   HP> The part I'm asking about is clear enough, but I couldn't find in the
>   HP> body of the docu, what it really meant in use.
> 
>   >> what is the OO format of the docs? no such thing.
> 
>   HP> Uri, I think you like to argue.
> 
> sometimes. sometimes not. :)
> 
>   HP> Is this a new `$mailer' OBJECT?
>   HP>  $mailer = Mail::Mailer->new;
> 
> yes, that is the general way to create a new object in perl. read the
> object docs to learn more. perldoc perl lists all the docs by category
> and you can see which you should read. perl OO is actually very
> simple. get the book 'object oriented perl' if you want even more. a bit
> outdated but an excellent read nonetheless.
> 

We've listed other high-quality (and online) resources for studying Object-
Oriented Programming in Perl here:

http://perl-begin.org/topics/object-oriented/

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Interview with Ben Collins-Sussman - http://shlom.in/sussman

Deletionists delete Wikipedia articles that they consider lame.
Chuck Norris deletes deletionists whom he considers lame.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/