[16784] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4196 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 1 06:05:27 2000

Date: Fri, 1 Sep 2000 03:05:11 -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: <967802711-v9-i4196@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 1 Sep 2000     Volume: 9 Number: 4196

Today's topics:
        ** how to detect the length of stay ** <goodman888@hongkong.com>
    Re: ** how to detect the length of stay ** (Abigail)
    Re: `pos' after !//g (Anno Siegel)
    Re: `pos' after !//g (Daniel Chetlin)
    Re: `pos' after !//g nobull@mail.com
    Re: Array Compare (Abigail)
        Challenge: Cause the "final @" error to occur (Daniel Chetlin)
        Changing Scripts from UNIX to NT kenny9939@my-deja.com
    Re: Changing Scripts from UNIX to NT <wyzelli@yahoo.com>
    Re: Changing Scripts from UNIX to NT (Homer Simpson)
    Re: Continuation format (Martien Verbruggen)
        current working directory <lucas@cplhk.com>
    Re: Dealing with uninitialized values? <lr@hpl.hp.com>
    Re: dynamic object instantiation using eval (Charles DeRykus)
        E-Commerce----application---needed <xtremex@telusplanet.net>
    Re: Fat comma quoting [was: Re: Bulk add to a hash.. Th (Rafael Garcia-Suarez)
        RE: How to read a dir with recursive directories? <roco3d@pmail.net>
    Re: How to source a shell script from perl ? <anmcguire@ce.mediaone.net>
    Re: interchanging variables <tina@streetmail.com>
    Re: Japanese Girl Needs Help. (Martien Verbruggen)
    Re: LWP::Parallel <uri@sysarch.com>
    Re: LWP::Parallel joekind@my-deja.com
    Re: My Perl looks like C! <anmcguire@ce.mediaone.net>
    Re: My Perl looks like C! <wyzelli@yahoo.com>
    Re: My Perl looks like C! <bart.lateur@skynet.be>
    Re: open web file <lxzy@yeah.net>
    Re: open web file (Martien Verbruggen)
    Re: open web file (Abigail)
    Re: output fun (Logan Shaw)
    Re: output fun <anmcguire@ce.mediaone.net>
    Re: Sample Makefiles (Martien Verbruggen)
    Re: square brackets in HERE documents <ronald_f@my-deja.com>
    Re: timelocal() is wrong? (Martien Verbruggen)
    Re: why is my perl script using so much memory (Abigail)
        win98 perl process creation limits? <olsen@azstarnet.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 01 Sep 2000 15:45:23 +0800
From: I'm a good man <goodman888@hongkong.com>
Subject: ** how to detect the length of stay **
Message-Id: <39AF5E93.23F0FFA0@hongkong.com>

how can i know how long a user has connected/read to a page?

--
Thanks and Regards,
Fung
(Find me at 92161596)




------------------------------

Date: 01 Sep 2000 10:04:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: ** how to detect the length of stay **
Message-Id: <slrn8quvnc.8ac.abigail@alexandra.foad.org>

I'm a good man (goodman888@hongkong.com) wrote on MMDLVIII September
MCMXCIII in <URL:news:39AF5E93.23F0FFA0@hongkong.com>:
"" how can i know how long a user has connected/read to a page?

1) You can't.
2) That has nothing to do with Perl.
3) You have a totally wrong idea of how the web works.
4) 1) is a lie. You can always ask the user.
5) 1) wasn't a lie after all. The user could lie.

Followups set.


Abigail
-- 
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
   . "\162\1548\110\141\143\153\145\162\0128\177"  and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}


------------------------------

Date: 1 Sep 2000 07:48:13 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: `pos' after !//g
Message-Id: <8onmvt$nco$1@lublin.zrz.tu-berlin.de>

Bart Lateur  <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
>Hideaki Hase wrote:
>
>>Is there any way to keep the return of `pos' function the value before
>>the corresponding pattern matching with `g' option when the matching
>>results failure?
>
>There's the //c modifier.

Perldoc perlre doesn't mention '/c'.  What is it?

Anno


------------------------------

Date: Fri, 01 Sep 2000 08:25:34 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: `pos' after !//g
Message-Id: <2KJr5.3346$f65.229805@news-west.usenetserver.com>

On 1 Sep 2000 07:48:13 -0000,
 Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>Perldoc perlre doesn't mention '/c'.  What is it?

From perlop:
  
  =item m/PATTERN/cgimosx
  
  =item /PATTERN/cgimosx
  
  [snip]
  
  Options are:
  
      c   Do not reset search position on a failed match when /g is in effect.

Not a well-known switch, but simple:
  
  [~] $ perl -le'$_="abab";print "Got: $&" while /a/g;print "Got: $&" if /\w/g'
  Got: a
  Got: a
  Got: a
  [~] $ perl -le'$_="abab";print "Got: $&" while /a/gc;print "Got: $&" if /\w/g'
  Got: a
  Got: a
  Got: b

-dlc




------------------------------

Date: 1 Sep 2000 08:48:27 +0100
From: nobull@mail.com
Subject: Re: `pos' after !//g
Message-Id: <u9n1hswlkc.fsf@wcl-l.bham.ac.uk>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

