[30819] in Perl-Users-Digest
Perl-Users Digest, Issue: 2064 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 18 21:09:45 2008
Date: Thu, 18 Dec 2008 18:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 18 Dec 2008 Volume: 11 Number: 2064
Today's topics:
Re: Help with DOS file names <soup_or_power@yahoo.com>
Re: Help with DOS file names <jurgenex@hotmail.com>
Re: Help with DOS file names <soup_or_power@yahoo.com>
Re: mathematical operation in a perl one liner in subst <uri@stemsystems.com>
Re: multidimensional array <jl_post@hotmail.com>
Re: Processing Multiple Large Files <cartercc@gmail.com>
Re: Rounding up in perl sln@netherlands.com
Re: Rounding up in perl <tadmc@seesig.invalid>
script crashes with "Too many open files" <bennett@peacefire.org>
Re: script crashes with "Too many open files" <uri@stemsystems.com>
Re: speeding up cgi perl <skeldoy@gmail.com>
Re: speeding up cgi perl <hjp-usenet2@hjp.at>
Re: speeding up cgi perl <john1949@yahoo.com>
Re: Suggestions for distributing my Perl program <klaus03@gmail.com>
WWW::Mechanize login problem <wax0530@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Dec 2008 04:42:34 -0800 (PST)
From: "souporpower@gmail.com" <soup_or_power@yahoo.com>
Subject: Re: Help with DOS file names
Message-Id: <6a63e99c-a9c3-4f22-89e2-b2cab1c49f58@s37g2000vbp.googlegroups.com>
On Dec 17, 4:19=A0pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> "souporpo...@gmail.com" <soup_or_po...@yahoo.com> wrote:
> >This is my code to print the URL's from the browser favorites:
>
> >my @dirs =3D `dir`;
>
> perldoc -f opendir/readdir
> perldoc -f glob
>
> >my $f;
> >foreach $f (@dirs) {
> > =A0 =A0 =A0 =A0next if ($f =3D~ /url/);
> > =A0 =A0 =A0 =A0`cd $f`;
>
> What is this `cd` supposed to do? It will start a new process (via
> backticks, then change the CWD of that process, and then close the
> process. Unless I am missing something that seems pretty pointless to
> me.
>
> > =A0 =A0 =A0 =A0print "Dir=3D" . $f . "\n";
> > =A0 =A0 =A0 =A0my @files=3D`dir *.url`;
>
> perldoc -f glob
>
> [rest of code snipped]
>
> >The problem is each file returned by the DOS dir command has carriage
>
> Well, then don't use that stupid external command but Perl's buildin
> utilities aka glob() or opendir/readdir.
>
> >returns at the beginning of the file name (can't use chop or chomp).
>
> If you want to you could. Just reverse(), chomp(), reverse(). But I'm
> not recommending to do that.
>
> >Can someone please help me
> >out? Tried $f =3D~ s/^\\n//g;
>
> That would replace a literal backslash followed by a 'n'. Don't escape
> the backslash.
>
> Or specify the offending character by its numerical value, using the \x
> or \0 notation, see perldoc perlre for details.
>
> jue
Hi Jue
Modified the code to this:
my @dirs =3D `dir`;
my $f;
foreach $f (@dirs) {
print "Dir=3D" . $f . "\n";
opendir(DIR, $f)||die("Can't open $f\n");
@files=3Dreaddir(DIR);
}
The program is dying because, I guess, the DOS DIR command is not
returning the full path of the dir.
How can I get the full path of the dir?
Thanks
------------------------------
Date: Thu, 18 Dec 2008 05:49:53 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Help with DOS file names
Message-Id: <jgkkk4128ht6pc1rl8jjk3n7397kda5vli@4ax.com>
"souporpower@gmail.com" <soup_or_power@yahoo.com> wrote:
>Modified the code to this:
>my @dirs = `dir`;
>my $f;
>foreach $f (@dirs) {
> print "Dir=" . $f . "\n";
> opendir(DIR, $f)||die("Can't open $f\n");
It would be even better to include the reason why the command is
failing:
..... or die ("Can't open $f because $!\n");
> @files=readdir(DIR);
>}
>
>The program is dying because, I guess, the DOS DIR command is not
>returning the full path of the dir.
More important: it doesn't return only directory names. It returns all
file names and on top of that it returns quite some garbage, too.
When I run it I get something like
Volume in drive C has no label.
Volume Serial Number is BCDD-E0FE
Directory of C:\tmp
18-Dec-08 05:33 <DIR> .
18-Dec-08 05:33 <DIR> ..
11-Dec-08 09:04 69 #t.pl#
20-Jul-07 13:40 366,741 001_ESap.pdf
19-Apr-07 16:25 <DIR> bye2A2B.tmp
05-Feb-08 15:47 <DIR> bye3826.tmp
Well, I don't know about your computer, but I certainly have neither a
directory called "Volume in drive C has no label." nor "05-Feb-08 15:47
<DIR> bye3826.tmp"
>How can I get the full path of the dir?
opendir() is quite happy with relative paths and has no problems dealing
with them.
jue
------------------------------
Date: Thu, 18 Dec 2008 07:11:03 -0800 (PST)
From: "souporpower@gmail.com" <soup_or_power@yahoo.com>
Subject: Re: Help with DOS file names
Message-Id: <c1f19c80-4431-4bc5-a2cf-67fb3e6a2266@w24g2000prd.googlegroups.com>
On Dec 18, 8:49=A0am, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> "souporpo...@gmail.com" <soup_or_po...@yahoo.com> wrote:
> >Modified the code to this:
> >my @dirs =3D `dir`;
> >my $f;
> >foreach $f (@dirs) {
> > =A0 =A0 =A0 =A0print "Dir=3D" . $f . "\n";
> > =A0 =A0 =A0 opendir(DIR, $f)||die("Can't open $f\n");
>
> It would be even better to include the reason why the command is
> failing:
> =A0 =A0 =A0 =A0 ..... or die ("Can't open $f because $!\n");
>
> > =A0 =A0 =A0 @files=3Dreaddir(DIR);
> >}
>
> >The program is dying because, I guess, the DOS DIR command is not
> >returning the full path of the dir.
>
> More important: it doesn't return only directory names. It returns all
> file names and on top of that it returns quite some garbage, too.
>
> When I run it I get something like
>
> =A0 =A0 =A0 =A0 =A0Volume in drive C has no label.
> =A0 =A0 =A0 =A0 =A0Volume Serial Number is BCDD-E0FE
>
> =A0 =A0 =A0 =A0 =A0Directory of C:\tmp
>
> =A0 =A0 =A0 =A0 18-Dec-08 =A005:33 =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0.
> =A0 =A0 =A0 =A0 18-Dec-08 =A005:33 =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0..
> =A0 =A0 =A0 =A0 11-Dec-08 =A009:04 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A069 #t.p=
l#
> =A0 =A0 =A0 =A0 20-Jul-07 =A013:40 =A0 =A0 =A0 =A0 =A0 366,741 001_ESap.p=
df
> =A0 =A0 =A0 =A0 19-Apr-07 =A016:25 =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0bye2A2=
B.tmp
> =A0 =A0 =A0 =A0 05-Feb-08 =A015:47 =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0bye382=
6.tmp
>
> Well, I don't know about your computer, but I certainly have neither a
> directory called "Volume in drive C has no label." nor "05-Feb-08 =A015:4=
7
> <DIR> =A0 =A0 =A0 =A0 =A0bye3826.tmp"
>
> >How can I get the full path of the dir?
>
> opendir() is quite happy with relative paths and has no problems dealing
> with them.
>
> jue
Thanks Jue. It works now. The problem was as you stated.
------------------------------
Date: Thu, 18 Dec 2008 04:04:10 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: mathematical operation in a perl one liner in substitute
Message-Id: <x78wqd26t1.fsf@stemsystems.com>
>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:
JE> Uri Guttman <uri@stemsystems.com> wrote:
>> just google this group or the perl beginner's list for homework. many
>> time obvious homework problems have been posted and usually labeled as
>> such by repliers (never by the OP). the problems have simple goals,
>> contrived data (like this one), etc. many times the problem states a
>> desired solution technique which is bogus (e.g. you must use a regex to
>> solve this). and if accused of posting homework, the OP will usually
>> defend it in some silly way.
JE> Hmmmm, I am not sure I totally agree. Certainly there are those cases
JE> you mentioned, no doubt about it.
JE> On the other hand the OPs problem could also be viewed as a perfect
JE> excerpt from a larger project, stripped down to the bare minimum code
JE> required to exhibit the problem, just like requested in the posting
JE> guidelines.
you could view it that way but those who really show a snippet will say
that and it is part of a larger program. the OP doesn't say that but the
requirement for a one liner is also a clue to homework. real world projects
never require a one liner. anyhow the OP can answer this question. for
now unless told otherwise, i will assume homework.
and another odd point. when have you ever seen a csv file with ; as the
delimiter? i doubt most csv oriented applications (those that can
read/write them) would have ; as a normal option. tab or comma are the
standard ones.
it doesn't matter much anyhow. the OP got a bunch of answers.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 18 Dec 2008 17:17:41 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: multidimensional array
Message-Id: <d7aba233-5d7b-4bd7-815a-281b25faf467@e1g2000pra.googlegroups.com>
On Dec 13, 2:42 am, taralee324 <tara.brat...@gmail.com> wrote:
>
> I have an array of arrays (ie. $AoA[$array][$row][$col]). And I want
> to copy one array to a separate array variable. I've tried:
> @new_array = [$AoA[$array]];
> @new_array = {$AoA[$array]};
> and about a million other ways, but I can't find any online
> documentation (which is where I learn this stuff) on how to do it.
Dear Tara,
Generally, you want to get a reference to the sub-array you want,
and then either "shallow-copy" or "deep-copy" it into the new array.
You can get a reference like this:
my $arrayRef = $AoA[$array];
Then you can "shallow-copy" it to a new array like this:
my @new_array = @{ $arrayRef };
Or "deep-copy" it like this:
use Storable:
my @new_array = @{ Storable::dclone($arrayRef) };
Of course, you can always save a line of typing by not declaring
$arrayRef and directly substituting $arrayRef in the other lines with
$AoA[$array].
But be warned! The shallow-copy looks simpler, but it has the side-
effect that changes to the new array often affect the original. This
may or may not be what you want. To illustrate how the deep- and
shallow-copies differ, take a look at this script:
#!/usr/bin/perl
use strict;
use warnings;
my @originalArray;
$originalArray[1][2][3][4] = 'cat';
# Get a reference to a sub-array:
my $arrayRef = $originalArray[1][2];
# Shallow-copy the sub-array to a new array:
my @newArray = @{ $arrayRef };
# WARNING: Because of the shallow-copy,
# changing values in @newArray
# will also change @originalArray!
$newArray[3][4] = 'dog';
print "$originalArray[1][2][3][4]\n"; # prints 'dog'
# Deep-copy the sub-array to a new array:
use Storable;
@newArray = @{ Storable::dclone($arrayRef) };
# Now changes you make to @newArray won't
# affect @originalArray:
$newArray[3][4] = 'bird';
print "$originalArray[1][2][3][4]\n"; # still prints 'dog'
__END__
I hope this helps, Tara.
-- Jean-Luc
------------------------------
Date: Thu, 18 Dec 2008 08:20:39 -0800 (PST)
From: cartercc <cartercc@gmail.com>
Subject: Re: Processing Multiple Large Files
Message-Id: <b5be8864-690e-4e4f-a7fe-24334c2142dd@s9g2000prg.googlegroups.com>
On Dec 13, 5:26=A0pm, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> No. At least not on a level you notice. From a perl programmer's view
> (or a Java or C programmer's), each core is a separate CPU. A
> single-threaded program will not become faster just because you have two
> or more cores. You have to program those threads (or processes)
> explicitely to get any speedup. See my results for Sinan's test program
> for a dual- and eight core machine.
I've never written a multithreaded Perl program, but I have written
multithreaded programs in C and Java, and the big problem IMO is that
all those threads typically want a piece of your shared object, so you
have to build a gate keeper to allow all those threads into your
shared object one at a time. I expect that Perl is the same.
> I doubt that very much. Erlang is inherently multithreaded so you don't
> have to do anything special to use those 2 or 8 cores you have, but it
> doesn't magically make a processor "several orders of magnitude" faster,
> unless you have hundreds or thousands of processors.
That's true, but that's not really the point. The point is that Erlang
is an asynchronous message passing language, so you don't have to keep
locking and unlocking shared objects. From my POV as a software guy
(not a hardware guy) not having to explicitly programs mutexes and
semaphores is great. But yeah, theoretically Erlang program runtime
speed is proportional to the number of processors you have.
> I think Erlang is usually compiled to native code (like C), so it may
> well be a few orders of magnitude faster than perl because of that. But
> that depends very much on the problem and extracting stuff from text
> files is something at which perl is relatively fast.
Yes. You can't really make a priori statements about execution speed,
and Perl is optimized for data manipulation while Erlang isn't, but
still, Erlang is optimized for multithreading which might be the
answer that the OP was looking for.
> Which says nothing about how long it takes to parse a line in a log
> file.
Which was my point to begin with. If you have 2M records, you have 2M
records and you've got to deal with it.
BTW, I've never written an Erlang program to do what I use Perl for,
I'm not sure if it can be done, and I don't know if it would have any
benefit. However, I've seen what Erlang can do with multithreaded
apps, and I certainly think that Erlang is a strong competitor for
those kinds of applications.
CC
------------------------------
Date: Thu, 18 Dec 2008 21:28:34 GMT
From: sln@netherlands.com
Subject: Re: Rounding up in perl
Message-Id: <boflk41q3h8ikea4lnr1q5nur7t5lsmi9l@4ax.com>
On Wed, 17 Dec 2008 10:37:22 -0500, David Groff <david.groff@noaa.gov> wrote:
>
>
>Is there more than one function for rounding a
>number up in perl?
>I tried the ceil() function but get an undefined subroutine
>message.
Here is a Perl ceil/floor equivalent. The first code section
seems to correctly implement floor by taking into account that
int() does not use the sign in its process of rounding. The
second code section with floor, although intuitive is not correct.
For a full proof, all the values between 2.0 - 2.9 should be checked.
sln
# ===========================================
# Correct ceil/floor equavelent
# This floor takes the sign into acount
# when rounding.
# - - - - - - - -
use strict;
use warnings;
printf( "The floor of 2.8 is %f\n", _floor( 2.8 ) );
printf( "The floor of -2.8 is %f\n", _floor( -2.8 ) );
printf( "The ceil of 2.8 is %f\n", _ceil( 2.8 ) );
printf( "The ceil of -2.8 is %f\n", _ceil( -2.8 ) );
sub _ceil {return int(shift()+.5)}
sub _floor {my $y = shift(); return int(($y < 0) ? $y-.5 : $y)}
__END__
The floor of 2.8 is 2.000000
The floor of -2.8 is -3.000000
The ceil of 2.8 is 3.000000
The ceil of -2.8 is -2.000000
# ===========================================
# Correct ceil equavelent, incorrect floor
# Int() rounds down the Absolute value.
# So do not use this floor.
# - - - - - - - -
use strict;
use warnings;
printf( "The floor of 2.8 is %f\n", _floor( 2.8 ) );
printf( "The floor of -2.8 is %f\n", _floor( -2.8 ) );
printf( "The ceil of 2.8 is %f\n", _ceil( 2.8 ) );
printf( "The ceil of -2.8 is %f\n", _ceil( -2.8 ) );
sub _ceil {return int(shift()+.5)}
sub _floor {return int(shift())}
__END__
The floor of 2.8 is 2.000000
The floor of -2.8 is -2.000000
The ceil of 2.8 is 3.000000
The ceil of -2.8 is -2.000000
==========================================
C - reference code
// crt_floor.c
// This example displays the largest integers
// less than or equal to the floating-point values 2.8
// and -2.8. It then shows the smallest integers greater
// than or equal to 2.8 and -2.8.
#include <math.h>
#include <stdio.h>
int main( void )
{
double y;
y = floor( 2.8 );
printf( "The floor of 2.8 is %f\n", y );
y = floor( -2.8 );
printf( "The floor of -2.8 is %f\n", y );
y = ceil( 2.8 );
printf( "The ceil of 2.8 is %f\n", y );
y = ceil( -2.8 );
printf( "The ceil of -2.8 is %f\n", y );
}
Output
The floor of 2.8 is 2.000000
The floor of -2.8 is -3.000000
The ceil of 2.8 is 3.000000
The ceil of -2.8 is -2.000000
------------------------------
Date: Thu, 18 Dec 2008 18:52:30 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Rounding up in perl
Message-Id: <slrngkls2e.igq.tadmc@tadmc30.sbcglobal.net>
sln@netherlands.com <sln@netherlands.com> wrote:
> taking into account that
> int() does not use the sign in its process of rounding.
That is because int() does not *have* a process of rounding.
int() does not do rounding.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 18 Dec 2008 01:44:14 -0800 (PST)
From: Bennett Haselton <bennett@peacefire.org>
Subject: script crashes with "Too many open files"
Message-Id: <83cf5c95-5631-4c02-a695-d6b566227025@b41g2000pra.googlegroups.com>
I have a script that sends mail using the Mail::Bulkmail class from:
http://search.cpan.org/dist/Mail-Bulkmail/
I'm already using version 3.12 which according to that page is the
most recent available.
Even if you don't know the details of how Mail::Bulkmail works, I
suspect someone familiar with Perl or Linux internals may have a
suggestion on how to work around this problem.
After Mail::Bulkmail has been invoked, I think, a few hundred times,
the script crashes with the error message:
Could not initilize method (GOOD) to value (/var/www/good.txt) :
Could not open file /var/www/good.txt : Too many open files at ./send-
pending-messages-using-bulkmail.pl line 154.
Now the /var/www/good.txt file is specified in my bulkmail-config.txt
file as the file to write "good" addresses to. While the script is
running, the lsof command shows me these instances of handles on the
"good" file being already open:
peacefire:/var/www/html/circumventor# lsof -u root | grep good
send-pend 23961 root 6w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 10w REG 0,125 20427325
302910600 /var/www/good.txt
send-pend 23961 root 13w REG 0,125 20427325
302910600 /var/www/good.txt
[...]
where the number of lines is the number of times that
Mail::Bulkmail::bulkmail() has been called. In other words, it looks
like each instance bulkmail() is opening a new file handle on good.txt
and not closing it properly.
After the script crashes, all the handles get closed automatically, so
I just have to restart the script and it's back up and running. But
can anyone guess a workaround that would allow the script to run
longer?
In the bulkmail config file I have these lines:
#log our errors
ERRFILE = /var/www/error.txt
BAD = /var/www/bad.txt
GOOD = /var/www/good.txt
banned = /var/www/banned.txt
So if I just commented the lines out completely, that might solve the
problem as nothing is logged any more, but I'd like to do some logging
so I'm hoping for a cleaner solution.
Bennett
------------------------------
Date: Thu, 18 Dec 2008 12:10:12 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: script crashes with "Too many open files"
Message-Id: <x7d4fpwgsr.fsf@stemsystems.com>
>>>>> "BH" == Bennett Haselton <bennett@peacefire.org> writes:
BH> After Mail::Bulkmail has been invoked, I think, a few hundred times,
BH> the script crashes with the error message:
that line is a big clue. why do you invoke that module a few hundred
times? do you mean create new bulkmail objects or call some method a few
hundred times? without looking, i would expect a single bulkmail object
to be created and given the bulk addresses in a method.
BH> where the number of lines is the number of times that
BH> Mail::Bulkmail::bulkmail() has been called. In other words, it looks
BH> like each instance bulkmail() is opening a new file handle on good.txt
BH> and not closing it properly.
but why are you creating a new instance over and over? i suspect you are
not using the module properly.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 18 Dec 2008 03:04:37 -0800 (PST)
From: skeldoy <skeldoy@gmail.com>
Subject: Re: speeding up cgi perl
Message-Id: <973d8ef5-7617-4f02-a1dd-1b0aa850fd9b@n33g2000pri.googlegroups.com>
Update: Found out (with curl) that the problem is in the browsers. The
queries completes and downloads in a second or so but it takes forever
to render in all browsers I have tested.
Thanks for your help guys!
------------------------------
Date: Thu, 18 Dec 2008 14:52:57 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: speeding up cgi perl
Message-Id: <slrngkkldr.9hj.hjp-usenet2@hrunkner.hjp.at>
On 2008-12-17 23:53, skeldoy <skeldoy@gmail.com> wrote:
>> Is 700 GB and 6 billion rows in the largest table huge enough? I don't
>> use mysql for that one, though.
>
> Is it a mysql issue that make you use another db?
Actually for us, mysql would be "another db". We are traditionally an
Oracle shop, so using Oracle was the natural thing to do for us. We are
using mysql for a few smaller databases, and I'm planning to look at
postgres again - the inverted indices could be really useful for our
application.
hp
------------------------------
Date: Thu, 18 Dec 2008 15:16:49 -0000
From: "John" <john1949@yahoo.com>
Subject: Re: speeding up cgi perl
Message-Id: <gidph0$3ir$1@news.albasani.net>
"skeldoy" <skeldoy@gmail.com> wrote in message
news:973d8ef5-7617-4f02-a1dd-1b0aa850fd9b@n33g2000pri.googlegroups.com...
> Update: Found out (with curl) that the problem is in the browsers. The
> queries completes and downloads in a second or so but it takes forever
> to render in all browsers I have tested.
>
> Thanks for your help guys!
If it is a browser problem try googling 'website optimisation'.
There's a lot you can do to speed up display of <tables> and you mentioned
earlier you use <td>s
O'Reilly have a book of 'Website Optimization'
Regards
John
------------------------------
Date: Thu, 18 Dec 2008 01:42:15 -0800 (PST)
From: Klaus <klaus03@gmail.com>
Subject: Re: Suggestions for distributing my Perl program
Message-Id: <05fda207-a1e3-4ca1-8584-c017774b7f43@q30g2000prq.googlegroups.com>
On Dec 18, 6:09=A0am, "freesof...@gmail.com" <freesof...@gmail.com>
wrote:
> I want to create a Perl program that contains a script, say run.pl,
> (that the user executes) and uses code from supporting modules
> (multiple .pm files). These perl files will be installed in any
> directory.
>
> I currently have in mind this kind of installation hierarchy:
>
> <install location>/MYTOOL/bin/run.pl
> <install location>/MYTOOL/modules/Options.pm
> <install location>/MYTOOL/modules/Utils.pm
> <install location>/MYTOOL/modules/DB.pm
>
> Questions:
>
> 1) =A0How can run.pl import these modules, Options.pm etc?
> 2) Is there a standard way of installing my program?
See Perlfaq8
+ How do I keep my own module/library directory?
+ How do I add the directory my program lives in to the module/library
search path?
+ How do I add a directory to my include path (@INC) at runtime?
--
Klaus
------------------------------
Date: Thu, 18 Dec 2008 02:02:43 -0800 (PST)
From: wax <wax0530@hotmail.com>
Subject: WWW::Mechanize login problem
Message-Id: <c3ca6567-47fb-4892-b968-eecceeb1c09e@q9g2000yqc.googlegroups.com>
Hello,
I'm having a problem with WWW::Mechanize that I hope that someone more
knowledgeable than myself can help me with. I want to automate
logging on
to the investopedia stock simulator web site.
http://simulator.investopedia.com/authorization/login.aspx
I can't seem to automate this successfully.
My perl script is below:
#!/usr/bin/env perl
use strict;
use Net::HTTP;
use LWP::UserAgent;
use WWW::Mechanize;
my $site="http://simulator.investopedia.com";
my $url=$site . "/authorization/login.aspx";
my $ua = WWW::Mechanize->new(autocheck => 1);
$ua->cookie_jar({});
$ua->get($url);
my $username = "XXX";
my $password = "XXX";
#$ua->credentials( $url, $username, $password );
# the login page:
#
my $page = $ua->content();
print $page;
print "DONE";
print "\n";
$ua->submit_form(
form_number => 0,
fields => {
'ctl00$MainPlaceHolder$usernameText' =>
$username,
'ctl00$MainPlaceHolder$passwordText' =>
$password,
},
);
print $ua->content();
but the resulting page (displayed after the "DONE" print) does not
look like
what I get when I manually click the submit button. I must be doing
something incorrectly. Can someone with more knowledge shed some
light on my mistakes ... TIA
Is this a problem with java script maybe ...
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 2064
***************************************