[17300] in Perl-Users-Digest
Perl-Users Digest, Issue: 4722 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 25 14:10:38 2000
Date: Wed, 25 Oct 2000 11:10:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972497417-v9-i4722@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 25 Oct 2000 Volume: 9 Number: 4722
Today's topics:
File manipulation? <frank@eentertainment.net>
Re: File manipulation? (Martien Verbruggen)
Re: File manipulation? nobull@mail.com
fileevent with sockets in WINNT <ianmac@agilent.com>
headword search <AndreasKleiner@compuserve.de>
HELP -- ioctl.ph not workinking? <phil_xxx@my-deja.com>
Re: HELP -- ioctl.ph not workinking? (Shane Castle)
Re: Help with newbie question (M. van den Bos)
Re: How do I do 'use $lib;' where $lib is a variable pa <ren.maddox@tivoli.com>
How to open and read PDF file shilong88@my-deja.com
How to tell if a directory is empty (Linux). (Marko R. Riedel)
Re: How to tell if a directory is empty (Linux). (Rafael Garcia-Suarez)
Re: How to tell if a directory is empty (Linux). (Tom Christiansen)
Re: I've trashed my serial ports! HELP! <elaine@chaos.wustl.edu>
Re: Legal email addresses... (Al)
Re: Length of a string stored in a scalar <jeffahill@_ANTISPAM_.lucent.com>
Re: local binmode? <mjcarman@home.com>
Re: LWP and Netscape <mc@backWATERwoods.org>
Re: LWP???? <elaine@chaos.wustl.edu>
Re: LWP???? <rmore1@my-deja.com>
Re: Matching patterns in PDF? <sba@ocegr.fr>
Re: memory allocation and my <dlorre@caramail.com>
Re: memory allocation and my (Craig Berry)
MS Access via Perl under Linux schnurmann@my-deja.com
Re: MS Access via Perl under Linux <rmore1@my-deja.com>
NET::POP3 <weberr2202@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Oct 2000 08:55:45 -0500
From: "Frank Smith" <frank@eentertainment.net>
Subject: File manipulation?
Message-Id: <8t6on5$qom$1@news3.kcnet.com>
I have been searching the manpages, but have been unsuccessfull in my
attempts to find the commands to do the following:
move a file...
copy a file...
and delete a file...
I have found how to open files for writing, create files or truncate them,
and append files. but thats it. Also when the manpage says truncate the
file if it exists, this does mean it erases the old data and writes new
correct, just like erasing the file and making a new one yes?
Thanks,
James
------------------------------
Date: Thu, 26 Oct 2000 01:35:37 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: File manipulation?
Message-Id: <slrn8vdrtp.6bi.mgjv@martien.heliotrope.home>
[removed superlang and alt.perl newsgroups. Neither exists here]
On Wed, 25 Oct 2000 08:55:45 -0500,
Frank Smith <frank@eentertainment.net> wrote:
> I have been searching the manpages, but have been unsuccessfull in my
> attempts to find the commands to do the following:
>
> move a file...
# perldoc -f rename
Rename does not work across file system boundaries in general, and is
somewhat system dependent. You could use the move() function from the
File::Copy module instead.
# perldoc File::Copy
> copy a file...
copy() from File::Copy
> and delete a file...
# perldoc -f unlink
> I have found how to open files for writing, create files or truncate them,
> and append files. but thats it. Also when the manpage says truncate the
> file if it exists, this does mean it erases the old data and writes new
> correct, just like erasing the file and making a new one yes?
Not exactly. It leaves the old file there, but it just 'removes' all the
data in the file. Erasing the old file and creating a new one is not the
same thing. It is still the same file, just with different contents,
i.e. no content.
Martien
--
Martien Verbruggen |
Interactive Media Division | If it isn't broken, it doesn't have
Commercial Dynamics Pty. Ltd. | enough features yet.
NSW, Australia |
------------------------------
Date: 25 Oct 2000 18:25:11 +0100
From: nobull@mail.com
Subject: Re: File manipulation?
Message-Id: <u91yx4ltoo.fsf@wcl-l.bham.ac.uk>
"Frank Smith" <frank@eentertainment.net> writes:
> I have been searching the manpages, but have been unsuccessfull in my
> attempts to find the commands to do the following:
>
> move a file...
>
> copy a file...
When you are uncsessful finding built-in functions in Perl to do
something the next place to look is on CPAN. There is a module on
CPAN that does these (and AFIAK it's actually part of the standard
Perl distribution). I won't tell you it's name as that might
encourage you not to actually look at CPAN.
> and delete a file...
Now, when you say you've searched the manapages what do actually you
mean?
If you knew you were looking for a function presumably you've searched
in the perlfunc manpage? Now if you are claiming that you've searched
for a function that deletes files then at the very least you _must_
have searched (case-insesatively) for occourances of the string
"delete" in perlfunc.
$ perldoc perlfunc | grep -i delete | cat -n
1 delete, each, exists, keys, values
2 delete EXPR
3 Deletes the specified _k_e_y(s) and their associated
4 deleted value associated with that key, or the
5 Deleting from a hash tied to a DBM file deletes
6 The following deletes all the values of a hash:
7 delete $HASH{$key};
8 delete @HASH{keys %HASH}
9 delete $ref->[$x][$y]{$key};
10 delete @{$ref->[$x][$y]}{$key1, $key2, @morekeys};
11 add or delete elements of a hash while you're
12 trailing whitespace deleted, and the normal
13 rmdir Deletes the directory specified by FILENAME if
14 preserved, and empty trailing ones are deleted.
15 DELETE this, key
16 undef $bar{'blurfl'}; # Compare to: delete $bar{'blurfl'};
17 unlink Deletes a list of files. Returns the number of
18 files successfully deleted.
19 Note: unlink() will not delete directories unless
If you don't like these new-fangled fancy tools like grep and you are
happier working from printed manuals then you'd look at the
categorised list of functions:
Functions for filehandles, files, or directories
-X, chdir, chmod, chown, chroot, fcntl, glob, ioctl,
link, lstat, mkdir, open, opendir, readlink, rename,
rmdir, stat, symlink, umask, unlink, utime
You then you'd read the first sentence of the documentation for those
functions until you came accross the sentence "Deletes a list of
files."
> I have found how to open files for writing, create files or truncate them,
> and append files. but thats it. Also when the manpage says truncate the
> file if it exists, this does mean it erases the old data and writes new
> correct, just like erasing the file and making a new one yes?
Not quite. Erasing the file and making a new one recreates the file
with default permissions/ownership. (BTW: this has nothing to do with
Perl - it's true whatever language you aere using).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 25 Oct 2000 15:17:22 +0100
From: "Ian Mackenzie" <ianmac@agilent.com>
Subject: fileevent with sockets in WINNT
Message-Id: <39f6eb55$1@hpsqftk>
Hi , I have a PerlTk program that uses sockets with the fileevent
set to call the callback sub when the socket filehandle is readable,
this works fine in unix but in WINNT the filevent calls ths callback
sub even when there is no connection to the socket filehandle
socket section :
############################################################################
###
####
#
# Set up socket connect to port 3001
#
############################################################################
####
####
socket(SERVER,PF_INET,SOCK_STREAM, getprotobyname('tcp'));
setsockopt(SERVER,SOL_SOCKET,SO_REUSEADDR,1);
$addr = sockaddr_in(3001,inet_aton($hostname));
bind(SERVER,$addr)
or die "Could not bind to port\n";
listen(SERVER,SOMAXCONN)
or die "Could not listen to port\n";
$|=1;
Fileevent section :
############################################################################
####
######
# set up main_frame file_event to enables external commands to take action
#
############################################################################
####
#####
$main_frame->fileevent(SERVER,'readable',[\&parse_socket]);
The parse_socket sub is called immediatly, i.e the event does not wait until
there is activity on the socket filehandle SERVER
Any clues anyone, I am using perl 5.6 from ActivePerl
------------------------------
Date: Wed, 25 Oct 2000 18:19:38 +0000
From: AndreasKleiner <AndreasKleiner@compuserve.de>
Subject: headword search
Message-Id: <39F7243A.4848B3D2@compuserve.de>
Hello all,
I have a program which takes multi-line input and produces multi-line
output. I have to run it in the background - as it compiles some info
into the memory which takes some seconds - and now and then feed it with
input and read and interpret the output - with some perl-skript of
course.
Under which headwords do I have to look for a solution:
IPC::Open2
Pipes
other
Thanks for your help,
Andreas
------------------------------
Date: Wed, 25 Oct 2000 16:10:37 GMT
From: Phil xxx <phil_xxx@my-deja.com>
Subject: HELP -- ioctl.ph not workinking?
Message-Id: <8t70ln$go7$1@nnrp1.deja.com>
I have converted all the unix headers a to perl headers using h2ph.
I ran :
cd /usr/include; h2ph -r -l .
This create ioctl.ph in
/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris/sys
from /usr/include/sys/ioctl.h.
Now when I use :
require 'ioctl.ph';
Can't locate ioctl.ph in @INC (did you run h2ph?) (@INC contains:
/usr/local/lib/perl5/5.6.0/i86pc-solaris /usr/local/lib/perl5/5.6.0
/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris
/usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl
sun-addon/lib/perl5/vendor_perl/5.6.0/i86pc-solaris
sun-addon/lib/perl5/vendor_perl/5.6.0 sun-addon/lib/perl5/vendor_perl .)
at ./talker.p line 4.
Now if I use :
use lib '/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris/sys';
The prgram does not crash but I get the following warning when using
Device::Serialport :
disabling ioctl methods - constants not found
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 25 Oct 2000 11:39:45 -0600
From: swcxt@nospam.co.boulder.co.us (Shane Castle)
Subject: Re: HELP -- ioctl.ph not workinking?
Message-Id: <8t75t1$39os@bcx01.co.boulder.co.us>
[newsgroups and followups trimmed]
In comp.lang.perl.misc, Phil xxx<phil_xxx@my-deja.com> wrote:
>I have converted all the unix headers a to perl headers using h2ph.
>I ran :
>cd /usr/include; h2ph -r -l .
>This create ioctl.ph in
>/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris/sys
>from /usr/include/sys/ioctl.h.
>Now when I use :
>require 'ioctl.ph';
You need to specify it as 'sys/ioctl.ph'.
--
Shane Castle | "Perfection, then, is finally achieved, not
Boulder County Info Svcs | when there is nothing left to add, but when
Boulder CO USA | there is nothing left to take away."
| - Antoine de Saint-Exupéry
>Can't locate ioctl.ph in @INC (did you run h2ph?) (@INC contains:
>/usr/local/lib/perl5/5.6.0/i86pc-solaris /usr/local/lib/perl5/5.6.0
>/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris
>/usr/local/lib/perl5/site_perl/5.6.0 /usr/local/lib/perl5/site_perl
>sun-addon/lib/perl5/vendor_perl/5.6.0/i86pc-solaris
>sun-addon/lib/perl5/vendor_perl/5.6.0 sun-addon/lib/perl5/vendor_perl .)
>at ./talker.p line 4.
>Now if I use :
>use lib '/usr/local/lib/perl5/site_perl/5.6.0/i86pc-solaris/sys';
>The prgram does not crash but I get the following warning when using
>Device::Serialport :
>disabling ioctl methods - constants not found
------------------------------
Date: Wed, 25 Oct 2000 16:07:03 GMT
From: mvdbos@integral.nl (M. van den Bos)
Subject: Re: Help with newbie question
Message-Id: <39f7043d.28239125@news.nl.net>
On Thu, 12 Oct 2000 19:29:00 GMT, Michael Segulja
<michael.segulja@sgi-lsi.com> wrote:
> foreach my $mp3file(@files) {
>
> # If title is 0, insert into database, otherwise do
>nothgin.
> if (@ary == 0) {
> $sth = $dbh->prepare("INSERT INTO mp3main
> (album, artist, title, genre,
>comment, bitrate, version,
> mpeg_layer, durationM,
>durationS, year)
> VALUES
>(?,?,?,?,?,?,?,?,?,?,?)" )
> || die "Cannot insert data:
>$dbh->errstr";
> }
> else {
> do_nothing;
> }
> }
Maybe this'll work:
else {
next;
}
this will go on with the next mp3file from the array.
--
Matthijs van den Bos INTEGRAL Knowledge Utilization BV
mvdbos@integral.nl www.integral.nl
------------------------------
Date: 25 Oct 2000 10:46:57 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: How do I do 'use $lib;' where $lib is a variable package name read from a file?
Message-Id: <m3d7go3oum.fsf@dhcp11-177.support.tivoli.com>
Jihad Battikha <jihad.battikha@sharewire.com> writes:
> Ren Maddox wrote:
>
> > You likely already know this, but I'll point out for Craig's
> > benefit that this solution will not work for his problem as
> > $bar would be imported too late (unless declared with
> > "use vars qw($bar)" or the like, but that is probably not
> > desirable).
>
> Good point. Probably BEGIN { eval "use $lib" } would be better and
> wouldn't need vars, assuming that $lib could be populated adequately up
> front.
But to get $lib populated before this BEGIN block, it will need to
also happen in a BEGIN block. In any event, you no longer need the
eval.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 25 Oct 2000 14:10:33 GMT
From: shilong88@my-deja.com
Subject: How to open and read PDF file
Message-Id: <8t6pki$a5m$1@nnrp1.deja.com>
Hi,
I am new to Perl. I am doing a project which needs to open PDF format
file and read a title line of the file. Can anybody teach me how to do
it or tell me where can I find related information? Thanks in advance.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 25 Oct 2000 16:11:10 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: How to tell if a directory is empty (Linux).
Message-Id: <lz7l6x57up.fsf@linuxsexi.neuearbeit.de>
I have searched the docs for an operator that would do this, but
didn't find anything, so I wrote a procedure for it.
Please respond if you know of a more perlish and/or more efficient way
(less code) to rewrite my procedure.
Regards,
Marko
#! /usr/bin/perl -w
#
sub dirIsEmpty {
my ($name) = @_;
my ($result, $entry) = (1);
opendir DIR, $name or die "can't opendir $name: $!";
while (defined ($entry = readdir DIR)){
if(! ($entry =~ /^\.{1,2}$/)){
$result = 0;
last;
}
}
closedir DIR;
return $result;
}
my $dirName = shift;
print
"$dirName is " .
(dirIsEmpty($dirName) ? '' : 'not ') .
"empty.\n";
------------------------------
Date: Wed, 25 Oct 2000 14:45:40 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How to tell if a directory is empty (Linux).
Message-Id: <slrn8vdsjn.nt9.rgarciasuarez@rafael.kazibao.net>
Marko R. Riedel wrote in comp.lang.perl.misc:
>
>I have searched the docs for an operator that would do this, but
>didn't find anything, so I wrote a procedure for it.
>
>Please respond if you know of a more perlish and/or more efficient way
>(less code) to rewrite my procedure.
>
>Regards,
>
>Marko
>
>#! /usr/bin/perl -w
>#
>
>sub dirIsEmpty {
> my ($name) = @_;
> my ($result, $entry) = (1);
>
> opendir DIR, $name or die "can't opendir $name: $!";
>
> while (defined ($entry = readdir DIR)){
> if(! ($entry =~ /^\.{1,2}$/)){
> $result = 0;
> last;
> }
> }
>
> closedir DIR;
> return $result;
>}
You can also test whether your directory has only two files in it (. and
..).
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 25 Oct 2000 09:22:13 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: How to tell if a directory is empty (Linux).
Message-Id: <39f6faa5$1@cs.colorado.edu>
In article <lz7l6x57up.fsf@linuxsexi.neuearbeit.de>,
> while (defined ($entry = readdir DIR)){
> if(! ($entry =~ /^\.{1,2}$/)){
> $result = 0;
> last;
> }
> }
That will not behave properly on all directories; namely, those
containing files named ".\n" or "..\n" will confound this program.
Assuming a Unix filesystem,
$is_empty = (2 == () = readdir(DH));
should suffice.
--tom
------------------------------
Date: Wed, 25 Oct 2000 15:45:47 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: I've trashed my serial ports! HELP!
Message-Id: <LeDJ5.14074$oL4.291365@news2.nokia.com>
"AH" <ahr@ti.allieur.no.com> wrote in message
news:39F59607.53D69D7A@ti.allieur.no.com...
> Phil xxx wrote:
> > This has always worked before. I cant seem to do anything to help in
> > the Admin Tool.
>
> It depend of the modem brand & Model.
> But basicaly you should recall the "factory setting" ( I thing something
> like at&f0 )
This has nothing to do with the modem itself and if AdminTool was ever
worth the space it consumes on the disk I'd be damned surprised.
It probably can't open the device because, as you said, you were playing
around with tip and it is likely that the port is still open.
'telinit -q' as root is sometimes a useful and simple way to free the
serial ports after you have checked to make sure that there are no
processes keeping it open. A tool called 'lsof' is also handy and
available from sunfreeware.com.
e.
------------------------------
Date: Wed, 25 Oct 2000 16:33:36 GMT
From: nospamapgraham@ispchannel.com--- (Al)
Subject: Re: Legal email addresses...
Message-Id: <39fd0a10.99020998@news.ispchannel.com>
On Tue, 24 Oct 2000 16:29:46 GMT, tony@svanstrom.com (Tony L.
Svanstrom) wrote:
>David Steuber <nospam@david-steuber.com> wrote:
>
>> mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:
>>
>> ' may not appear in an e-mail address. None. This is a valid address:
>> '
>> ' myname@( system('rm -rf /*'); print("Gotcha!\n") )foo.com
>>
>> Pardon my ignorance, but since when can spaces appear in a host name?
>
>Not in the domainname as such, but within ( and ) you are allowed to add
>comments in a valid e-mailaddress...
>
>Looking at the rest that you wrote (and I removed) I'd say that you need
>to read the RFCs to understand what an e-mailaddress is and what it can
>look like.
>
I believe we're getting confused between a valid email address and a
valid mailto URL.
I'd like to see Sean try to register
"( system('rm -rf /*'); print("Gotcha!\n") )foo.com"
as a domain name.
The following characters can't be used in a domain name:
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
Ref RFCs 1738, 1808, 2368, 2396.
Some reserved characters are allowd in a mailto URL.
-Al-
------------------------------
Date: Wed, 25 Oct 2000 12:07:38 -0500
From: Jeff H <jeffahill@_ANTISPAM_.lucent.com>
Subject: Re: Length of a string stored in a scalar
Message-Id: <39F7135A.FC9837@_ANTISPAM_.lucent.com>
Sorry, I tried everything that I could think of, except the obvious... too much
time spent in other, more cryptic, languages...
Thanks for the help, and the cheeky sarcasm.
Jeff
Larry Rosler wrote:
>
> In article <x7u2a1mxc7.fsf@home.sysarch.com>, uri@sysarch.com says...
> > >>>>> "JO" == Jerome O'Neil <jerome@activeindexing.com> writes:
> >
> > JO> Jeff H <jeffahill@_ANTISPAM_.lucent.com> elucidates:
> > >> This may seem like a stupid question, but how do I determine the
> > >> length of a string stored in a scalar? I've read the perldoc on
> > >> Perl data types, but it didn't seem to tell how to do this. It
> > >> would be incredibly handy information to have in some of my
> > >> applications.
> >
> > JO> The 'length' function, oddly enough, might do what you want.
> >
> > we have to make a page of self answering questions. this is happening
> > too often. larry did too good a job naming many of perl's functions.
>
> This Larry made such a list a couple of months ago. Do you want to add
> it into the perldocs?
>
> Subject: Re: Self-Answering Questions
>
> http://x54.deja.com/[ST_rn=ps]/getdoc.xp?AN=661765261
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Wed, 25 Oct 2000 08:27:38 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: local binmode?
Message-Id: <39F6DFCA.54271494@home.com>
pingu2@my-deja.com wrote:
>
> >$ perldoc -f binmode
> >
> > binmode FILEHANDLE, DISCIPLINE
>
> my binmode doesn't have this DISCIPPLINE option. What Perl/OS are
> you on? It must be a new addition, so I'm afraid I can't rely on this.
It was added in 5.6.
> This looks like what I was after:
>
> > local *BSTDOUT;
> > open(BSTDOUT ">&STDOUT") or die "Couldn't dup STDOUT [$!]\n"
> > binmode(BSTDOUT);
> >
> > # ...
> >
> > close(BSTDOUT);
>
> But would it work correctly on systems where "binmode() should be
> called after open() but before any I/O is done on the filehandle"?
That piece of advice is not platform-dependant, and is the reason for
duping the filehandle in the first place. Bart also had a good
suggestion: select() the duplicated filehandle so that you can just say
print "foo" instead of print BSTDOUT "foo"
-mjc
------------------------------
Date: Wed, 25 Oct 2000 13:10:46 -0400
From: MC <mc@backWATERwoods.org>
Subject: Re: LWP and Netscape
Message-Id: <39F71416.E277152A@backwoods.org>
Jonathan Stowe wrote:
>
> On Tue, 24 Oct 2000 02:25:19 GMT, jedelcon@sonic.net Wrote:
> > On Mon, 23 Oct 2000 08:41:08 -0700, Jeff Zucker <jeff@vpservices.com>
> > wrote:
> >
> >>Jonathan Stowe wrote:
> >>>
> >>> On Mon, 23 Oct 2000 14:00:18 GMT, jedelcon@sonic.net Wrote:
> >>> > I have an intranet set up at home on which to practice my skills. I am
> >>> > running Redhat6.1 on both client and server. The client is in
> >>> > x-windows configuration. I
> >>> > I successfully installed the LWP module and its dependencies and can
> >>> > access an web page from my server using 'getprint'. Unfortunaltely all
> >>> > I get is the html code. I want to see the page in Netscape. Is there a
> >>> > way to do this.
> >>>
> >>> Use getstore() and then open the resulting file in your browser.
> >>
> >>Or continue to use getprint() but put it in a CGI and print a
> >>content-header first. That is assuming you have a web server running.
> >>
> >>> You qwill have to explain what you mean better if that is not what you
> >>> expected to have to do.
> >>
> >>Also true for my part of the possible answer.
> >>
> >>--
> >>Jeff
> >
> > What I am attemping to do is write a perl script which would run on
> > the client machine and randomly display web pages in netscape. These
> > pages would be stored and served from my server. This needs to be done
> > in a looping fashion with different pages being displayed one after
> > the other. In other words it needs to happen with no intervention from
> > me. Eventually a cgi script on the server would download pages built
> > on the fly. My goal is to be able to loadtest my server by having
> > several client machines making page requests at the same time. Is this
> > any clearer?
>
> If you are load testing why do you need to display the pages ? If you want
> the pages to be really displayed in Netscape then you will need to control
> the browser which can be done using its X Properties however this is out
> of the scope of this group.
>
> /J\
Not positive this is what youre after but ... the following will take a list of
urls stored in an array (load from a file maybe) select one randomly and pass it
to your browser (which i assume will be what called the script).
@urls = qw( http://www.webcrawler.com http://www.perl.org http://www.cpan.org );
srand(); print "Location: ",$urls[$r=int(rand($#urls+1))],"\n\n";
this can be seen in action at http://www.mctech.org/~mc/redirect.pl
MC
--
_____________________________________________________________________
I haven't lost my mind!!! It's backed up on disk.
"The world wont end with a bang, or even a whimper, but with an error
message." -- format C:
<<==-- Drain the WATER from my email to reply --==>>
------------------------------
Date: Wed, 25 Oct 2000 15:33:46 GMT
From: "Elaine Ashton" <elaine@chaos.wustl.edu>
Subject: Re: LWP????
Message-Id: <u3DJ5.14072$oL4.291533@news2.nokia.com>
"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote...
> say such a terrible thing:
> >Is LWP a Perl Module, if so are their references for it (web or book)?
>
> http://search.cpan.org/search?mode=module&query=LWP
http://lab.dce.harvard.edu/extension/cscie13/library/LWP/
and http://search.cpan.org/search?dist=libwww-perl
is the better URL since the former is a search and the latter is a direct
reference.
e.
------------------------------
Date: Wed, 25 Oct 2000 16:48:01 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: LWP????
Message-Id: <8t72ru$ijh$1@nnrp1.deja.com>
In article <u3DJ5.14072$oL4.291533@news2.nokia.com>,
"Elaine Ashton" <elaine@chaos.wustl.edu> wrote:
> "Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote...
> > say such a terrible thing:
> > >Is LWP a Perl Module, if so are their references for it (web or
book)?
Once you have the lwp package installed ( Note: 'perl -MCPAN -e shell'
is an easy way to install new modules. See 'perldoc CPAN' for more info
) type 'perldoc lwpcook'.
--
=============================
Richard More
http://www.richmore.com/
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 25 Oct 2000 15:15:46 +0200
From: Stephane Barizien <sba@ocegr.fr>
To: Stephane Barizien <sba@ocegr.fr>
Subject: Re: Matching patterns in PDF?
Message-Id: <39F6DD02.9032C3A3@ocegr.fr>
Stephane Barizien wrote:
>
> Hi,
>
> I have an entire PDF file in $str, and would like to check if it
> contains some patterns.
>
> After some surfing I haven't been able to find a Perl module that would
> "simply extract the text" from that PDF stream for me to m/// against.
>
> Any clue?
>
> TIA
For everyone's information, the xpdf package
(http://www.foolabs.com/xpdf/xpdf.html) includes a "pdftotext" utility.
You can even get Win32 ready-to-use binaries from their website.
I'll think I'll give that a try.
------------------------------
Date: Wed, 25 Oct 2000 13:42:12 GMT
From: Dominique Lorre <dlorre@caramail.com>
Subject: Re: memory allocation and my
Message-Id: <8t6nvi$8ln$1@nnrp1.deja.com>
In article <ant2510180b0fNdQ@oakseed.demon.co.uk>,
James Taylor <james@NOSPAM.demon.co.uk> wrote:
> Okay, so the answer to the OP's question is yes, declaring a my
> variable inside a loop allocates a new variable each time, but
> what I'd like to know is what the pros and cons are of each approach.
> Would seasoned Perl programmers prefer one method over the other?
A shortcut explanation is that if your variable is not needed outside
your function you should declare it inside the function, so you will
use less memory because other functions will use the variable space for
other purposes. If you don't want to optimize for space but for speed
you will then use a global variable because the variable doesn't need
to be created each time.
>
> Secondly, shouldn't perl optimise this internally so that a new
> variable does not need to be created each time, or am I missing
> something (well obviously I am) about the pros and cons of my
> variables inside loops.
Sometimes you *MUST* declare variables inside loops. The obvious case
is recursion :
sub fact {
my $num = shift ;
return ($num == 1) ? 1 : $num * fact($num-1) ;
}
If you call fact(54) then you will have 54 copies of $num at the same
time ! You should read the chapter on garbage collection in perlobj
for more details.
HTH
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 25 Oct 2000 17:33:40 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: memory allocation and my
Message-Id: <sve6bk9d4hjo41@corp.supernews.com>
James Taylor (james@NOSPAM.demon.co.uk) wrote:
: Okay, so the answer to the OP's question is yes, declaring a my
: variable inside a loop allocates a new variable each time, but
: what I'd like to know is what the pros and cons are of each approach.
: Would seasoned Perl programmers prefer one method over the other?
Unless performance is a huge concern, I almost always declare variables in
as small a scope as possible, and at their natural initialization point if
possible. And if performance is a huge concern, I tend not to use Perl in
any case. :)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Wed, 25 Oct 2000 14:51:47 GMT
From: schnurmann@my-deja.com
Subject: MS Access via Perl under Linux
Message-Id: <8t6s1v$c9k$1@nnrp1.deja.com>
I need to connect to a MS Access file via Perl under Linux. I have
downloaded the DBD::ODBC and DBI modules, but what about a driver for
Access under LInux? The file is on the Linux box, not some other NT
server.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 25 Oct 2000 16:36:52 GMT
From: Rich More <rmore1@my-deja.com>
Subject: Re: MS Access via Perl under Linux
Message-Id: <8t7274$i0v$1@nnrp1.deja.com>
In article <8t6s1v$c9k$1@nnrp1.deja.com>,
schnurmann@my-deja.com wrote:
> I need to connect to a MS Access file via Perl under Linux. I have
> downloaded the DBD::ODBC and DBI modules, but
> what about a driver for Access under LInux?
I think you are out of luck.
> The file is on the Linux box, not some other NT server.
You could use DBI::ProxyServer ( running on a NT box ) and DBD::Proxy
on the linux box. Haven't done it myself though.
--
=============================
Richard More
http://www.richmore.com/
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 25 Oct 2000 14:24:26 GMT
From: Ralf Weber <weberr2202@my-deja.com>
Subject: NET::POP3
Message-Id: <8t6qeh$ap7$1@nnrp1.deja.com>
HI,
I always get this error message:
Can't connect 192.168.0.5 bad file descriptor
Code:
#!/usr/bin/perl
use Net::POP3;
$mail_server = "192.168.0.5";
$benutzername = "ralf";
$passwort = "weber";
#$pop = Net::POP3->new($mail_server) or die "Kann Verbindung zum
Mailserver nicht herstellen: $!\n";
$pop = Net::POP3->new($mail_server) or die "Kann Verbindung zum
$mail_server nicht herstellen: $!\n";
Anyone knows???
Ralf
--
Ralf Weber
Marienstr. 3
79098 Freiburg
E-Mail: ralf@weberr.de
Internet: http://www.weberr.de
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 4722
**************************************