> Bart Lateur  <bart.lateur@skynet.be> wrote in comp.lang.perl.misc:
> >There's the //c modifier.
> Perldoc perlre doesn't mention '/c'.  What is it?

A fairly new modifier that modifies the m// operator _not_ the regular
expression.

Like other such modifiers (e.g. '/g') it is documented in perlop not
perlre.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 01 Sep 2000 04:25:28 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Array Compare
Message-Id: <slrn8qubs5.8ac.abigail@alexandra.foad.org>

Bart Lateur (bart.lateur@skynet.be) wrote on MMDLVII September MCMXCIII
in <URL:news:8hptqs82g1tuhf3686bqlfh0bh9seddac3@4ax.com>:
__ marxjkj123@my-deja.com wrote:
__ 
__ >Hello all,  I have a bit of a problem.  I have two arrays(array X &
__ >array Y) and need to compare them against one another.  If my array(X)
__ >element is equal to an element in array(Y), do nothing.  But if an
__ >element in array(X) is not equal to any of the array(Y) elements append
__ >array(X) element results into a third array(Z).
__ 
__ I'll use a hash, not a third array, if you don't mind.
__ 
__ 	my %z;
__ 	@z{@x} = ();
__ 	delete @z{@y};
__ 	my @z =  keys %z; # the result, in pseudo-random order.
__ 	print "@z\n";
__ 
__ If you really insist on having the elements in the original order:
__ 
__ 	my %z;
__ 	@z{@x} = 1 .. @x;
__ 	delete @z{@y};
__ 	my @z = sort { $z{$a} <=> $z{$b} } keys %z;


Or without sort:

        my %z;
        @z {@y} = ();
        my @z = grep {!exists $z {$_}} @x;



Abigail
-- 
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
   . "\162\1548\110\141\143\153\145\162\0128\177"  and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}


------------------------------

Date: Fri, 01 Sep 2000 06:56:43 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Challenge: Cause the "final @" error to occur
Message-Id: <LqIr5.3116$f65.215541@news-west.usenetserver.com>

From perldiag.pod:
  
  =item Final @ should be \@ or @name
  
  (F) You must now decide whether the final @ in a string was meant to be
  a literal "at" sign, or was meant to introduce a variable name that
  happens to be missing.  So you have to put either the backslash or the
  name.

My challenge to you: using a relatively recent (say, 5.005_03 or later) Perl,
come up with code that causes this error to occur.

-dlc




------------------------------

Date: Fri, 01 Sep 2000 04:23:20 GMT
From: kenny9939@my-deja.com
Subject: Changing Scripts from UNIX to NT
Message-Id: <8onav8$cv7$1@nnrp1.deja.com>

