[19600] in Perl-Users-Digest
Perl-Users Digest, Issue: 1795 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 23 14:05:34 2001
Date: Sun, 23 Sep 2001 11:05:09 -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: <1001268309-v10-i1795@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 23 Sep 2001 Volume: 10 Number: 1795
Today's topics:
[ASK[ Perl and Windows <hkdennis2k@yahoo.com.hk>
Re: Best way to hide the perl source code.. <bart.lateur@skynet.be>
Re: Best way to hide the perl source code.. <rmcconne.NOSPAM@lightlink.com>
Re: CGI module <a.mcgregor@bath.ac.uk>
Re: CGI module <nobody@nowhere.com>
CMD $var <nick.blake@qr.com.au>
Re: CMD $var <jurgenex@hotmail.com>
Re: Concatenating Strings <christopher_j@keepurspamtoyerself.qwest.net>
Re: extra newline in s command (laura fairhead)
Re: extra newline in s command (laura fairhead)
Re: extra newline in s command <bart.lateur@skynet.be>
Re: extra newline in s command <bwalton@rochester.rr.com>
Re: garbage collextion - anonymous structures : self an <bwalton@rochester.rr.com>
garbage collextion - anonymous structures : self and cr <pilsl_@goldfisch.at>
Getting "Subject" in (Net::POP3) <webmaster@kwakeb.net>
Help with reading web page from socket. <bcarlso4@bellsouth.net>
Re: Help with reading web page from socket. (laura fairhead)
Re: Help with reading web page from socket. <bcaligari@fireforged.com>
Re: Help with reading web page from socket. <bcarlso4@bellsouth.net>
Re: Help with reading web page from socket. (Alan Barclay)
Re: How to Call a Potentially Unending Command (Garry Williams)
Me VS. Parsing (Michael Lugassy)
Re: newbie question make from 2 variable fields one wit <bart.lateur@skynet.be>
Perl or not? <tom@zerofiveone.nosp@m.com>
Re: Perl or not? (Randal L. Schwartz)
Script to copy websites <bigbart5@hotmail.com>
Re: Script to copy websites (laura fairhead)
Re: Script to copy websites (Martien Verbruggen)
Re: Script to copy websites (Randal L. Schwartz)
Setting cookies <mdudley@execonn.com>
Re: win32 stat in directory with 4682 files <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 23 Sep 2001 23:28:53 +0800
From: "¤ßÂÅ Dennis" <hkdennis2k@yahoo.com.hk>
Subject: [ASK[ Perl and Windows
Message-Id: <9ol1np$4ej20@rain.i-cable.com>
How can a PERL script only show at tray-icon without text-console?????
------------------------------
Date: Sun, 23 Sep 2001 13:35:20 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Best way to hide the perl source code..
Message-Id: <j2prqt0j4854ku560o8ebf4ikaafsh0c34@4ax.com>
Jayakumar Mundunuri wrote:
>Can you suggest me what is the best way to hide perl source code?
Look into perl2exe, <http://www.indigostar.com/perl2exe.htm>. Although
it turns scripts into executables, it is NOT a compiler. However, if you
look at the contents of such a file with a hex file viewer, you still
won't recognise any of the source. It'll do for most purposes.
--
Bart.
------------------------------
Date: Sun, 23 Sep 2001 14:19:30 GMT
From: Robert McConnell <rmcconne.NOSPAM@lightlink.com>
Subject: Re: Best way to hide the perl source code..
Message-Id: <otqrqt8tv1npk7su59hves866797oa6vgr@4ax.com>
On Fri, 21 Sep 2001 22:39:04 -0700, "Jürgen Exner"
<jurgenex@hotmail.com> wrote:
>"Jayakumar Mundunuri" <jkumar@atrenta.com> wrote in message
>news:3BABE40D.82225D00@atrenta.com...
>> Can you suggest me what is the best way to hide perl source code?
>
>A couple of years ago I read about the WOM in a German computer magazine.
>Privacy advocates were thrilled by it, because it's absolutely secure.
>Maybe that's an option for you, too.
>I think it was in issue #4 of that year, although I don't recall which year.
>
>jue
>
>PS: Oh, before I forget: WOM is the acronym for _W_rite-_O_nly-_M_emory.
>
I remember some of those chips. The first WOM I ever saw was released
by Intel in the late 1970's. It was a variation of their 4096 bit CMOS
ROM die. The full spec sheets, the winning entries from a design
contest and independent test results were printed in an April issue of
"Electronics Design" magazine. I used to have a copy that I clipped at
the time, but I don't know if I could still find it.
It's amazing over the years how much my own memory increasingly acts
like a WOM.
Bob McConnell
N2SPP
------------------------------
Date: Sun, 23 Sep 2001 11:24:04 +0000
From: Andrew McGregor <a.mcgregor@bath.ac.uk>
Subject: Re: CGI module
Message-Id: <3BADC654.551451BC@bath.ac.uk>
Chad Yoshikawa wrote:
>
> I heard the CGI module ( use CGI; ) is come with standard perl
> distribution, I think i should use that, since I don't have permission
> to install extra perl module( e.g. CGI Lite ..etc ) on my perl
> machine.
yes.
> CGI-QuickForm-1.92 ...etc etc
QuicForm is written by a different programmer and relies on CGI.pm being
installed. You can install it to your home dir and use the -I switch:
#!/perl -TwI/path/to/home/dir
It is particularly good at, well, developing forms quickly.
> But I browsed through CPAN categories but can't find a module call CGI
> ( use CGI; ). Where can I find documentation for this module?
http://stein.cshl.org/WWW/software/CGI/
--
Andrew McGregor
------------------------------
Date: Sun, 23 Sep 2001 20:45:10 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: CGI module
Message-Id: <Y0jr7.27773$c5.211180@newsfeeds.bigpond.com>
"Chad Yoshikawa" <m_010@yahoo.com> wrote in message
news:3bad8c74.22181455@enews.newsguy.com...
> when i go to CPAN homepage. I saw lots of CGI modules under
> Category >> World Wide Web HTML HTTP CGI >> CGI
>
> I wonder which module people usually use to do HTTP GET / POST stuff?
> there is alot :
> CGI_Lite
> CGI-Minimal-1.06
> CGI-QuickForm-1.92 ...etc etc
USe GCI_lite for simple stuff.
>
> I heard the CGI module ( use CGI; ) is come with standard perl
> distribution, I think i should use that, since I don't have permission
> to install extra perl module( e.g. CGI Lite ..etc ) on my perl
> machine.
Why? You can install a module in you local directories.
>
> what kind of function does the CGI module has? does it have all the
> functions Java Servlet API includes? like: Cookie, get Real Path,
> SetHeader, get Query String .. etc etc.
There are plenty of books that explan this. Perldoc has lots of info.
http://www.perldoc.com/perl5.6.1/lib/CGI.html
gtoomey
------------------------------
Date: Mon, 24 Sep 2001 00:32:46 +1000
From: "Nick Blake" <nick.blake@qr.com.au>
Subject: CMD $var
Message-Id: <9okrqp$beb1@inetbws1.citec.com.au>
How do I place a variable within a command
ie.
`global $grouname DOMAIN `
What context does the scalar need to be in and can I use this command string
in a loop.
Nick
------------------------------
Date: Sun, 23 Sep 2001 08:24:39 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: CMD $var
Message-Id: <3badfeb8@news.microsoft.com>
"Nick Blake" <nick.blake@qr.com.au> wrote in message
news:9okrqp$beb1@inetbws1.citec.com.au...
> How do I place a variable within a command
> `global $grouname DOMAIN `
>
> What context does the scalar need to be in and can I use this command
string
> in a loop.
Have you tried it?
jue
------------------------------
Date: Sun, 23 Sep 2001 09:28:17 -0700
From: "Christopher M. Jones" <christopher_j@keepurspamtoyerself.qwest.net>
Subject: Re: Concatenating Strings
Message-Id: <Y2or7.26$lI1.263790@news.uswest.net>
"RoJo" <rojo@mindspring.com> wrote:
> I know this is a fundamental question. But how do I concatenate
> multiple strings to create one new string?
>
> For example:
>
> $first = 'I ';
> $second = 'want ';
> $third = 'these ';
> $fourth = 'together.';
>
> I want to create a string with the content:
> 'I want these together.'
There are many ways, here are a few:
1) concatenation
$all = $first . $second . $third . $fourth;
2) string interpolation
$all = "$first$second$third$fourth";
3) array joining
$all = join('', ($first, $second, $third, $fourth));
or,
@all = ('I ', 'want ', 'these ', 'together.');
$all = join('', @all);
4) formatted printing (printf)
$all = sprintf("%s%s%s%s", $first, $second, $third, $fourth);
--
Thundercats, ho!
------------------------------
Date: Sun, 23 Sep 2001 11:43:59 GMT
From: laura_fairhead@my-deja.com (laura fairhead)
Subject: Re: extra newline in s command
Message-Id: <3badc380.152028844@news.cis.dfn.de>
On Sun, 23 Sep 2001 02:33:40 GMT, Bob Walton <bwalton@rochester.rr.com> wrote:
>laura fairhead wrote:
>>
>> On Sat, 22 Sep 2001 13:50:28 -0700, "Jürgen Exner" <jurgenex@hotmail.com> wrote:
>>
>> >"laura fairhead" <laura_fairhead@my-deja.com> wrote in message
>> >news:3bace3a7.94715075@news.cis.dfn.de...
>...
>> yes, I can't use 'chomp' because I'm working in Perl 4.
>...
>> The replace in the s command is interpretted as a regular
>> expression and I need to just do a plain string replace.
>> The /$k[$1]/ must not be interpretted as a regular expression,
>> and it may have special characters in it.
>>
>> I've been reading as much as I can and looked at posts
>> in this group but I can't find anything. Doesn't
>> perl have a plain string replace function or does the
>> r.h.s have to be an perl RE ?
>>
>> I read something here about using \Q to 'quote meta'
>> but it doesn't seem to be working here. Is that another
>> of the things new in Perl 5 ?
>>
>> All I can see at the moment is messing about with
>> string splicing, using index() and then substr() to
>> do it but that lookz awful really.
>...
>The "replacement string" in s/// is exactly what it says: a replacement
>string. The string is interpolated once, but it is *not* a regex.
Oh. I don't understand it then because I had the idea that after
the variable was interpolated it would get interpretted for any
characters that were special in the l.h.s. I'm trying to learn
how this all fits together but it isn't easy, I've done lots
of 'sed' and 'awk' and I read the bit about the things I have
to watch for that are different in the manual... in a sed/ed
s/// command the replacement string has special characters,
are you saying that the variable is replaced but not processed
at all after that? I tested by putting all the awkward characters
I could into the $k[] and it seems that it just replaces the
literal text
>But...I don't know about Perl 4 -- I assume that is true for Perl 4, but
>I have no way of testing that, nor docs etc. But I don't think that
>would have changed between Perl 4 and Perl 5.
>
>Your problem, though, is that the first $1 in your s/// is being
>interpolated into a regex, then it is set to undef (by the regex engine,
>in preparation for the pattern match), then it is set to whatever
>happens in the regex (if there were no parens, nothing happens). Then
If there were no parens do all the $1,$2,etc get 'unset' ? Or do
they stay the same?
>the undef result (or whatever was matched by the first set of parens in
>the pattern if there were any) is being used as the subscript for @k in
>the replacement string, causing the interpolation of the replacement
>string to be 0000. Maybe the following would work for you:
>
>chomp(@k=(qq[x000],<DATA>));
>while(<>){
> /(\d{4})/&& $1<=$#k && ($a=$1,1) && s/$1/$k[$a]/;
> print;
>}
>__DATA__
>pattern1
>pattern2
>pattern3
>
>It looks like that works to me.
Well it seemed to work just fine without the intermediate
step. I don't really understand whats going on though.
I had ended up using $` and $' and set $_ directly with;
/(\d{4})/&& $1<=$#k && ($_=$`.$1.$');
Thanx for your help so far :)
--
: ${L:-aura} # http://lf.8k.com:80
>--
>Bob Walton
------------------------------
Date: Sun, 23 Sep 2001 11:47:58 GMT
From: laura_fairhead@my-deja.com (laura fairhead)
Subject: Re: extra newline in s command
Message-Id: <3badcb9a.154103084@news.cis.dfn.de>
[snip]
>>}
>>__DATA__
>>pattern1
>>pattern2
>>pattern3
>>
>>It looks like that works to me.
>
>Well it seemed to work just fine without the intermediate
>step. I don't really understand whats going on though.
>
>I had ended up using $` and $' and set $_ directly with;
>
>/(\d{4})/&& $1<=$#k && ($_=$`.$1.$');
Sorry, that was a typo;
/(\d{4})/&& $1<=$#k && ($_=$`.$k[$1].$');
--
: ${L:-aura} # http://lf.8k.com:80
------------------------------
Date: Sun, 23 Sep 2001 13:46:13 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: extra newline in s command
Message-Id: <0oprqtsnpiv3tjj3huifm23a21jfuc3bgi@4ax.com>
laura fairhead wrote:
>Can anyone explain to me why I'm getting extra
>newlines inserted with the s/// command in this
>script;
>
>open(FILE,qq[patternfile])
>@k=(qq[0000],<FILE>)
>while(<>){
> /(\d{4})/&& $1<=$#k && s/$1/$k[$1]/
;
> print
> }
>
>
>Every line that has an s/// done on it has
>an extra newline and I don't see why it's
>doing that.
Beause your substitution array items all contain newlines. You just read
them from a file, and you didn't chomp() them.
--
Bart.
------------------------------
Date: Sun, 23 Sep 2001 16:14:07 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: extra newline in s command
Message-Id: <3BAE09E4.36B44E44@rochester.rr.com>
laura fairhead wrote:
>
> On Sun, 23 Sep 2001 02:33:40 GMT, Bob Walton <bwalton@rochester.rr.com> wrote:
>
> >laura fairhead wrote:
> >>
> >> On Sat, 22 Sep 2001 13:50:28 -0700, "Jürgen Exner" <jurgenex@hotmail.com> wrote:
> >>
> >> >"laura fairhead" <laura_fairhead@my-deja.com> wrote in message
> >> >news:3bace3a7.94715075@news.cis.dfn.de...
> >...
...
> >The "replacement string" in s/// is exactly what it says: a replacement
> >string. The string is interpolated once, but it is *not* a regex.
>
> Oh. I don't understand it then because I had the idea that after
> the variable was interpolated it would get interpretted for any
> characters that were special in the l.h.s. I'm trying to learn
> how this all fits together but it isn't easy, I've done lots
> of 'sed' and 'awk' and I read the bit about the things I have
> to watch for that are different in the manual... in a sed/ed
> s/// command the replacement string has special characters,
> are you saying that the variable is replaced but not processed
> at all after that? I tested by putting all the awkward characters
> I could into the $k[] and it seems that it just replaces the
> literal text
Well, a quick test would tell:
$a='string';
$a=~s/ri/.^|(){}[]*+\$/; #substitute with lots of metacharacters
print "a=$a\n";
generates:
D:\junk>perl junk86.pl
a=st.^|(){}[]*+$ng
D:\junk>
so no, the metacharacters in the replacement string are just
characters. The replacement string does get interpolated, though, so it
is necessary to escape the $ . It doesn't matter if the replacement
string comes from a variable:
$a='string';
$k='.^|(){}[]*+$';
$a=~s/ri/$k/; #substitute with lots of metacharacters
print "a=$a\n";
gives exactly the same result.
The documentation is your friend. This is all described in great detail
in:
perldoc perlop
and probably some more places.
>
...
> >Your problem, though, is that the first $1 in your s/// is being
> >interpolated into a regex, then it is set to undef (by the regex engine,
> >in preparation for the pattern match), then it is set to whatever
> >happens in the regex (if there were no parens, nothing happens). Then
>
> If there were no parens do all the $1,$2,etc get 'unset' ? Or do
> they stay the same?
Well, a quick test program would let you know definitively:
$a='xxxsomethingxxx';
$a=~/(something)/;
print "\$1=$1\n";
$a=~s/xxx/zzz/; #a substitute that matches but has no parens
print "\$1=$1\n";
print defined($1)?'$1 defined':'$1 is undef';
generates:
D:\junk>perl junk85.pl
$1=something
$1=
$1 is undef
D:\junk>
so yes, if the match happens, $1 is wiped out even if there were no
parens in the regex. If the match is unsuccessful, however, $1 is
preserved:
$a='xxxsomethingxxx';
$a=~/(something)/;
print "\$1=$1\n";
$a=~s/yyy/zzz/; #a substitute that doesn't match and has no parens
print "\$1=$1\n";
print defined($1)?'$1 defined':'$1 is undef';
D:\junk>perl junk85.pl
$1=something
$1=something
$1 defined
D:\junk>
>
...
>
> Well it seemed to work just fine without the intermediate
> step. I don't really understand whats going on though.
There is a possibility that "working" means two different things for you
and me -- your goal is not 100% clear. And it well could be that Perl 4
did things slightly differently when it comes to the nitty-gritty
details. Things like relying on Perl's internal variables that get
changed during a pattern match to not change in some circumstances are
not recommended.
...
> : ${L:-aura} # http://lf.8k.com:80
...
--
Bob Walton
------------------------------
Date: Sun, 23 Sep 2001 16:48:31 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: garbage collextion - anonymous structures : self and cross-references
Message-Id: <3BAE11F3.E7A2E8E@rochester.rr.com>
peter pilsl wrote:
>
> I build up a big anonymous structure with elements like (just to give you
> the point)
>
> $ptr->{ext}->[1]->{house}='something';
>
> now when I undef $ptr the whole structure should be vanish.
> Unfortunately it does not ..
> What happens if there are some selfreferences like
> $ptr->{ext}->[1]->{house}=$ptr->{plus}->[8];
> or crossreferenes from outside:
> $other_ptr=$ptr->{plus}->[8];
>
Perl's garbage-collection model is very simple: When the reference
count to an entity goes to zero, the entity is garbage-collected. If
the reference count is not zero, it is not garbage-collected.
Therefore, collections of entities containing circular references are
not garbage-collected. If you want them to be garbage-collected, you
must break the circular reference structure. It is done this way for
efficiency: the only overhead needed is a test whenever a reference
counter is decremented: is it now zero? See perldoc perlguts, in
particular the section "reference counts and mortality".
> I guess in that case parts of the structure will not be deleted. In case of
> selfreference this parts would stay in mem forever ?
Well, until the process exits or something breaks the circular reference
loop.
...
> peter
...
--
Bob Walton
------------------------------
Date: Sun, 23 Sep 2001 13:11:33 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: garbage collextion - anonymous structures : self and cross-references
Message-Id: <3badc367@e-post.inode.at>
I build up a big anonymous structure with elements like (just to give you
the point)
$ptr->{ext}->[1]->{house}='something';
now when I undef $ptr the whole structure should be vanish.
Unfortunately it does not ..
What happens if there are some selfreferences like
$ptr->{ext}->[1]->{house}=$ptr->{plus}->[8];
or crossreferenes from outside:
$other_ptr=$ptr->{plus}->[8];
I guess in that case parts of the structure will not be deleted. In case of
selfreference this parts would stay in mem forever ?
thnx,
peter
--
peter pilsl
pilsl_@goldfisch.at
http://www.goldfisch.at
------------------------------
Date: Sun, 23 Sep 2001 20:29:30 +0300
From: "eDeveloper" <webmaster@kwakeb.net>
Subject: Getting "Subject" in (Net::POP3)
Message-Id: <9ol6f1$kq2$1@ns1.isu.net.sa>
Hi
I coded a script that get email messages in a pop server
but the problem is : some messages has a strange subject
for example : ?windows-1256?B?0d3WIMfh4+TKz+wgytPM7eHt?=
Regards,
eDeveloper
------------------------------
Date: Sun, 23 Sep 2001 07:08:04 -0400
From: Brian Carlson <bcarlso4@bellsouth.net>
Subject: Help with reading web page from socket.
Message-Id: <3BADC294.3B3905B5@bellsouth.net>
I am trying to read a web page from a socket, and I'm getting a 400 (bad
request), Parameter Incorrect. What am I doing wrong? I'm trying to
read the baseball scoreboard from espn.
Here's what im doing....
$socket =
IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>"msn.espn.go.com",PeerPor
t=>"80") or die "Can't open socket";
print $socket "GET /mlb/scoreboard HTTP:/1.0\n\n";
while ($raw_line = <$socket>)
{
print "$raw_line\n";
}
------------------------------
Date: Sun, 23 Sep 2001 12:03:20 GMT
From: laura_fairhead@my-deja.com (laura fairhead)
Subject: Re: Help with reading web page from socket.
Message-Id: <3badce7b.154840412@news.cis.dfn.de>
On Sun, 23 Sep 2001 07:08:04 -0400, Brian Carlson <bcarlso4@bellsouth.net> wrote:
>I am trying to read a web page from a socket, and I'm getting a 400 (bad
>request), Parameter Incorrect. What am I doing wrong? I'm trying to
>read the baseball scoreboard from espn.
>
>Here's what im doing....
>
>
>$socket =
>IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>"msn.espn.go.com",PeerPor
>t=>"80") or die "Can't open socket";
>
>
>print $socket "GET /mlb/scoreboard HTTP:/1.0\n\n";
I'm a newbie to 'perl', so don't take my word for it
_but_ have you tried that request by telnetting into
the host?
telnet msn.espn.go.com 80
make sure local echo is on and try it because I think
you need to lose that ':';
GET /mlb/scoreboard HTTP/1.0
# ^no colon
if you are using a DOS/Windoze client \n is probably fine
but on UNIX (I think) it should be \r \n. Also some servers
require a second header line like; 'Host: myhostname'
byefornow
--
: ${L:-aura} # http://lf.8k.com:80
>
> while ($raw_line = <$socket>)
> {
> print "$raw_line\n";
> }
>
>
>
>
>
>
------------------------------
Date: Sun, 23 Sep 2001 13:15:06 -0000
From: "B. Caligari" <bcaligari@fireforged.com>
Subject: Re: Help with reading web page from socket.
Message-Id: <9okmph02r0i@enews1.newsguy.com>
"Brian Carlson" <bcarlso4@bellsouth.net> wrote in message
news:3BADC294.3B3905B5@bellsouth.net...
> I am trying to read a web page from a socket, and I'm getting a 400 (bad
> request), Parameter Incorrect. What am I doing wrong? I'm trying to
> read the baseball scoreboard from espn.
>
> Here's what im doing....
>
>
> $socket =
> IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>"msn.espn.go.com",PeerPor
> t=>"80") or die "Can't open socket";
>
LWP makes life really simple:
use LWP::Simple;
my $html = get("http://www.bloomberg.com/markets/wei.html");
B,
------------------------------
Date: Sun, 23 Sep 2001 11:09:04 -0400
From: Brian Carlson <bcarlso4@bellsouth.net>
Subject: Re: Help with reading web page from socket.
Message-Id: <3BADFB10.1011D7D9@bellsouth.net>
Thanks,
That was it. Just another example the flavors of web standards. This worked just
fine on a couple other servers, but not on espn.
THANKS,
Brian
laura fairhead wrote:
> On Sun, 23 Sep 2001 07:08:04 -0400, Brian Carlson <bcarlso4@bellsouth.net> wrote:
>
> >I am trying to read a web page from a socket, and I'm getting a 400 (bad
> >request), Parameter Incorrect. What am I doing wrong? I'm trying to
> >read the baseball scoreboard from espn.
> >
> >Here's what im doing....
> >
> >
> >$socket =
> >IO::Socket::INET->new(Proto=>"tcp",PeerAddr=>"msn.espn.go.com",PeerPor
> >t=>"80") or die "Can't open socket";
> >
> >
> >print $socket "GET /mlb/scoreboard HTTP:/1.0\n\n";
>
> I'm a newbie to 'perl', so don't take my word for it
> _but_ have you tried that request by telnetting into
> the host?
>
> telnet msn.espn.go.com 80
>
> make sure local echo is on and try it because I think
> you need to lose that ':';
>
> GET /mlb/scoreboard HTTP/1.0
>
> # ^no colon
>
> if you are using a DOS/Windoze client \n is probably fine
> but on UNIX (I think) it should be \r \n. Also some servers
> require a second header line like; 'Host: myhostname'
>
> byefornow
>
> --
> : ${L:-aura} # http://lf.8k.com:80
>
> >
> > while ($raw_line = <$socket>)
> > {
> > print "$raw_line\n";
> > }
> >
> >
> >
> >
> >
> >
------------------------------
Date: 23 Sep 2001 16:34:00 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: Help with reading web page from socket.
Message-Id: <1001262876.786025@elaine.furryape.com>
In article <3BADFB10.1011D7D9@bellsouth.net>,
Brian Carlson <bcarlso4@bellsouth.net> wrote:
>Thanks,
>
>That was it. Just another example the flavors of web standards. This
>worked just
>fine on a couple other servers, but not on espn.
No, just an example of what happens when you violate the standards.
------------------------------
Date: Sun, 23 Sep 2001 14:24:55 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: How to Call a Potentially Unending Command
Message-Id: <slrn9qrs5m.8lh.garry@zfw.zvolve.net>
On 21 Sep 2001 12:02:28 -0700, Rick Kasten <rckjr@yahoo.com> wrote:
> I have to write a script where I make a call to a database utility.
> If the utility runs through to the SQL> prompt, everything is ok and
> I can exit. If the utility does not display the SQL> prompt within
> a given amount of time (~60 sec), the database is considered hung,
> and then I have to continue the script which kills and restarts the
> database. My question is how do I do this? If I do
>
> open(DB,"dbutil |");
> while (<DB>) {
> if (/^SQL/) {
> whatever;
> }
> }
[ UNTESTED ]
$SIG{ALRM} = sub { die "timeout occurred" };
my $pid = open(DB,"dbutil |");
eval {
alarm(60);
while (<DB>) {
alarm(0);
if (/^SQL/) {
whatever;
}
}
};
if ($@) {
warn "dbutil is hung: $@\n";
kill "TERM", $pid;
...
}
--
Garry Williams
------------------------------
Date: 23 Sep 2001 05:59:10 -0700
From: cfusion@imvamp.com (Michael Lugassy)
Subject: Me VS. Parsing
Message-Id: <342805fe.0109230459.54ff1605@posting.google.com>
Have anyone succesfuly managed to run a perl script that will parse
the DMOZ dump data (over 800mb of RDF/XML formatted content)?
Eventually, I will need the content in MSSQL relational database.
The content in MY sql database, not a mockup of using the dmoz.org pages.
Any help?
Michael.
------------------------------
Date: Sun, 23 Sep 2001 14:49:56 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: newbie question make from 2 variable fields one with a _
Message-Id: <djtrqtsag6jkj3haacc6mh9kfgnb2rv8er@4ax.com>
Walter Soestbergen wrote:
>What I tryed was the following but it is not working :(
>
>$complete_name = $INPUT{'first_name'}_$INPUT{'last_name'};
>
>what am I doing wrong?
You forgot the quotes around the thing on the right.
$complete_name = "$INPUT{'first_name'}_$INPUT{'last_name'}";
--
Bart.
------------------------------
Date: Sun, 23 Sep 2001 15:07:42 +0100
From: Tom <tom@zerofiveone.nosp@m.com>
Subject: Perl or not?
Message-Id: <e3rrqt8m9n2m8s6465ncfdql2si5n9ru68@4ax.com>
Perl is good, I love it, but it lacks the speed of compiled programs.
Anyone got a good alternative?
Cheers,
Tom
------------------------------
Date: 23 Sep 2001 09:42:05 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl or not?
Message-Id: <m1u1xtvoyq.fsf@halfdome.holdit.com>
>>>>> "Tom" == Tom <tom@zerofiveone.nosp@m.com> writes:
Tom> Perl is good, I love it, but it lacks the speed of compiled programs.
Perl *is* compiled. See the FAQ. Are you just quoting rumors, or
do you have a specific counterexample?
Tom> Anyone got a good alternative?
More understanding, less FUD?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 23 Sep 2001 13:41:07 +0100
From: "Bart" <bigbart5@hotmail.com>
Subject: Script to copy websites
Message-Id: <1001248959.24932.1.nnrp-14.d4e563b8@news.demon.co.uk>
Hello All,
I was wondering if there is a Perl script out there that would make
a backup copy of a entire website, which would also convert all the
www links into local links for offline browsing.
I've already tried Teleport Pro, but was wondering if there is a script
that would do it better.
Many thanks in advance.
Bart.
------------------------------
Date: Sun, 23 Sep 2001 13:26:03 GMT
From: laura_fairhead@my-deja.com (laura fairhead)
Subject: Re: Script to copy websites
Message-Id: <3bade1e6.159811819@news.cis.dfn.de>
On Sun, 23 Sep 2001 13:41:07 +0100, "Bart" <bigbart5@hotmail.com> wrote:
>Hello All,
>
>I was wondering if there is a Perl script out there that would make
>a backup copy of a entire website, which would also convert all the
>www links into local links for offline browsing.
>
>I've already tried Teleport Pro, but was wondering if there is a script
>that would do it better.
>
What's wrong with 'wget' ? use -r for recursive getting and -k to convert
links to local ones.
FTP SITE: ftp.gnu.org
PATH : /gnu/wget
cu
--
: ${L:-aura} # http://lf.8k.com:80
>Many thanks in advance.
>
>Bart.
>
>
>
>
------------------------------
Date: Sun, 23 Sep 2001 23:26:16 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Script to copy websites
Message-Id: <slrn9qrono.8ai.mgjv@martien.heliotrope.home>
On Sun, 23 Sep 2001 13:41:07 +0100,
Bart <bigbart5@hotmail.com> wrote:
> Hello All,
>
> I was wondering if there is a Perl script out there that would make
> a backup copy of a entire website, which would also convert all the
> www links into local links for offline browsing.
The LWP module set comes with lwp-rget, which does quite a good job at
this sort of thing.
# man lwp-rget
[snip]
This program is useful if you want to make a local copy of
a collection of documents or want to do web reading off-
line.
[snip]
Find a copy of LWP on CPAN (www.cpan.org).
Martien
--
Martien Verbruggen |
Interactive Media Division | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: 23 Sep 2001 08:51:35 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Script to copy websites
Message-Id: <m1hettx5vc.fsf@halfdome.holdit.com>
>>>>> "Bart" == Bart <bigbart5@hotmail.com> writes:
Bart> I was wondering if there is a Perl script out there that would make
Bart> a backup copy of a entire website, which would also convert all the
Bart> www links into local links for offline browsing.
Bart> I've already tried Teleport Pro, but was wondering if there is a script
Bart> that would do it better.
I've got one that works from the file side, but not the web side, at:
<http://www.stonehenge.com/merlyn/WebTechniques/col22.html>
I've thought a few times about writing one that works from the web
side as well, but wget does that so well that it would merely be a
demo piece and not a real useful program. :)
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 23 Sep 2001 12:46:46 -0400
From: Marshall Dudley <mdudley@execonn.com>
Subject: Setting cookies
Message-Id: <3BAE11F6.572D172B@execonn.com>
I am unable to set a cookie using a perl script. This is the script:
print "Set-Cookie: AFFILIATE=$affiliate; ";
print "expires=$expdate; " if ($expires);
print "domain=www.king-cart.com; "; #works if I leave this line
out
print "path=/; \n";
If I leave out the domain line, it will set cookies fine. Mind you I am not
retreiving cookies to see if they are set, I am reviewing them on the local
hard drive, so I am certain that they are not being set when that line is in
there. In fact the date and time on the cookie file does not get updated so I
know Netscape is not even trying to set the cookie.
Why will Netscape NOT set the cookie when I specify a domain I want the
cookie availabe from? The only restriction is the two periods, which the
domain has. I have been using cookies for years, but never seen this problem
before.
http://home.netscape.com/newsref/std/cookie_spec.html says:
domain=DOMAIN_NAME
When searching the cookie list for valid cookies, a comparison of the
domain attributes of the cookie is made with the
Internet domain name of the host from which the URL will be fetched. If
there is a tail match, then the cookie will go
through path matching to see if it should be sent. "Tail matching" means
that domain attribute is matched against the tail
of the fully qualified domain name of the host. A domain attribute of
"acme.com" would match host names
"anvil.acme.com" as well as "shipping.crate.acme.com".
Only hosts within the specified domain can set a cookie for a domain and
domains must have at least two (2) or three (3)
periods in them to prevent domains of the form: ".com", ".edu", and
"va.us". Any domain that fails within one of the seven
special top level domains listed below only require two periods. Any
other domain requires at least three. The seven
special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL",
and "INT".
The default value of domain is the host name of the server which
generated the cookie response.
Any assistance would be appreciated.
Thanks,
Marshall
------------------------------
Date: Sun, 23 Sep 2001 13:25:15 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: win32 stat in directory with 4682 files
Message-Id: <eeorqtgqq8vujlan10iu1u2a53renvb4sq@4ax.com>
vze26dpn wrote:
>What I am doing is a recursive decent with lstat and then running
>md5 checksums on all the files in the tree. That takes a long time
>even when stat or lstat are not pigs.
MD5 requires opening of the files. So why not drop the stat(), simply
try to open the file, and if it succeeds, process the digest, and if it
fails to open, it's likely because it wasn't a file? I get a "permission
denied" error. Well, there are likely far fewer directories than files,
so you can still do a stat() on it then.
--
Bart.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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 V10 Issue 1795
***************************************