[17681] in Perl-Users-Digest
Perl-Users Digest, Issue: 5101 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 13 14:05:42 2000
Date: Wed, 13 Dec 2000 11:05:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976734319-v9-i5101@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 13 Dec 2000 Volume: 9 Number: 5101
Today's topics:
Re: =~ operator <mcs2@pitt.edu>
Re: =~ operator (Mark-Jason Dominus)
ActivePerl from Server fudokai@my-deja.com
ActivePerl v Indigo Star mike_solomon@lineone.net
Re: Better way to remove lines from output? <bart.lateur@skynet.be>
Re: changing file permissions with a perl command (not <juex@deja.com>
Re: default method (Mark-Jason Dominus)
Re: default method (Mark-Jason Dominus)
Re: default method <joe+usenet@sunstarsys.com>
Re: default method <jeffp@crusoe.net>
Re: easy question <ng@fnmail.com>
Eliminating unneeded whitespace... <ncheung@draper.com>
Re: Eliminating unneeded whitespace... (Abigail)
Re: Eliminating unneeded whitespace... (Rafael Garcia-Suarez)
Re: Eliminating unneeded whitespace... <schneider@xtewa.de>
Re: Eliminating unneeded whitespace... <jeffp@crusoe.net>
Re: Eliminating unneeded whitespace... <jeffp@crusoe.net>
Re: Eliminating unneeded whitespace... mike_solomon@lineone.net
Re: Eliminating unneeded whitespace... (Mark Ferguson)
exec command.. and htpasswd <leslies@santaland.com>
Re: exec command.. and htpasswd (Abigail)
Re: exec command.. and htpasswd (Rafael Garcia-Suarez)
Re: exec command.. and htpasswd <tony_curtis32@yahoo.com>
Re: Faster than LWP (Mark-Jason Dominus)
Re: Faster than LWP (Helgi Briem)
FTP (J. K.)
Re: How do I find out my own IP Address? <cbk047@email.mot.com>
HTML Output <jhardy@cins.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 13 Dec 2000 10:11:03 -0500
From: Martin Schmidt <mcs2@pitt.edu>
Subject: Re: =~ operator
Message-Id: <3A379187.65D42F3@pitt.edu>
THANKS for all your responses.
Martin
------------------------------
Date: Wed, 13 Dec 2000 16:07:33 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: =~ operator
Message-Id: <3a379ec4.200c$51@news.op.net>
In article <slrn93ddhc.11j.tadmc@maxim.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>>> > What is the =~ operator called?
>
>>it is the pattern match operator.
>
>
>No it isn't.
I've often called it the match operator, and I think a lot of other
people do also.
perltrap.pod:
The match operator is =~, not ~.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 17:23:30 GMT
From: fudokai@my-deja.com
Subject: ActivePerl from Server
Message-Id: <918ba8$sh6$1@nnrp1.deja.com>
I'm new to ActivePerl and I'm somewhat confused over the installation under
windows (95/98). I want to put the Perl interpretter on a server (in this
case Novell) and run it from workstations. I've installed it on a Novell
server from my PC Ok but how do I handle getting the other PCs to work with
the network installation - there's a bundle of registry settings configured
for Perl on my PC - how do I get this lot on another workstation? I suppose I
could put Perl on each PC but a 30Mb installation for most users who will
only want to run a single Perl script on the odd occasion seems a bit much.
I've tried the old RTFM, but either I'm going blind in my old age or there's
no info in this.
TIA - Alan
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 16:36:24 GMT
From: mike_solomon@lineone.net
Subject: ActivePerl v Indigo Star
Message-Id: <9188i8$prk$1@nnrp1.deja.com>
Can anyone tell me if there are any differences between Perl from
ActivePerl and the version from indigo star
I know that the Indigo star version comes with a web server but is that
the only difference
Regards
Mike Solomon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 16:10:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Better way to remove lines from output?
Message-Id: <gq7f3tseiop8snfa3cgh67v8s8u359fhhj@4ax.com>
Odd_Carnivals@yahoo.com wrote:
>Your code chomps the last line of the file rather than
>the next-to-last (which is what my code does). Any
>thoughts on the best way to chomp the next-to-last?
Always chomp, and prepend "\n" to every line before printing it out,
except for the very first and the last line.
--
Bart.
------------------------------
Date: Wed, 13 Dec 2000 09:12:02 -0800
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: changing file permissions with a perl command (not from unix promt!)
Message-Id: <3a37ade5$1@news.microsoft.com>
"Bostjan Kocan" <webmajster@fiver.si> wrote in message
news:izKW5.42165$GU1.5733@news.siol.net...
> Hi!
>
> Nobody seems to understand my question regarding setting file
> permissions....
>
> I KNOW how to set a permission from a unix command promt.... It's a simple
> chmod <permission> <path_to_file> command.... okay now what I need is how
to
> trigger this command from inside a .cgi script....
[..]
> I need a perl command which will change that permissions...
Well, you may not believe it, but there is a Perl function "chmod" which
does exactly the same thing.
> Does anyone have any idea how it looks?
See perldoc -f chmod
> Please don't give me 'perldoc -f chmod' because I don't have the telnet
> access to server and cannot execute that command but you can send me a
copy
> of what that 'perldoc -f chmod' command returns after it's executed.
What does perldoc have to do with access to a server?
Perldoc is the ultimate resource for information about Perl. If you don't
have it then you don't have Perl.
Or do you really expect people in this NG to read the documentation to you?
jue
------------------------------
Date: Wed, 13 Dec 2000 16:41:26 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: default method
Message-Id: <3a37a6b6.2110$16d@news.op.net>
In article <m3g0jykhah.fsf@mumonkan.sunstarsys.com>,
Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>Steve Canfield <canfieldsteve@hotmail.com> writes:
>> What would be really useful and cool would be if when the object is
>> referenced without any -> it would automatically know to return the
>> output of some subroutine instead of itself. Is such a thing possible?
>>
>
>Why not bless a coderef instead of a hashref?
>
Unless I misunderstand you, that will not solve Steve's problem.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 16:43:50 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: default method
Message-Id: <3a37a73f.211b$2c9@news.op.net>
Keywords: caliphate, connote, protozoan, uptrend
In article <fS7Y5.61$B9.173315584@news.frii.net>,
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>you could define print in your package.
You can't.
Operator overloading is the only reasonable way I can think of to
solve the problem.
I can think of another way, but last time I mentioned it (at Boston.pm
this summer) everyone made fun of me and then they took away my beer.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 13 Dec 2000 11:57:30 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: default method
Message-Id: <m366kow96t.fsf@mumonkan.sunstarsys.com>
mjd@plover.com (Mark-Jason Dominus) writes:
> In article <m3g0jykhah.fsf@mumonkan.sunstarsys.com>,
> Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> >Steve Canfield <canfieldsteve@hotmail.com> writes:
> >> What would be really useful and cool would be if when the object is
> >> referenced without any -> it would automatically know to return the
> >> output of some subroutine instead of itself. Is such a thing possible?
> >>
> >
> >Why not bless a coderef instead of a hashref?
> >
>
> Unless I misunderstand you, that will not solve Steve's problem.
You understood right- just thought he might want to consider doing
that instead.
--
Joe Schaefer
------------------------------
Date: Wed, 13 Dec 2000 12:15:46 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: default method
Message-Id: <Pine.GSO.4.21.0012131215300.19179-100000@crusoe.crusoe.net>
On Dec 13, Mark-Jason Dominus said:
>Operator overloading is the only reasonable way I can think of to
>solve the problem.
>
>I can think of another way, but last time I mentioned it (at Boston.pm
>this summer) everyone made fun of me and then they took away my beer.
I don't want your beer. I want to hear your idea.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 13 Dec 2000 12:36:47 -0600
From: "Enrico Ng" <ng@fnmail.com>
Subject: Re: easy question
Message-Id: <918fk0$3mr$1@info1.fnal.gov>
yes I figured "calling" a perl script from within a perl script would be
very common.
I'm just not sure the name of the command so its hard to search for.
thats why I made the subject easy question
--
Enrico Ng <ng@fnmail.com>
"SimBean" <schneider@xtewa.de> wrote in message
news:917hft$7h8$1@nnrp1.deja.com...
>
> > MY QUESTION IS:
> > is there an easy way I can do this?
> probably
>
> > can I "call" a perl script from within a perl script?
> yes - just search this forum for it. There have been a lot of postings
> about that recently ...
>
> > then have my load.pl script that loads a page and adds that in.
> What I would do is create a html-document and use special tags wherever
> you want to have data replaced.
>
> e.g.
> <FONT SIZE=-1 FACE="Arial"><!TITLE!></FONT>
>
> So you would read the document and replace every occurence of <!TITLE!>
> with the actual title.
>
> I hope I didn't miss the point :)
>
>
> Ciao,
> SimBean.
>
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 11:12:57 -0500
From: "Nicholas C. Cheung" <ncheung@draper.com>
Subject: Eliminating unneeded whitespace...
Message-Id: <3A37A009.1E1D5404@draper.com>
I am trying to write some small program segment which converts the
following:
a) " This is very good." to "This is very good."
b) "This is very good" to "This is very good"
c) "This is very good " to "This is very good"
d) " This is very good " to "This is very good"
e) " This is very good " to "This is very good"
(OK, you get the idea by now.)
How should I write this program segment such that it complies with all
five situations outlined above?
Thanks very much,
Nick
------------------------------
Date: 13 Dec 2000 16:46:26 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <slrn93f9v2.9uu.abigail@tsathoggua.rlyeh.net>
On Wed, 13 Dec 2000 11:12:57 -0500, Nicholas C. Cheung (ncheung@draper.com) wrote in comp.lang.perl.misc <URL: news:<3A37A009.1E1D5404@draper.com>>:
++ I am trying to write some small program segment which converts the
++ following:
++
++ a) " This is very good." to "This is very good."
++ b) "This is very good" to "This is very good"
++ c) "This is very good " to "This is very good"
++ d) " This is very good " to "This is very good"
++ e) " This is very good " to "This is very good"
++
++ (OK, you get the idea by now.)
++
++ How should I write this program segment such that it complies with all
++ five situations outlined above?
perl -wiple '$_ = "This is very good."' file_to_convert
HTH. HAND.
Abigail
------------------------------
Date: Wed, 13 Dec 2000 16:52:57 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <slrn93fad9.ah4.rgarciasuarez@rafael.kazibao.net>
Nicholas C. Cheung wrote in comp.lang.perl.misc:
> I am trying to write some small program segment which converts the
> following:
>
> a) " This is very good." to "This is very good."
> b) "This is very good" to "This is very good"
> c) "This is very good " to "This is very good"
> d) " This is very good " to "This is very good"
> e) " This is very good " to "This is very good"
>
> (OK, you get the idea by now.)
You could have described your problem more precisely.
For example :
"I want to remove leading spaces" --> leads to code
s/^\s+//;
"and also trailing spaces" -->
s/\s+$//;
"and to replace all strings of several whitespaces by only one space" -->
s/\s+/ /g;
Once you have described the problem, the solution comes very
quickly. (Unless you don't know the basics of Perl, of course).
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
#!/usr/bin/perl -p
BEGIN { *ARGV=*DATA }
__END__
Just another Perl hacker,
------------------------------
Date: Wed, 13 Dec 2000 16:58:24 GMT
From: SimBean <schneider@xtewa.de>
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <9189rc$r0s$1@nnrp1.deja.com>
> How should I write this program segment such that it complies with all
> five situations outlined above?
You should be searching this forum - there have been lots of postings
about this recently!!
--
Ciao,
SimBean.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Wed, 13 Dec 2000 12:12:15 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <Pine.GSO.4.21.0012131210390.19179-100000@crusoe.crusoe.net>
On Dec 13, Nicholas C. Cheung said:
>a) " This is very good." to "This is very good."
>b) "This is very good" to "This is very good"
>c) "This is very good " to "This is very good"
>d) " This is very good " to "This is very good"
>e) " This is very good " to "This is very good"
>
>(OK, you get the idea by now.)
You should check the FAQ. I found 2/3 of the answer by doing:
perldoc -q space
And the other 1/3 of the answer is one of the following:
$string =~ s/\s+/ /g;
# or
$string =~ tr/\r\n\t\f / /s;
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 13 Dec 2000 12:13:47 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <Pine.GSO.4.21.0012131212290.19179-100000@crusoe.crusoe.net>
On Dec 13, Abigail said:
>On Wed, 13 Dec 2000 11:12:57 -0500, Nicholas C. Cheung (ncheung@draper.com) wrote in comp.lang.perl.misc <URL: news:<3A37A009.1E1D5404@draper.com>>:
>++ I am trying to write some small program segment which converts the
>++ following:
>++
>++ a) " This is very good." to "This is very good."
>++ b) "This is very good" to "This is very good"
>++ c) "This is very good " to "This is very good"
>++ d) " This is very good " to "This is very good"
>++ e) " This is very good " to "This is very good"
>++
>++ How should I write this program segment such that it complies with all
>++ five situations outlined above?
>
>
> perl -wiple '$_ = "This is very good."' file_to_convert
That has two bugs. You meant
perl -wi -ple '$_ = "This is very good."' file_to_convert
And only one of his cases had a . at the end.
And the more posts like this you present ('use Crayons', and its ilk), the
more I think you are/were God****a.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
PerlMonks - An Online Perl Community http://www.perlmonks.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
------------------------------
Date: Wed, 13 Dec 2000 17:13:35 GMT
From: mike_solomon@lineone.net
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <918ano$rut$1@nnrp1.deja.com>
In article <3A37A009.1E1D5404@draper.com>,
"Nicholas C. Cheung" <ncheung@draper.com> wrote:
> I am trying to write some small program segment which converts the
> following:
>
> a) " This is very good." to "This is very good."
> b) "This is very good" to "This is very good"
> c) "This is very good " to "This is very good"
> d) " This is very good " to "This is very good"
> e) " This is very good " to "This is very good"
>
> (OK, you get the idea by now.)
>
> How should I write this program segment such that it complies with all
> five situations outlined above?
>
> Thanks very much,
>
> Nick
>
There is probably a better way of doing it but this should work:
$a = " this is very good ";
#convert more than one space to one space
$a =~ s/\s\s*/ /g;
#strip leading and trailing space
$a =~ s/^\s*|\s*$//g;
i hope this helps
Regards
Mike Solomon
print "${a}\n";
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 13 Dec 2000 09:49:29 -0800
From: mefergus@Stanford.EDU (Mark Ferguson)
Subject: Re: Eliminating unneeded whitespace...
Message-Id: <918cr9$l9d@GSB-Kwanza.Stanford.EDU>
Nicholas C. Cheung <ncheung@draper.com> writes:
>I am trying to write some small program segment which converts the
>following:
[examples of squishing whitespace snipped]
Well, it is a FAQ, but there is another approach
(likely slower, but it's kind of cool, too).
If the string is in $_:
$_ = join ' ', split;
If the string is in $x:
$x = join ' ', split ' ', $x;
Split on ' ' (or with no arguments when splitting
$_) will "throw away" leading/trailing whitespace.
See:
perldoc -f split
perldoc -f join
--
Mark Ferguson <Mark.Ferguson@Stanford.EDU>
------------------------------
Date: Wed, 13 Dec 2000 14:40:58 GMT
From: "leslie" <leslies@santaland.com>
Subject: exec command.. and htpasswd
Message-Id: <_TLZ5.6457$55.2113055@news1.rdc1.ne.home.com>
I am trying to to edit a password file with the command htpasswd.. in my CGI
script i have this command
exec "htpasswd -b .pass $ENV{'REMOTE_USER'} $FORM{'password'}";
so that the person can change their password. However.. when the script runs
to change the pw.. it changes the pw.. but it gives s internal server error.
I'm not sure what else needs to be with this command or what. But I need
help :) SO does anyone have any ideas?
Leslie
------------------------------
Date: 13 Dec 2000 15:18:18 GMT
From: abigail@foad.org (Abigail)
Subject: Re: exec command.. and htpasswd
Message-Id: <slrn93f4pq.9uu.abigail@tsathoggua.rlyeh.net>
On Wed, 13 Dec 2000 14:40:58 GMT, leslie (leslies@santaland.com) wrote in comp.lang.perl.misc <URL: news:<_TLZ5.6457$55.2113055@news1.rdc1.ne.home.com>>:
++ I am trying to to edit a password file with the command htpasswd.. in my CGI
++ script i have this command
++
++ exec "htpasswd -b .pass $ENV{'REMOTE_USER'} $FORM{'password'}";
++
++ so that the person can change their password. However.. when the script runs
++ to change the pw.. it changes the pw.. but it gives s internal server error.
++ I'm not sure what else needs to be with this command or what. But I need
++ help :) SO does anyone have any ideas?
Read what the manual page has to say about exec.
If it's still unclear, consult Stevens "Advanced Programming in the
UNIX environment".
Abigail
------------------------------
Date: Wed, 13 Dec 2000 15:33:26 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: exec command.. and htpasswd
Message-Id: <slrn93f5o5.9s7.rgarciasuarez@rafael.kazibao.net>
leslie wrote in comp.lang.perl.misc:
> I am trying to to edit a password file with the command htpasswd.. in my CGI
> script i have this command
>
> exec "htpasswd -b .pass $ENV{'REMOTE_USER'} $FORM{'password'}";
>
> so that the person can change their password. However.. when the script runs
> to change the pw.. it changes the pw.. but it gives s internal server error.
> I'm not sure what else needs to be with this command or what. But I need
> help :) SO does anyone have any ideas?
What does the error_log of your webserver say?
Does it say something like "premature end of script headers"? Yes? In
this case, you forgot to issue the appropriate HTTP headers (e.g.
'Content-Type') at the beginning of your script.
Or perhaps do you think that you issued the headers appropriately, but
you did this in your code *after* the exec()? See the documentation for
exec() to know where the mistake is.
Note : the $FORM{'password'} in your code is not secure. Have you
untainted it? Does your script even run with the -T switch? What will
happen if someone wants '|rm .pass' for password?
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 13 Dec 2000 09:39:16 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: exec command.. and htpasswd
Message-Id: <87snnstjob.fsf@limey.hpcc.uh.edu>
"leslie" <leslies@santaland.com> writes:
> I am trying to to edit a password file with the command htpasswd.. in my CGI
> script i have this command
>
> exec "htpasswd -b .pass $ENV{'REMOTE_USER'} $FORM{'password'}";
>
> so that the person can change their password. However.. when the script runs
> to change the pw.. it changes the pw.. but it gives s internal server error.
> I'm not sure what else needs to be with this command or what. But I need
> help :) SO does anyone have any ideas?
>
"exec" *replaces* the current process, so it disappears after the exec
succeeds. You don't show any context of what else is happening but
you must of course output the correct headers for CGI.
Also, you might want to look at the HTTPD::UserAdmin package which
provides a native perl interface to management of web-server access
files, rather than the awkward and non-portable use of shell commands.
You can find it at CPAN.
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Wed, 13 Dec 2000 16:29:16 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Faster than LWP
Message-Id: <3a37a3db.209b$25@news.op.net>
In article <28424-3A36E39B-22@storefull-247.iap.bryant.webtv.net>,
BUCK NAKED1 <dennis100@webtv.net> wrote:
>I'm trying to get either David or Eli's suggestions to work, but still
>haven't been successful with either one.
It is possible that the real problem is that the server is taking a
long time to respond, and that no change you make to your client can
help? Are you really sure that the problem is with LWP?
>I wish I knew some plain ole perl codes that would accomplish the
>grabbing of a URL. I'm so tired of installing module after module to try
>and accomplish a simple task...
Maybe that indicates that the task is not as simple as you think it is.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f|ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 13 Dec 2000 16:50:39 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Faster than LWP
Message-Id: <3a37a450.537807185@news.itn.is>
On Tue, 12 Dec 2000 20:48:59 -0600 (CST),
dennis100@webtv.net (BUCK NAKED1) wrote:
>I downloadeded HTTP::GHTTP. Then I downloaded Gnome libghttp which was
>975 KB, unzipped. I noticed that it needed compilation which I'm unable
>to do on my unix Apache webserver. Sounds good though, but I also need
>to be able to grab ftp files, in addition to HTTP, and store them.
>
>I'm trying to get either David or Eli's suggestions to work, but still
>haven't been successful with either one.
>
>I wish I knew some plain ole perl codes that would accomplish the
>grabbing of a URL. I'm so tired of installing module after module to try
>and accomplish a simple task... <sigh> In my opinion, grabbing a URL is
>basic, and should be an easy code that's in the regular distribution of
>Perl. IOW, it should be as easy to grab a URL as it is a filehandle.
Using LWP is easy and lightning fast. Your problem almost
certainly has nothing whatsover to do with LWP nor even with
Perl for that matter. Offhand, without having seen your
code nor having an idea of what you are trying to upload
that takes so long, my guess is that you haven't specified
your proxy server. That is the cause of 99% of failures
when using LWP.
This code, slightly modified from the Perl Cookbook works
for me every day and is lightning fast for either ftp or
http, substitute your own proxy server and port number.:
Regards,
Helgi Briem
#!/usr/bin/perl -w
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
use URI::Heuristic;
my $raw_url = shift or die "usage: $0 url\n";
my $url = URI::Heuristic::uf_urlstr($raw_url);
$| = 1;
printf "%s =>\n\t", $url;
my $ua = LWP::UserAgent->new();
$ua->proxy(['http', 'ftp'] =>
'http://MYPROXY.DOMAIN.COM:80');
my $req = HTTP::Request->new(GET => $url);
my $response = $ua->request($req);
if ($response->is_error()) {
printf " %s\n", $response->status_line;
} else {
my $count;
my $bytes;
my $content = $response->content();
$bytes = length $content;
$count = ($content =~ tr/\n/\n/);
printf "%s (%d lines, %d bytes)\n", $response->content;
}
------------------------------
Date: 13 Dec 2000 17:20:12 GMT
From: cljlk@hotmail.com (J. K.)
Subject: FTP
Message-Id: <918b4c$1rq@news.or.intel.com>
Hi,
I use FTP.pm, I don't see FTP.pm support lcd command.
I can use $ftp->cwd() to change remote site directory.
How do I change local site directory?
Please help.
Thanks
------------------------------
Date: Wed, 13 Dec 2000 10:32:23 -0600
From: Bryan Krone <cbk047@email.mot.com>
Subject: Re: How do I find out my own IP Address?
Message-Id: <3A37A497.404A9116@email.mot.com>
James Kufrovich wrote:
> On Fri, 08 Dec 2000 23:51:43 +0100, Christoph <cvh@gmx.de> wrote:
> >Hello,
> >
> >could anybody tell me how to find out the IP-address that my
> >internet-provider gives me at dial-up?
> >I allready searched CPAN but I couldn't find anything that looks like a
> >solution.
>
> IPADDR=`/sbin/ifconfig ppp0 | grep inet | perl -ane '$temp = $F[1]; $ip =
> substr($temp,5,100); print $ip, "\n";'`
>
> I have that in a bash script, and it works fine. I suppose it can
> be done similarly in Perl. Hope this helps (tm).
>
> Jamie Kufrovich
>
> --
> Egg, eggie@REMOVE_TO_REPLYsunlink.net
> FMSp3a/MS3a A- C D H+ M+ P+++ R+ T W Z+
> Sp++/p# RLCT a+ cl++ d? e++ f h* i+ j p+ sm+
use Socket;
use POSIX qw( uname );
my $name;
my $aliases;
my $addrtype;
my $length;
my $address;
my $a;
my $b;
my $c;
my $d;
my $kernel;
my $hostname;
my $release;
my $version;
my $hardware;
my $domainname;
( $kernel, $hostname, $release, $version, $hardware ) = uname();
$domainname = `domainname`;
( $name, $aliases, $addrtype, $length, $address ) = gethostbyname( $hostname
) or die "Couldn't resolve $hostname : $!";
$hostname = gethostbyaddr( $address, AF_INET ) or die "Couldn't re-resolve
$hostname : $!";
print "Kernel: $kernel\n";
print "Release: $release\n";
print "Version: $version\n";
print "Hardware: $hardware\n";
print "Aliases: $aliases\n";
print "Address Type: $addrtype\n";
print "Length: $length\n";
( $a, $b, $c, $d ) = unpack( 'C4', $address );
print "Host Name: $hostname, Address: $a.$b.$c.$d\n";
print "Domain Name: $domainname\n";
------------------------------
Date: Wed, 13 Dec 2000 17:35:51 GMT
From: "John Hardy" <jhardy@cins.com>
Subject: HTML Output
Message-Id: <XrOZ5.112118$3u1.30343410@news3.rdc1.on.home.com>
I have been away from PERL for a while and I am revising a script I wrote a
couple of years ago for UNIX to work on NT. The script works fine on UNIX
but the HTML output does not work properly on NT. I know it is probably
something minor but for the life of me I can't see the problem.
Here is the part of the script I am having a problem with :
#!/usr/bin/perl -w
# quoteSYS.pl/cgi
# Author: John Hardy
# Copyright 1997 CINS
# Last modified: 04/21/97
$database = "inetpub/wwwroot/cgi-bin/QuoteDatabase/Data_files/crise.data";
print "Content-type: text/html\n\n";
print<<ENDHTML;
<HTML>
<HEAD>
<TITLE>test
</TITLE>
</HEAD>
<BODY BACKGROUND="softgrid.gif">
<FORM METHOD='POST'
ACTION='http://192.168.0.10/cgi-bin/QuoteDatabase/parseform.cgi'>
<center><table border=1 width=70%>
<b><h3>Automatic Quote System</h3><br>Your Company name goes here</br><hr>
<i><<---- Choose from below to build your system ---->></i>
<P>
<b><font size=-1> Choose your system components from the list below and
click on - Submit - to get your System Quote.
<hr><P>
ENDHTML
open (DBFILE,$database) ||die "can't $!";
while (<DBFILE>) {
($key,$description,$price,$cost,$id)=split (/\t/,$_);
$cost=~s/ \$//;
###format cost to two decimal places while calculating###
$cost=sprintf("%.2f",$cost+$cost*0.2);
$push_data="$description: \$$cost :$price"; #added :'s
push @{$hash{$key}},$push_data;
}
close (DBFILE,$database);
foreach $key (sort keys %hash) {
print"<tr><td align=right>";
print qq(<b>$key :<td align=right> <select name="$key">\n);
foreach (@{$hash{$key}}) {
## we added colons above so we could do this split here ##
($desc,$cost,$price)=split /:/;
print qq(<option value="$_">$desc: $cost \n);
# now value has desc:cost:price, but we only show
# desc: cost in the box
# now everything we need is sent to parseform.pl
} #end inner-loop on array
print "</select></tr></b>\n"; # taking the <br> from here seems to have
solved the problem!
} #end outer-loop on $keys
print "</table></center>";
print "<br><hr><BR><b>Submit Quote Form: <input type=submit value=Submit
Quote>";
print " Reset Quote Form: <input type=reset value=Reset></b>";
print "<p><center><A HREF='http://192.168.0.10'>Take me
Home</a></center><p><hr><center><font size-1> Copyright 1997 CINS
</center>";
print "</form></body></html>";
It prints to screen fine to the ENDHTML then I get nothing. When I run it in
UNIX or from a DOS prompt it runs through fine. When I access it through a
web browser on IIS 4.0 it does as I have stated, prints to ENDHTML and then
nothing, no errors, seems to complete but does not print the balance to
screen.
Any help would be greatly appreciated.
Thanks
John
--
____________________________
John Hardy
jhardy@cins.com
VP Operations
CINS
Tel: 613-834-5694
Fax: 613-834-5694
http://www.cins.com
------------------------------
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 5101
**************************************