We recently switched hosting companies and the new servers they use are
all NT. I am attempting to convert my UNIX CGI and Perl scripts to work
on the new NT servers and have a few questions concerning paths to perl
and absolute paths to directories on the NT. The tech support for the
new servers says that the scripts don't have to be in a specific
directory and don't require a path to perl. They are executed simply by
having a .pl or .cgi extension. Does this mean that the traditional
first line that points to perl (#!/usr/local/bin/perl) should be
deleted? How about paths to features like mail and date?
($mailCmd= '/usr/sbin/sendmail';$dateCmd = '/bin/date';) Would these
paths now need to be something like C:\usr\directory?


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 1 Sep 2000 14:15:13 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Changing Scripts from UNIX to NT
Message-Id: <XwGr5.50$Pc.3996@vic.nntp.telstra.net>

<kenny9939@my-deja.com> wrote in message
news:8onav8$cv7$1@nnrp1.deja.com...
> We recently switched hosting companies and the new servers they use
are
> all NT. I am attempting to convert my UNIX CGI and Perl scripts to
work
> on the new NT servers and have a few questions concerning paths to
perl
> and absolute paths to directories on the NT. The tech support for the
> new servers says that the scripts don't have to be in a specific
> directory and don't require a path to perl. They are executed simply
by
> having a .pl or .cgi extension. Does this mean that the traditional
> first line that points to perl (#!/usr/local/bin/perl) should be
> deleted? How about paths to features like mail and date?

Not deleted, but the system will ignore the path.  The shebang line is
still good for switches like -w and -T... you are using those?


> ($mailCmd= '/usr/sbin/sendmail';$dateCmd = '/bin/date';) Would these
> paths now need to be something like C:\usr\directory?

You would need to ask your hosting company if they have one of the
windows ports of sendmail installed.  If not you will need to either get
it installed (in which case just use 'sendmail') or re-write to use
another method of mail sending (blat.exe, or one of the Mail modules).

IMHO the former is easier.

As far as date, I think the format of that whole section may turn out to
be completely wrong, and you should probably update your scripts to use
'localtime' one of the inbuilt time functions so then your scripts will
be more portable.

Wyzelli




------------------------------

Date: 1 Sep 2000 07:02:37 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: Changing Scripts from UNIX to NT
Message-Id: <8onkad$7vr$0@216.39.131.168>

In article <8onav8$cv7$1@nnrp1.deja.com>, kenny9939@my-deja.com wrote:
>We recently switched hosting companies and the new servers they use are
>all NT.

The shbang line can be removed or left alone.  It's not necessary on Win32 
systems and is ignored as a comment.

If you use -w in your scripts you can include the local path (eg 
c:\perl\bin\perl.exe -w ) but you'll need to confirm with the server operator 
what that exact path is...


calls to sendmail and date won't work on NT for the same reason that a call to 
Excel wouldn't work on Unix... the programs don't exist in a standard 
distribution of the OS.

There are a bunch of external programs to sendmail (I use BLAT) or you can 
write a mail routine in Perl.  If you use an external program you'll have to 
have the server operators install it or tell you what/where it is...

The NT date command won't return what you expect from Unix's 'date' command.  
You'll be happier using the localtime to write your own date and time routine.



------------------------------

Date: Fri, 1 Sep 2000 20:03:39 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Continuation format
Message-Id: <slrn8qus7b.ucf.mgjv@martien.heliotrope.home>

On Thu, 31 Aug 2000 23:00:29 GMT,
	danraymond@my-deja.com <danraymond@my-deja.com> wrote:
[other attributions were removed in original post]
> 
> > > Try doing that with the command input operator:
> > >
> > > print `ls
> > >        /usr/local`;
> > >
> > > It won't work.  A single backslash won't help
> >
> > It still works. Perl does the right thing, and passes the string off
> > to the shell. It's just that the shell doesn't want that newline in
> > there.
> >
> > > either.  A double backslash seems to work
> > > but I'm not sure exactly why.  Anyone know?
> >
> > Strings in backquotes are interpolated as a double-quoted string,
> > meaning that a backslash is the escape character. You need to use two
> > to end up with one in the string that gets passed off to the shell.
> 
> One might argue that if "\" is the escape character then Perl should
> treat a "\<newline>" differently than just a "<newline>".  Ie. strip out
> any "\<newline>" it encounters.  That would be the intuitive result.

You could argue that, but it simply isn't implemented like that. :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.   | accept as reality - Calvin
NSW, Australia                  | 


------------------------------

Date: Fri, 1 Sep 2000 16:32:45 +0800
From: "Lucas Tsoi" <lucas@cplhk.com>
Subject: current working directory
Message-Id: <8onpec$23143@imsp212.netvigator.com>

Hi all,

I need to read the files and directories under the current directory,

How do I tell Perl "current working directory"?

must I download the Cwd to do that?



Thanks very much




------------------------------

Date: Thu, 31 Aug 2000 21:56:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Dealing with uninitialized values?
Message-Id: <MPG.1418d6d69b6865df98ad12@nntp.hpl.hp.com>

In article <8on7rk$7bk$1@news.chatlink.com>, carter@aodinc.com says...
> How does one deal with uninitialized values?

Carefully.  :-)

> Since adding the -w to the hashbang call at the beginning of my script, any
> time I test using an uninitialized value, I (obviously) get the warning, and
> I don't quite know how to deal with this.
> 
> Incasing everything within
> if ($var) { do this } else { uninitialized }
> type structures is just too much.

  $var ? do this : uninitialized

or

  defined $var ? ...

> It's pretty easy to avoid the problem when using standard variables.  Just
> make sure every variable is initialized at the beginning.  The problem is
> with hashes.
> 
> I store data in a hash in name/value pairs, $form{$name}=$value.  When going
> through and testing the hash, the name may or may not exist depending on the
> data which was fed into it.

Depending on what criteria you want, you can use:

    (exists  $form{$name} ? $form{$name} :  'default value')

or, if you don't want to use an existing undefined value,

    (defined $form{$name} ? $form{$name} :  'default value')

or, if you don't care about different 'false' values, simply

                            ($form{$name} || 'default value')

(The parentheses are just to bind the expression together in any contxt, 
and may not be needed.)

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


------------------------------

Date: Fri, 1 Sep 2000 04:47:17 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: dynamic object instantiation using eval
Message-Id: <G06yMt.EvE@news.boeing.com>

In article <EjDr5.13028$Q36.949225@bgtnsc07-news.ops.worldnet.att.net>,
Paul Johnston <johnston.p@worldnet.att.net> wrote:
># This works:
>...
># This dies with "Can't find method new":
>package Foo;
>my $class = "MyPackage::MyClass";
>my $obj = eval $class . '->new($myargs)';
>

You're missing a C<require> to pull in MyPackage::MyClass.
And you don't need an eval to invoke the constructor: 

   eval "require $class";
   die $@ if $@;
   $class->new($myargs);


># this dies with can't find MyPackage::MyClass;
>package Foo;
>my $class = "MyPackage::MyClass";
>require $class;
>

That'd only work with a bareword, e.g.,

  require MyPackage::MyClass;

again in this case you'll need: 

  eval "require $class";

perldoc -f require for details.


--
Charles DeRykus


------------------------------

Date: Fri, 01 Sep 2000 04:36:39 GMT
From: "Irene Facchin" <xtremex@telusplanet.net>
Subject: E-Commerce----application---needed
Message-Id: <rnGr5.82$7F3.73477@news0.telusplanet.net>

I am looking for a perl application for E-Commerce,
I am not concerned if it is completed.  But I would like something that I
can complete

I am very familiar with Perl, and would like to see if there is somethign
that can expediate the work I need to do\

thank you






------------------------------

Date: Fri, 01 Sep 2000 07:05:18 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Fat comma quoting [was: Re: Bulk add to a hash.. Thanks for the help!]
Message-Id: <slrn8qulko.5v1.rgarciasuarez@rafael.kazibao.net>

Keith Calvert Ivey wrote in comp.lang.perl.misc:
>Uri Guttman <uri@sysarch.com> wrote:
>>>>>>> "KCI" == Keith Calvert Ivey <kcivey@cpcug.org> writes:
>
>>  KCI> I thought it was the other way around: the common use of -foo in
>>  KCI> sub calls came from the fact that you could do it.  And a
>>  KCI> bareword is still a bareword if it has an operator in front of
>>  KCI> it.
>>
>>my impression is that many modules like tk and cgi used -foo for keys a
>>long time before +> was fixed to handle a leading -. i recall complaints
>>about why it doesn't work with them, and now it does. i bet a little
>>searching of the deltas would clear this up. i have to run so i can't do
>>it now.
>
>You're probably right.  I just assumed that one reason minus was
>chosen as the character to distinguish the names was that it
>worked with the => operator.  Otherwise, why not use % or = or *
>or anything else not likely to occur at the beginning of an
>argument?

I don't know why minus was chosen, but can I suggest something?
When @ARGV contains something like ('-f','foo.in','-o','foo.out'), the
typical command-line, it is easy to convert it to a hash. This is not
as efficient as using the Getopt modules, but this may have been taken
into consideration at this time.

-- 
Rafael Garcia-Suarez


------------------------------

Date: Fri, 1 Sep 2000 05:53:05 -0400
From: "Rodrigo Cortés" <roco3d@pmail.net>
Subject: RE: How to read a dir with recursive directories?
Message-Id: <dTKr5.8547$gi.118311@maule>

thanks...

"Thomas Åhlen" <thomas2@dalnet.se> escribió en el mensaje
news:Buur5.81$pz5.53289@news.bahnhof.se...
> You could try somthing like this:
>
> ===============
>
> use File::Find ();
>
> # some code here
>
> sub find(&@) { &File::Find::find }
> find { push @{$array}, $File::Find::name if -d } $path;
>
> ===============
>
> This will give you an array with all directories under the given path.
>
> Thomas Åhlen






------------------------------

Date: Fri, 1 Sep 2000 01:31:09 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: How to source a shell script from perl ?
Message-Id: <Pine.LNX.4.21.0009010121270.28238-100000@hawk.ce.mediaone.net>

On Fri, 1 Sep 2000, zagni@yahoo.com quoth:

~~ Date: Fri, 01 Sep 2000 01:51:49 GMT
~~ From: zagni@yahoo.com
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: How to source a shell script from perl ?
~~ 
~~ I need to source a shell script from a perl program and make the
~~ variables visible to the program.

I posted this one a while back, be aware though that you don't have
to clobber %ENV.  You could dupe it, then compare to see which values
to overwrite.

#!/usr/bin/perl -w
use strict;

my $script = '/path/to/some/script';
%ENV = (); # nukes entire %ENV (may not be wanted)
my @shenv = `sh -c ". $script; /usr/bin/env"`;
chomp @shenv;
%ENV = map { split /=/ } @shenv;

print map { "$_ => $ENV{$_}\n" } keys %ENV;
__END__

anm
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Andrew N. McGuire                                                      ~
~ anmcguire@ce.mediaone.net                                              ~
~ "Plan to throw one away; you will, anyhow." - Frederick P. Brooks, Jr. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------------------------------

Date: 1 Sep 2000 05:16:18 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: interchanging variables
Message-Id: <8one31$b3d5r$1@ID-24002.news.cis.dfn.de>

Russ Jones <russ_jones@rac.ray.com> wrote:
> Paul Eckert wrote:
>> Abigail wrote:
>> > --
>> > ($;,$_,$|,$\)=3D("\@\x7Fy~*kde~box*Zoxf*Bkiaox"," "x25,1,"\r");
>> > {vec($_=3D>1+$"=3D>$^F<<$^F)=3Dord($/^substr$;=3D>$"=3Dint rand 24=3D=
>1);
>> >  print&&select$,,$,,$,,$|/($|+tr/ //c);redo if y/ //>$^F**2};
>>=20
>> I just tried running your signature above!
>> I can't believe how cool this latest one is.
>> I think I learn more from figuring out (if I can) how these work
>> and what they are doing than from anything else in this group!
>> Keep it up!

> Damn! That ain't natural! Pretty amazing. I'm with Paul, keep it up!

yep, this one was faszinating me. so much that I tried
my first own japh. I must admit, I stoled probably
some ideas from abigail's one, and it's a little bit too
long, but at least I admit it =3D)
(I know this is already offtopic but... SCNR)

tina

--=20
$|++;$\=3D"\r";${"}--;@a=3Dqw(. o O);$c=3D"Kvtu!bopuifs!Qfsm!ibdlfs-";$=A7=
=3D"_"x25;%_=3D
map{($r++,chr(ord($_)+$"))}split//,$c;until($=A7!~m~_~){$o=3Dint(rand(28))=
+65;next
if$s{$o}++;$o=3D=3D91?$o=3D44:($o=3D=3D92?$o=3D32:0);$g=3Dchr$o;for(0..24)=
{if($_{$_}=3D~m)$g)i)
{for$m(@a,$_{$_}){substr($=A7,$_,$|,$m);print$=A7;select$/,$/,$/,0.1}}}pri=
nt$=A7}print$/


------------------------------

Date: Fri, 1 Sep 2000 20:10:48 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Japanese Girl Needs Help.
Message-Id: <slrn8qusko.ucf.mgjv@martien.heliotrope.home>

On Thu, 31 Aug 2000 10:33:51 -0400,
	Kaori Ayn Honeywell <kaori@japanesegirl.com> wrote:
> Hello,
> 
> Require PERL programming that allows
> visitors to my web site to enter their name
> and email address into a form.

Pity. If it'd been Cobol I migth have been interested.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Can't say that it is, 'cause it
Commercial Dynamics Pty. Ltd.   | ain't.
NSW, Australia                  | 


------------------------------

Date: Fri, 01 Sep 2000 04:05:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: LWP::Parallel
Message-Id: <x7r974pxi3.fsf@home.sysarch.com>

>>>>> "j" == joekind  <joekind@my-deja.com> writes:

  j> The problem is that after connecting to a few sites it says
  j> LWP::Parallel cannot handle request (501 error).
  j> Can someone please help me because I want to make this script grab the
  j> content from these sites fast and that is why I am using
  j> LWP::Parallel::UserAgent.  I have just used LWP::UserAgent before and
  j> got it to work, but I need it to be faster.

i tried to use LWP::Parallel and didn't get good results. i switched to
using forked processes which run plain LWP and IO::Select to get the
pages back from the children.

i think LWP::Parallel is too complicated and it has too many wierdnesses
in LWP to overcome.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Fri, 01 Sep 2000 04:28:16 GMT
From: joekind@my-deja.com
Subject: Re: LWP::Parallel
Message-Id: <8onb8e$d9u$1@nnrp1.deja.com>

I have tried using forking too but I could not get the program to wait
until it had got all of the content from the sites.  How did you get
yours to wait and how fast was did your program get the content?  Any
code that you may have will help greatly.

In article <x7r974pxi3.fsf@home.sysarch.com>,
  Uri Guttman <uri@sysarch.com> wrote:
> >>>>> "j" == joekind  <joekind@my-deja.com> writes:
>
>   j> The problem is that after connecting to a few sites it says
>   j> LWP::Parallel cannot handle request (501 error).
>   j> Can someone please help me because I want to make this script
grab the
>   j> content from these sites fast and that is why I am using
>   j> LWP::Parallel::UserAgent.  I have just used LWP::UserAgent
before and
>   j> got it to work, but I need it to be faster.
>
> i tried to use LWP::Parallel and didn't get good results. i switched
to
> using forked processes which run plain LWP and IO::Select to get the
> pages back from the children.
>
> i think LWP::Parallel is too complicated and it has too many
wierdnesses
> in LWP to overcome.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX
Consulting
> The Perl Books Page  -----------  http://www.sysarch.com/cgi-
bin/perl_books
> The Best Search Engine on the Net  ----------
http://www.northernlight.com
>


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Thu, 31 Aug 2000 23:35:16 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: My Perl looks like C!
Message-Id: <Pine.LNX.4.21.0008312324100.28238-100000@hawk.ce.mediaone.net>

On Fri, 1 Sep 2000, Keith Calvert Ivey quoth:

~~ Date: Fri, 01 Sep 2000 02:59:25 GMT
~~ From: Keith Calvert Ivey <kcivey@cpcug.org>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Re: My Perl looks like C!
~~ 
~~ "Andrew N. McGuire " <anmcguire@ce.mediaone.net> wrote:
~~ >On Thu, 31 Aug 2000, Tim quoth:
~~ 
~~ >~~ o Use hashes.  A lot.
~~ >
~~ >Based on what premise?  A hash is not the end all data structure.
~~ >Use the appropriate data structure for the task you are trying to
~~ >accomplish!
~~ 
~~ I think these are supposed to be rules of thumb, and as such
~~ shouldn't be pressed too far.  Hashes are one of the strengths
~~ of Perl, and those new to Perl often fail to use them when
~~ they're the best solution.

True, but I think the rule of thumb is or perhaps should be to use the 
best data structure for the job.  Actually the rule of thumb should be
to peruse the docs, as they give some fairly decent guidance as to
efficient ways to do many things.  Hashes are a strong point with
Perl, yes, but Perl is not the only language to implement hashes.
What I was saying is that on this point, the principles are the same
as with C, or Python, etc... Use the best data-structure for the task
at hand.  Sometimes this takes some thought, but more often the data
dictates the structure.

~~ >~~ o Use logical operators.  this() or die; is a lot cleaner than 
~~ >~~   if (this()) { die; }.  Same with $x = $this || $that;
~~ >
~~ >I usually use:
~~ >
~~ >$x ||= $that;
~~ >
~~ >most often to set defaults after a GetOptions().  It is a matter of
~~ >style, I suppose.
~~ 
~~ It's a matter of what you're trying to do.  Tim's statement does
~~ something different from yours.  If he'd written
~~ 
~~     $x = $x || $that;
~~ 
~~ then your correction would have been right.

Your right, I had a brain fart!

anm
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Andrew N. McGuire                                                      ~
~ anmcguire@ce.mediaone.net                                              ~
~ "Plan to throw one away; you will, anyhow." - Frederick P. Brooks, Jr. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------------------------------

Date: Fri, 1 Sep 2000 14:17:39 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: My Perl looks like C!
Message-Id: <8zGr5.53$Pc.3951@vic.nntp.telstra.net>

"Andrew N. McGuire " <anmcguire@ce.mediaone.net> wrote in message
news:Pine.LNX.4.21.0008312324100.28238-100000@hawk.ce.mediaone.net...
> ~~ then your correction would have been right.
>
> Your right, I had a brain fart!
>

What? No accusations of hatefulness?  <grin>

Wyzelli




------------------------------

Date: Fri, 01 Sep 2000 06:58:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: My Perl looks like C!
Message-Id: <pqkuqs4582aeq2th2d5vc4o7t4fcmssuub@4ax.com>

Tim wrote:

>  Use logical operators.  this() or die; is a lot cleaner than 
>  if (this()) { die; }.

Maybe, but it doesn't do the same thing. You forgot a negation in your
second example. Perl builtins commonly return true on success, false on
failure.

-- 
	Bart.


------------------------------

Date: Fri, 1 Sep 2000 16:37:41 +0800
From: "Xin Li" <lxzy@yeah.net>
Subject: Re: open web file
Message-Id: <8onpn4$7du$1@info.bta.net.cn>

Hi,
This is example:

open (READ,"<path>/test.htm");
@temp=<READ>;
close (READ);

the "@temp" have some value.
it is the "test.htm" 's content.

"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:874s40hq3r.fsf@limey.hpcc.uh.edu...
>
> That's nice.  What's that got to do with "open"ing URL's
> over a network?
>
> hth
> t
> --
> "I'm not easily impressed.  Wow!  A blue car!"
>                                                Homer Simpson




------------------------------

Date: Fri, 1 Sep 2000 20:07:19 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: open web file
Message-Id: <slrn8quse7.ucf.mgjv@martien.heliotrope.home>

On 31 Aug 2000 22:18:19 GMT,
	Abigail <abigail@foad.org> wrote:
> Sean Scannell (sean@access-management.com) wrote on MMDLVII September
> MCMXCIII in <URL:news:ZBAr5.85$WH4.68667@news.pacbell.net>:
> || Why does the following die:
> || 
> || open (TEMP, 'http://www.foo.com/bar.html') || die
> 
> Why do you ask? Perl has a useful mechanism that tells you why
> something failed. Why don't you use it instead of asking here?
> 
> || I guess I can fetch the file via LWP, but just wondering.
> 
> open() has lots of magic, but only C-API specific and, unfortunally,
> no HTTP semantics. It would be useful though.

Ugh... please not. We'd get all these people here asking how they can
replace a line in the 'file' on their web site.

Besides that, URLs and files just don't have enough in common to use the
open paradigm. A get/put way of dealing with these things is much more
natural to me.

Next people will expect to be able to use seek, flock, and sysopen on
these things.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Begin at the beginning and go on
Commercial Dynamics Pty. Ltd.   | till you come to the end; then stop.
NSW, Australia                  | 


------------------------------

Date: 01 Sep 2000 10:01:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: open web file
Message-Id: <slrn8quvj1.8ac.abigail@alexandra.foad.org>

Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDLVIII September
MCMXCIII in <URL:news:slrn8quse7.ucf.mgjv@martien.heliotrope.home>:
// On 31 Aug 2000 22:18:19 GMT,
// 	Abigail <abigail@foad.org> wrote:
// > 
// > open() has lots of magic, but only C-API specific and, unfortunally,
// > no HTTP semantics. It would be useful though.
// 
// Ugh... please not. We'd get all these people here asking how they can
// replace a line in the 'file' on their web site.
// 
// Besides that, URLs and files just don't have enough in common to use the
// open paradigm. A get/put way of dealing with these things is much more
// natural to me.
// 
// Next people will expect to be able to use seek, flock, and sysopen on
// these things.

Really? Perhaps we should remove pipe opens as well then. For more than a
decade, people could have expected to seek, flock and sysopen them!  Oh,
and get rid of opening STDOUT, STDIN, STDERR, and -, as people might
want to seek! Or flock them! Good heavens. We can't have that.

If you don't want magic in open(), you should argue to get rid of open()
and just use sysopen(). Given the usefulness of the current magic, open
of (some) URLs is not more than a logical extension. But we know Perl is
slow to adapt. Unicode and threads are still experimental and incomplete.
URLs have only been around for less than 10 years, I wouldn't expect
Perl to catch on for a few years.


Abigail
-- 
CHECK {print "another "}  #  A beetle flies over
END   {print "Hacker\n"}  #  a lake. Two young girls near
INIT  {print "Perl "   }  #  a grass field. Or Wunt.
BEGIN {print "Just "   }


------------------------------

Date: 1 Sep 2000 00:19:01 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: output fun
Message-Id: <8one85$ekg$1@provolone.cs.utexas.edu>

In article <slrn8qu8t4.ci6.tjla@thislove.dyndns.org>,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
>say such a terrible thing:
>>In article <8ogdcm$56v$1@nnrp1.deja.com>,  <ankban4@my-deja.com> wrote:
>
>>Well, my code is a little longer than others' code, but here it is:
>
>>		select (undef, undef, undef, rand * rand);
>
>ITYM:
>                select(undef, undef, undef, rand() * rand());

O.K.  Honest question:  why would I need to do that?  I mean,
you see code like this all the time:

	while (<>)
		{ $l += length; }

So, how is using length() without parenthesis any different from using
rand() without parenthesis?

  - Logan


------------------------------

Date: Fri, 1 Sep 2000 01:19:07 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: output fun
Message-Id: <Pine.LNX.4.21.0009010114101.28238-100000@hawk.ce.mediaone.net>

On 1 Sep 2000, Logan Shaw quoth:

~~ Date: 1 Sep 2000 00:19:01 -0500
~~ From: Logan Shaw <logan@cs.utexas.edu>
~~ Newsgroups: comp.lang.perl.misc
~~ Subject: Re: output fun
~~ 
~~ In article <slrn8qu8t4.ci6.tjla@thislove.dyndns.org>,
~~ Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
~~ >I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
~~ >say such a terrible thing:
~~ >>In article <8ogdcm$56v$1@nnrp1.deja.com>,  <ankban4@my-deja.com> wrote:
~~ >
~~ >>Well, my code is a little longer than others' code, but here it is:
~~ >
~~ >>		select (undef, undef, undef, rand * rand);
~~ >
~~ >ITYM:
~~ >                select(undef, undef, undef, rand() * rand());
~~ 
~~ O.K.  Honest question:  why would I need to do that?  I mean,
~~ you see code like this all the time:
~~ 
~~ 	while (<>)
~~ 		{ $l += length; }
~~ 
~~ So, how is using length() without parenthesis any different from using
~~ rand() without parenthesis?

In this case, I don't see a difference, however if you try:

perl -e 'print "hello, world\n" if rand < 1'

it fails, however

perl -e 'print "hello, world\n" if rand() < 1'

is allowed.

In your case though, it does not matter.

anm
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Andrew N. McGuire                                                      ~
~ anmcguire@ce.mediaone.net                                              ~
~ "Plan to throw one away; you will, anyhow." - Frederick P. Brooks, Jr. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



------------------------------

Date: Fri, 1 Sep 2000 20:14:50 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Sample Makefiles
Message-Id: <slrn8qussa.ucf.mgjv@martien.heliotrope.home>

On Thu, 31 Aug 2000 18:12:20 -0500,
	Nektarios Rigas <umrigas@cc.umanitoba.ca> wrote:
> Hi Everyone,
> 
> Are there any sample perl makefiles out there that  I may read?
> I need one that successfully loads external windows libraries.
> I've searched and have not found any yet.
> 
> I am on Win NT and have the most current version of Perl.

Almost all the modules on CPAN have a Makefile.PL. Maybe there are some
windows specific ones that work for you?

Start at http://www.cpan.org/

> Just to let you know:
> I have read the man page on ExtUtils::MakeMaker and I am obviously
> not doing something right.

What makes you say that? Error messages? daemons flying out of your
nose?

I'm not sure how well all the make stuff works on Windows, or how well
it's been tested there. The windows people normally use ppm to install
their stuff, but someone has to compile it up from the CPAN modules, so
I guess it does work in some installations/environments. Maybe you could
ask ActiveState, or check their site. They may have some tips on which
make to get, and stuff like that.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Freudian slip: when you say one
Commercial Dynamics Pty. Ltd.   | thing but mean your mother.
NSW, Australia                  | 


------------------------------

Date: Fri, 01 Sep 2000 06:16:44 GMT
From: Ronny <ronald_f@my-deja.com>
To: kuritzky@math.berkeley.edu
Subject: Re: square brackets in HERE documents
Message-Id: <8onhk0$k1g$1@nnrp1.deja.com>

(Message mailed and posted)

In article <8oimqg$dr6$1@agate.berkeley.edu>,
  kuritzky@math.berkeley.edu (Eric Kuritzky) wrote:
> In article <slrn8qpkjm.dqh.marcel@gandalf.local>,
> Marcel Grunauer <marcel@codewerk.com> wrote:
> >On Wed, 30 Aug 2000 09:12:10 GMT, Ronny <ronald_f@my-deja.com> wrote:
> >
> >>Say I have a scalar $x, which contains "abc", and I want to build
the
> >>string "abc[]". Since "$x[]" does not work - it would interpret x as
an
> >>array - I would write this as
> >>	$x."[]"
> >>
> >>But how can I do this, if I'm inside a HERE document? I.e.:
> >>
> >>$r=<<!END
> >>...
> >>$x[]  <--- does not work of course
> >>...
> >>!END
> >>;
> >
> >
> >    $x\[]
> >
>
> ${x}[] also works.
>

Actually, that's what I thougt first too, but it does not in a HERE
document. This is the stripped down example from my code:

sub foo
{
	my $stem="xxx";
	my $result=<<"!END"
        char const head_${stem}[] = "...";
!END
    ;
    $result;
}

This gives the error message

	Global symbol "@stem" requires explicit package name
--
Ronald Fischer <ronald_f@my-deja.com>
http://profiles.yahoo.com/ronny_fischer/


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Fri, 1 Sep 2000 20:23:38 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: timelocal() is wrong?
Message-Id: <slrn8qutcq.ucf.mgjv@martien.heliotrope.home>

[please for future reference: Place your response _after_ the suitably
shortened text you include]

On Wed, 30 Aug 2000 18:06:17 -0400,
	Jonah <jjk@onlink.net> wrote:
> well slap me stupid,
> 
> print scalar localtime timelocal 0,0,0,31,1,100;
> 
> output: Sat Mar 2 00:00:00 2000
> 
> print scalar localtime timelocal 0,0,0,35,1,100;
> 
> output: Mon Mar 6 00:00:00 2000

Hmmmm... 35 - 31 = 4. Mon - Sat = 2. Wonder if you really get that
output..

Anyway, assuming you do.. There still is something wrong with your
system, or your setup, or you live on a different planet from me:

#  perl -MTime::Local -le 'print scalar localtime timelocal -1,0,0,31,1,100)
Thu Mar  2 00:00:00 2000

And you also seem to have a different version of timelocal from me
(the module doesn't define $VERSION, and has no other versioning
information. Should be considered a bug :). It's the one shipped with
Perl 5.6.0):

# perl -MTime::Local -le 'print scalar localtime timelocal 0,0,0,35,1,100'
Day '35' out of range 1..31 at -e line 1

# cal 03 2000
     March 2000
Su Mo Tu We Th Fr Sa 
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

> DUH!

hmmm..

[Jeopardectomy performed]

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | Curiouser and curiouser, said Alice.
NSW, Australia                  | 


------------------------------

Date: 01 Sep 2000 06:12:40 GMT
From: abigail@foad.org (Abigail)
Subject: Re: why is my perl script using so much memory
Message-Id: <slrn8qui55.8ac.abigail@alexandra.foad.org>

Eli the Bearded (elijah@workspot.net) wrote on MMDLVIII September
MCMXCIII in <URL:news:eli$0008312106@qz.little-neck.ny.us>:
== 
== With perl5.6.0 built for i686-linux-thread, the output diagnostics are:
                                       ^^^^^^
== 
== With perl5.00503 built for i386-linux, the output diagnostics are:


If you want to compare behaviours of Perls when it comes to speed and
memory usuage between different versions, the least you should do is
build similar perls. It's generally known that threaded perls take
a performance penalty, and hence perl doesn't get build with thread
support unless you specifically request it.



Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


------------------------------

Date: Thu, 31 Aug 2000 23:33:06 -0700
From: Matthew Olsen <olsen@azstarnet.com>
Subject: win98 perl process creation limits?
Message-Id: <39AF4DA2.16982347@azstarnet.com>

I'm trying to put together a Tk frontend to a DOS program under the
following conditions:
* must use Win98 for distribution
* ActivePerl Build 617 (Perl 5.6)
* it calls a DOS program many times, changing parameters each time
* need to read STDOUT from the DOS program

I can't seem to start more than 64 processes using backticks or using
open() and piping the results back to my program.  From my quick read,
Win32::process doesn't let me capture STDOUT.  Is this a know bug?  It
doesn't happen in Linux or Solaris.  Here's a sample bit of code to
illustrate the problem:

$i = 1;
until ($i == 70) {
    $output = `echo hello`;
    print "$i: $output";    
    $i++;
}

As you can see, after the 64th run, the backticked command isn't being
executed.  I can't find a mention of this limit in any of the docs,
either.  I'd love to hear a workaround (splitting the job into multiple
loops doesn't work) or a definative "give up".

-Matt


------------------------------

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


home help back first fref pref prev next nref lref last post