[9471] in Perl-Users-Digest
Perl-Users Digest, Issue: 3065 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 5 18:07:31 1998
Date: Sun, 5 Jul 98 15:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 5 Jul 1998 Volume: 8 Number: 3065
Today's topics:
-w on production code (was Re: better way of getting th <dgris@rand.dimensional.com>
Re: better way of getting the last modified file? <dgris@rand.dimensional.com>
Re: better way of getting the last modified file? <rra@stanford.edu>
Re: better way of getting the last modified file? <tchrist@mox.perl.com>
Re: better way of getting the last modified file? (Sitaram Chamarty)
Re: better way of getting the last modified file? <rra@stanford.edu>
Re: Help: perl5.00404 and UnixWare 2.1.2 (locale proble <dlgolden@ibm.net>
Re: Help: perl5.00404 and UnixWare 2.1.2 (locale proble (Sitaram Chamarty)
Re: How to check variables exists in a string (Sitaram Chamarty)
How to obtain HTML from current page where script is ra <inquiries@halbrook.com>
ingnore this thread (double post) Re: package available <dtbaker_@flash.net>
Re: ingnore this thread (double post) Re: package avail (Bbirthisel)
Re: limits of glob() ? and number of sub-dirs in win95 <dtbaker_@flash.net>
Re: MS WIN 95 (OSR2.1) (Only $60) (Sitaram Chamarty)
New ActiveState "Merge" version 5.00469 (Mike Heins)
Re: package for searching local docs? WAS Re: limits o (Sitaram Chamarty)
perl cgi/telnet <emorel@stny.lrun.com>
Re: question about objects (Sitaram Chamarty)
regexp s/// for removing tail end of string <jerry@fitzweb.com>
Re: regexp s/// for removing tail end of string <ryan@secretshopnet.com>
Substitution-bug? <admin@asarian-host.org>
Re: The vagaries of read()ing (John Siracusa)
Re: Why can't I do this? (Sitaram Chamarty)
Windows NT PERL in Netscape Problem <privateer@thevortex.com>
Re: Windows NT PERL in Netscape Problem <"mudboy"@pond[REMOVE].com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 05 Jul 1998 18:34:22 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nogd0$mo2$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <6nofos$lg$1@csnews.cs.colorado.edu>
tchrist@mox.perl.com (Tom Christiansen) wrote:
>Do you believe everything you read? :-(
No, only those things that make sense. Not introducing
unnecessary panic among my users makes sense.
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Sun, 05 Jul 1998 17:24:30 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: better way of getting the last modified file?
Message-Id: <6nocc3$mi5$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <MPG.10093ff12a871673989715@nntp.hpl.hp.com>
lr@hpl.hp.com (Larry Rosler) wrote:
>Dropping '-w' and 'use strict;' from production code is like removing
>one's lifejacket as soon as the ship leaves the harbor and goes out to
>sea.
I have to disagree with this. Using -w in production code does nothing
but alarm your users unnecessarily. This is discussed in Effective
Perl Programming, and since reading that book I no longer ship code
with -w enabled.
>Larry Rosler
dgris
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: 05 Jul 1998 10:35:40 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: better way of getting the last modified file?
Message-Id: <m3k95s2ob7.fsf@windlord.Stanford.EDU>
Daniel Grisinger <dgris@rand.dimensional.com> writes:
> lr@hpl.hp.com (Larry Rosler) wrote:
>> Dropping '-w' and 'use strict;' from production code is like removing
>> one's lifejacket as soon as the ship leaves the harbor and goes out to
>> sea.
> I have to disagree with this. Using -w in production code does nothing
> but alarm your users unnecessarily. This is discussed in Effective Perl
> Programming, and since reading that book I no longer ship code with -w
> enabled.
Yup. You need to actually check your code against new releases of Perl
and against test suites, and that should be done with -w. But once your
code is out of your hands and in the hands of people who can't fix it when
they see warnings, there's no reason for the warnings.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 5 Jul 1998 18:13:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: better way of getting the last modified file?
Message-Id: <6nofos$lg$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Daniel Grisinger <dgris@rand.dimensional.com> writes:
:I have to disagree with this. Using -w in production code does nothing
:but alarm your users unnecessarily. This is discussed in Effective
:Perl Programming, and since reading that book I no longer ship code
:with -w enabled.
Do you believe everything you read? :-(
--tom
--
Just don't compare it with a real language, or you'll be unhappy... :-)
--Larry Wall in <1992May12.190238.5667@netlabs.com>
------------------------------
Date: 5 Jul 98 20:51:03 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: better way of getting the last modified file?
Message-Id: <slrn6pvn8i.iup.sitaram@ltusitaram.diac.com>
On 05 Jul 1998 10:35:40 -0700, Russ Allbery <rra@stanford.edu> wrote:
>Yup. You need to actually check your code against new releases of Perl
>and against test suites, and that should be done with -w. But once your
>code is out of your hands and in the hands of people who can't fix it when
>they see warnings, there's no reason for the warnings.
When I ship code I send the warnings to a log file that the
"customer" (they're actually my co-workers in another office :-)
can look at if they want to, but are not forced to.
Since nothing will ever convince me that I have tested all
possible inputs for any of my programs (except the most trivial),
I know that, if the user sees any bizarre behaviour, I can at
least ask them to mail me the inputs, and the log file...
I wouldn't take out "-w" willingly.
------------------------------
Date: 05 Jul 1998 14:00:26 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: better way of getting the last modified file?
Message-Id: <m3pvfk109h.fsf@windlord.Stanford.EDU>
Sitaram Chamarty <sitaram@diac.com> writes:
> On 05 Jul 1998 10:35:40 -0700, Russ Allbery <rra@stanford.edu> wrote:
>> Yup. You need to actually check your code against new releases of Perl
>> and against test suites, and that should be done with -w. But once
>> your code is out of your hands and in the hands of people who can't fix
>> it when they see warnings, there's no reason for the warnings.
> When I ship code I send the warnings to a log file that the "customer"
> (they're actually my co-workers in another office :-) can look at if
> they want to, but are not forced to.
This is a great idea if your application is one that can create and
maintain a log file. (Most of what I write is intended to be run by
normal users and therefore that doesn't work quite as well.)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 05 Jul 1998 12:59:20 -0500
From: Dennis Golden <dlgolden@ibm.net>
Subject: Re: Help: perl5.00404 and UnixWare 2.1.2 (locale problem)
Message-Id: <359FBEF8.3AA2@ibm.net>
I posted this last week with no response. I am trying to find out why a
perl script works fine from the command line but fails with locale error
if run as a daemon.
TIA
Dennis
Dennis Golden wrote:
>
> I posted the following to comp.unix.unixware.misc, and as yet have not
> received any responses. I thought possibly someone on this group might
> have some idea where I might look.
>
> I am having problems with subject environment. I have an lp filter
> written in perl, and since going to 5.00404, it no longer works. I
> have stripped it down to a bare minimum (just write to stderr), and
> it works fine from the command line but failes from the spooler. All
> I have now in the script is commands to dump the environment and issue
> the locale command.
>
> Any hints will be greatly appriciated.
>
> Regards,
>
> Dennis
>
> ---------------------------------------------------------------
> When I envoke "/home/golden/newppfilter/prop.filter </home/golden/newppfilter/hello.ps"
> I receive the following output (no locale complaints from perl):
>
> ENV=//.kshrc
> FCEDIT=vi
> HOME=/
> HZ=100
> KSHRC=//.kshrc
> LANG=C
> LOGNAME=root
> MANPATH=/usr/share/man:/usr/local/man
> PAGER=/usr/local/bin/less
> PATH=/sbin:/usr/sbin:/usr/bin:/etc:/usr/ccs/bin:/usr/ccs/bin:/usr/merge/dosroot/ubin:/usr/local/bin:/usr/ucb:/opt/wp6/wpbin
> PWD=/
> SHELL=/u95/bin/sh
> TERM=mitxterm
> TFADMIN=
> TIMEOUT=0
> TZ=:US/Central
> VISUAL=vi
> WPBIN=/opt/wp6/wpbin
> _=/sbin/su
> _TTYNAME=/dev/pts002
>
> Locale info follows:
> LANG=C
> LC_COLLATE="C"
> LC_CTYPE="C"
> LC_MESSAGES="C"
> LC_MONETARY="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_ALL=
>
> =======================================================================
> However, when I use "lp -T prop /home/golden/newppfilter/hello.ps"
> I receive the following error in the mail that perl is complaining
> about the locale (or lack therof):
>
> From lp Sun Jun 28 18:26 CDT 1998
> Return-path: <lp>
> Date: Sun, 28 Jun 98 18:26 CDT
> From: lp@goldens.private
> Subject: Status of lp request ibmpp-171
> Status: R
> Content-Length: 863
>
>
> Your request ibmpp-171 destined for ibmpp
> encountered an error during filtering.
>
> Reason for failure:
>
> perl: warning: Setting locale failed.
> Content-Length: 374
> Content-Type: text/plain
> Message-ID: <3596d10d0.184d@goldens.private>
> To: goldens!golden
> perl: warning: Please check that your locale settings:
> LC_ALL = (unset),
> LC_MESSAGES = "/etc/inst/locale/C",
> LANG = "C"
> are supported and installed on your system.
> perl: warning: Falling back to the standard locale ("C").
>
> CAT=uxrc
> FILTER=/home/golden/newppfilter/prop.filter
> LANG=C
> LC_MESSAGES=/etc/inst/locale/C
> PATH=/sbin:/usr/sbin:/etc:/usr/bin
> SPOOLER_KEY=59339831
> TFADMIN=
> TIMEOUT=0
> TZ=:US/Central
> _AUTOBOOT=true
> _CURR_NTIMES=0
> _CURR_RL=3
> _PREV_RL=S
>
> Locale info follows:
> LANG=C
> LC_COLLATE="C"
> LC_CTYPE="C"
> LC_MESSAGES=/etc/inst/locale/C
> LC_MONETARY="C"
> LC_NUMERIC="C"
> LC_TIME="C"
> LC_ALL=
>
> =======================================================================
> This is the perl script stripped down to dumping to stderr:
>
> #!/usr/local/bin/perl -w
> foreach( sort( keys(%ENV))) {
> print STDERR "$_=$ENV{$_}\n";
> }
> print STDERR "\nLocale info follows:\n";
> print STDERR `locale`;
------------------------------
Date: 5 Jul 98 20:51:07 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Help: perl5.00404 and UnixWare 2.1.2 (locale problem)
Message-Id: <slrn6pvp8g.j4t.sitaram@ltusitaram.diac.com>
On Tue, 30 Jun 1998 15:36:56 -0500, Dennis Golden
<dlgolden@ibm.net> wrote:
>This is a multi-part message in MIME format.
Dont do that. The second M in "MIME" stands for mail. This is
usenet, not email.
>perl: warning: Please check that your locale settings:
> LC_ALL = (unset),
> LC_MESSAGES = "/etc/inst/locale/C",
> LANG = "C"
> are supported and installed on your system.
Seems pretty clear to me. Have you tried comparing the output of
the %ENV printouts for both cases. I did - from your post:
The following line was extra in your failing case.
LC_MESSAGES=/etc/inst/locale/C
Figure out how that's getting set in your failing case, or unset
it forcibly and try again.
I have no clue about this problem - all I did was compare your two
outputs using diff and decide which of the differences *seems to
be* relevant. You could have done the same yourself and fixed it.
Perhaps that's why no one responded the first time...?
------------------------------
Date: 5 Jul 98 20:51:02 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: How to check variables exists in a string
Message-Id: <slrn6pvmtv.iup.sitaram@ltusitaram.diac.com>
On 5 Jul 1998 16:37:33 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
>Because you passed a string with variables' _names_ down into another
>scope, from which you'll never be able to find them if they're lexicals.
Doh - of course. Somehow I was inlining the code mentally!
------------------------------
Date: Sun, 05 Jul 1998 15:59:47 -0500
From: Joe Halbrook <inquiries@halbrook.com>
Subject: How to obtain HTML from current page where script is ran ...
Message-Id: <359FE943.42F79A45@halbrook.com>
I was curious if anyone knew of a way where I might be able to capture
the HTML displayed on the page where a call to my Perl script is
located. I'd like to obtain that HTML from my script so it could then
examine it.
Thank you in advance....
Joe Halbrook
http://www.halbrook.com
------------------------------
Date: Sun, 05 Jul 1998 12:11:02 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: ingnore this thread (double post) Re: package available to search local HTML pages? Re: limits of glob() ?
Message-Id: <359FB3A6.6D1F@flash.net>
sorry about the double-post, my computer crashed in the middle and I
didn't think the first one made it out!
D
------------------------------
Date: 5 Jul 1998 20:24:58 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: ingnore this thread (double post) Re: package available to search local HTML pages? Re: limits of glob() ?
Message-Id: <1998070520245800.QAA02435@ladder03.news.aol.com>
Hi Dan:
>sorry about the double-post, my computer crashed in the middle and I
>didn't think the first one made it out!
You DID say you were working on Win32.
On the GS "standard" distribution, perldoc works. Also, the docs are
sufficiently consolidated to use the standard Win32 find for string
searches if you don't do it often. Most stuff will "match" under the
"html" directory - although there are cases where you need to
check "lib" as well. Reportedly, the Win32 PRK from OReilly will
have a documentation browser and search utility.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Sun, 05 Jul 1998 15:14:54 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: limits of glob() ? and number of sub-dirs in win95
Message-Id: <359FDEBE.3429@flash.net>
Bbirthisel wrote:
>
> Hi Dan:
>
> >> : What IS the limit?
> >>
> >> It depends on the shell, not on perl.
> >-------
> >how about on win32?
>
> Still depends on the shell. Vanilla Win95 is just under 128 (126).
> Others differ.
--------------------------------
hhhmmm, as far as I can tell, this is not true. I have vanilla win95,
and wrote a little test program that uses glob to read and display all
the items in the directory. I created over 1200 items inthe directory
and everything was still working. I hesitate to keep copying to create
more files until somehting crashes...
can anyone expound just a little more on the limitations of using glob()
on win95 to grab a directory listing? are there limits on how many
sub-dirs can exist in a dir in win95?
thanx,
Dan
------------------------------
Date: 5 Jul 98 20:51:06 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: MS WIN 95 (OSR2.1) (Only $60)
Message-Id: <slrn6pvo5d.iup.sitaram@ltusitaram.diac.com>
On Sun, 05 Jul 1998 13:49:22 -0600, hardware.005@interserv.com
<hardware.005@interserv.com> wrote:
I'm really curious how they can sell shit (and old shit at that,
now :-) for > $0.02!
Oh look - an 888 number! I can call them and ask :-) If any of
you others are curious about the same thing, you could do the same
too <grin>
> T O L L F R E E 1- 8 8 8- 3 0 0 - 5 0 6 9
------------------------------
Date: 5 Jul 1998 17:34:12 -0500
From: mikeh@minivend.com (Mike Heins)
Subject: New ActiveState "Merge" version 5.00469
Message-Id: <359ff154.0@news.one.net>
I put up this version and tested it with my software, which is a pretty
good test; it uses many Perl features and encompasses 20,000+ lines of
code(not including standard modules used, of which there are many).
It seemed to start up much quicker than the 5.004_02 version,
and I was able to send a STOP signal (^C) and have it interrupt
select(,,,); that is very useful to me. Installation was an
InstallShield, and was a snap.
It incorporates a CPAN-like package manager called PPM, but
when I tried to install DB_File and Tk, two modules that incorporate
compiled XS libraries, it didn't seem to copy over the library files.
The Perl portions were installed; I tried installing a couple of
Perl-only modules and that worked fine.
I would dearly love to get those two modules installed.
Has anyone successfully used the new PPM to install a
compiled module?
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
Fast, reliable, cheap. 131 Willow Lane, Floor 2 | || _ \
Pick two and we'll talk. Oxford, OH 45056 | || |_) |
-- unknown <mikeh@minivend.com> |___| _ <
513.523.7621 FAX 7501 |_| \_\
------------------------------
Date: 5 Jul 98 20:51:05 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: package for searching local docs? WAS Re: limits of glob() ?
Message-Id: <slrn6pvnu9.iup.sitaram@ltusitaram.diac.com>
On Sun, 05 Jul 1998 11:42:22 -0500, Dan Baker <dtbaker_@flash.net> wrote:
>whew, that would make one MONSTER HTML page?! I am thinking it may be a
>good practice project to see if I can build a simple Perl search engine
>to zip thru all the local docs. Of course, if anyone already has one
>that will look through HTML pages for a word or phrase, I'd be glad to
>use it rather than re-invent! ;)
A while back there was some (heated) discussion between Ilya and
some others about effective documentation - Ilya defending her use
of the (proprietary) OS/2 "book" format. At that time someone
said that he was in the process of making just such a tool - uses
CGI and the webserver is built into the tool, in case you dont
have an Apache lying handy...
He said it was not ready for primetime, but if you were desparate
he'd be happy to...etc etc.
Search dejanews for a thread with subject like "Does Perl have a
IDE?I don't like command line." or something like that. I dont
remember any more about it, sorry.
HTH
------------------------------
Date: Sun, 05 Jul 1998 14:24:45 -0400
From: dmorel <emorel@stny.lrun.com>
Subject: perl cgi/telnet
Message-Id: <359FC4ED.9C4958AE@stny.lrun.com>
Hi,
does anyone know how to send a list of commands to a telnet client via a
perl/cgi script?
I have been able to implement a script that will launch the servers
telnet app (using a bat file) and
connect to the proper port. After that I am failing, I need to be able
to send a few comands (or lines
of text from a file) which would work using -S: textfilename.txt if I
was using an FTP client, but I have
had no luck with telnet.
tia,
dmorel@stny.lrun.com
------------------------------
Date: 5 Jul 98 18:42:58 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: question about objects
Message-Id: <slrn6pvhnb.ik3.sitaram@ltusitaram.diac.com>
On 05 Jul 1998 11:15:11 -0400, Jeremy D. Zawodny <jzawodn@wcnet.org> wrote:
>The difference between:
>
> while(<blah>) {
> print;
> }
>
>and
>
> while(<blah>) {
> print $_;
> }
>
>is really one of style IHMO. They both work, and *most* Perl hackers
To be true to your philosophy you should make that
while(defined($_ = <blah>))
don't you think?
>But, strangely, I'm a big fan of "$blah = shift;" instead of
>"$blah = shift(@_);"
That's probably a holdover from shell programming, where that is
the only allowed syntax. Just goes to show that, if you're
hadning over code to someone who doesn't understand the language's
bare basics, someone is in trouble anyway. Regardless of whether
common idioms have been used or not.
------------------------------
Date: Sun, 5 Jul 1998 16:35:34 -0500
From: "Jerry" <jerry@fitzweb.com>
Subject: regexp s/// for removing tail end of string
Message-Id: <6norj5$afs$1@news.iquest.net>
Hi there, hope someone can give me a quick hack to do this.
I have a string that is a full path to a file, i.e.
dir/subdir/subsubdir/file.ext What I want to do is strip off the file name,
leaving just the path info (with the final / ) in a string. The paths will
have a varying number of directories, so I don't think I can use split to
just grab all the dirs, throw out the last one, and join the remainder
together. (If this is the way to go, please show me I can't see it).
I tried substitution, using this:
$path =~ s/\/.*?$//;
but it strips off everything after the first '/'. I thought the '.*?' would
give me the minimal match, and the '$' would make the match start at the
end of the string, but I'm wrong.
Checked the FAQ, newsgroup, manpages, several books. All to no avail. I
know I'm missing something elementarily simple....
TIA,
Fitz
------------------------------
Date: Sun, 05 Jul 1998 21:58:00 GMT
From: Ryan Gendron <ryan@secretshopnet.com>
Subject: Re: regexp s/// for removing tail end of string
Message-Id: <359FF76B.F93E9140@secretshopnet.com>
This is a multi-part message in MIME format.
--------------C7D7DF71626EFB3F2D51C616
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi Jerry
$path =~ s/[^\/]*$//;
Try:
Jerry wrote:
> Hi there, hope someone can give me a quick hack to do this.
>
> I have a string that is a full path to a file, i.e.
> dir/subdir/subsubdir/file.ext What I want to do is strip off the file name,
> leaving just the path info (with the final / ) in a string. The paths will
> have a varying number of directories, so I don't think I can use split to
> just grab all the dirs, throw out the last one, and join the remainder
> together. (If this is the way to go, please show me I can't see it).
>
> I tried substitution, using this:
> $path =~ s/\/.*?$//;
> but it strips off everything after the first '/'. I thought the '.*?' would
> give me the minimal match, and the '$' would make the match start at the
> end of the string, but I'm wrong.
>
> Checked the FAQ, newsgroup, manpages, several books. All to no avail. I
> know I'm missing something elementarily simple....
>
> TIA,
> Fitz
--------------C7D7DF71626EFB3F2D51C616
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Ryan Gendron
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Ryan Gendron
n: Gendron;Ryan
org: <br><a href="http://www.secretshopnet.com"><img border=0 src="http://www.secretshopnet.com/gifs/ecom6.gif"></a><br>
adr: 501, 1202 Centre Street S.;;;Calgary;Alberta;T2G 5A5;Canada
email;internet: ryan@secretshopnet.com
title: Senior Web Developer
tel;work: (403) 261-5000 ext.224
tel;fax: (403) 261-4999
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------C7D7DF71626EFB3F2D51C616--
------------------------------
Date: Sun, 05 Jul 1998 19:11:43 +0200
From: "Mark" <admin@asarian-host.org>
Subject: Substitution-bug?
Message-Id: <199807051718.LAA22717@asarian-host.org>
Hi,
I was wondering whether perhaps I stumbled onto a perl-bug. I wrote a
very small prog that exhaustively searches and replaces IP-numbers in a
line:
while (<STDIN>) {
push(@header, $_);
}
$number = "0";
foreach $whatever (@header) {
if (@header[$number] =~
/(\D|\b)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\D|\b)/i) {
$middle = $&;
$& =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i;
$new = $`.'[IP-address.masked]'.$';
@header[$number] =~ s/$middle/$new/;
}
if (@header[$number] =~
/(\D|\b)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\D|\b)/i) {
$middle = $&;
$& =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/i;
$new = $`.'[IP-address.masked]'.$';
@header[$number] =~ s/$middle/$new/;
}
$number++;
}
The routine looks for an IP-number, preceded by either a non-digit
character or a boundary (like start-of-line,) and that either ends with
a boundary or a non-digit too. Then it replaces the true IP-number with
a text, then replaces the originally found IP-number and its possible
boundaries for what it found around the true IP numer with the new text
inserted. So, from the following string:
embed101.101.101.101embed
$& ($middle) becomes:
d101.101.101.101e
Then it looks in here for the true IP; $& becomes:
101.101.101.101
Then it sets $new to:
'd'.'[IP-address.masked]'.'e' ($new = $`.'[IP-address.masked]'.$')
Finally, in the original string, it attempts to translate $middle
(d101.101.101.101e) to d[IP-address.masked]e. The process seems rather
lengthy, but it is really necessary to ensure that we really replace a
properly identified IP-address.
Okay, nothing too fancy, except that is goes incredibly wrong. :) The
iteration caused the prog to hang in a while-loop, hence the manual
repetition. So, after feeding it this line:
Received: from anybody (ldn-p188.worldonline.nl [101.101.101.101])...
This came out (two-times iteraton):
Received: from anybody
(ldn[IP-address[[IP-address.masked]]masked]-p188.worldonline.nl
[101.101.101.101])...
Eh??? Something (or me) screws up incredibly with the substitution:
"s/$middle/$new/". Perl inserts the first found string at the position
of "ldn-", which is of course totally at the wrong place. The second
time it puts it at "address," equally misplaced. And since the IP number
just remains unchanged, the while loop would cause an infinite loop.
Okay, I managed to "solve" it, simply by circumventing the substitution:
while (@header[$number] =~
/(\D|\b)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\D|\b)/i) {
$before = $`; $after = $';
$& =~ /(\[|)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\]|)/i;
$new = $`.'[IP-address.masked]'.$';
@header[$number] = $before.$new.$after;
}
But none of the solution detracts anything from the fact that something
very odd is going on. Please, if anyone could shed some light on this,
I'd be much obliged. :) If you have a response, please email it too.
- Mark
---
"It is particularly incumbent on those who never change their opinion,
to be secure of judging properly at first."
[ Jane Austen, Pride and Prejudice ]
** Disclaimer ** The opinions expressed in this post do not necessarily
reflect the official stance of our server: asarian-host.org, and are
made on a personal basis only, solely written as the opinions of a
participant of this newsgroup, and solely to be read in that context.
--
For more information about this posting service, contact:
help@asarian-host.org -- for instant general information about our services
admin@asarian-host.org -- for the server's administrator
nclark@asarian-host.org -- for our PR manager
abuse@asarian-host.org -- for abuse of this posting service
If you wish to get an anonymous email/posting account, visit our sign-up page:
http://asarian-host.org/emailform.html
------------------------------
Date: 5 Jul 1998 20:19:23 GMT
From: macintsh@cs.bu.edu (John Siracusa)
Subject: Re: The vagaries of read()ing
Message-Id: <6non4b$6cb$1@news1.bu.edu>
Russ Allbery (rra@stanford.edu) wrote:
: For what it's worth, I would recommend selecting on the socket before
: reading even if nonblocking is set. I've had the experience on a few
: platforms of having sysread() *still* take a while to return if there's no
: waiting data, but selecting first to see if there's anything waiting seems
: to always work.
I tried that, but I was getting some weirdness in MacPerl and
everything seemed to work okay using just sysread(). Perhaps
I was doing something wrong in my select() call...
-----------------+----------------------------------------
John Siracusa | If you only have a hammer, you tend to
macintsh@bu.edu | see every problem as a nail. -- Maslow
------------------------------
Date: 5 Jul 98 18:42:59 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: Why can't I do this?
Message-Id: <slrn6pvi1k.ik3.sitaram@ltusitaram.diac.com>
On Sun, 05 Jul 1998 10:01:30 -0600, Jeffery Cann <jc_cann@ix.netcom.com> wrote:
># these 2 statements are equivalent and they both compile
>$him = Person->new();
>$him = Person::new();
>
># I *think* these statements are equivalent -- but I am wrong!
># the compiler lets me send "Jason" to the name() method
>$him->name("Jason");
>$him = Person::name("Jason");
new is the constructor. It hands back an object, but doesn't
(usually) require that you hand it one to start with.
All other methods are (again usually) instance methods, not class
methods. They need to work on a specific instance of the class -
an object.
Your first syntax specifies the object ($him). Your second syntax
does not (the LHS of the assignment doesn't count for these
purposes). Hence the error.
------------------------------
Date: Sun, 05 Jul 1998 13:03:06 -0600
From: The Privateer <privateer@thevortex.com>
Subject: Windows NT PERL in Netscape Problem
Message-Id: <359FCDEA.1A10F198@thevortex.com>
Hi, I'm just getting started using PERL CGI programs on Windows NT and
it seems to be acting strangely.
When I run a PERL program in Netscape using the Peer Web Services
address like
http://localhost/cgi-bin/prog.pl
the page created by the CGI comes up correctly. When I drag and drop
the PERL file directly into Netscape it prompts me to "Open" or "Save"
it and if I open it a DOS window is opened running the perl interpreter.
Does anyone know how to make drag and drop correctly run the PERL CGI?
--
Thanks,
The Privateer <privateer@thevortex.com>
------------------------------
Date: Sun, 05 Jul 1998 16:55:27 -0400
From: Pete Ruckelshaus <"mudboy"@pond[REMOVE].com>
Subject: Re: Windows NT PERL in Netscape Problem
Message-Id: <6nop26$nh4@netaxs.com>
The Privateer wrote:
>
> Hi, I'm just getting started using PERL CGI programs on Windows NT and
> it seems to be acting strangely.
>
> When I run a PERL program in Netscape using the Peer Web Services
> address like
>
> http://localhost/cgi-bin/prog.pl
>
> the page created by the CGI comes up correctly. When I drag and drop
> the PERL file directly into Netscape it prompts me to "Open" or "Save"
> it and if I open it a DOS window is opened running the perl interpreter.
>
This is not a problem. By using "localhost" to call your program, you
are instantiating it through Peer Web Services (i.e. it's going through
a web server). By dragging and dropping, you are not utilizing the web
server and will get this prompt. The same things happens if you try to
drag and drop an .asp file into your browser.
> Does anyone know how to make drag and drop correctly run the PERL CGI?
>
I guess I don't understand why this is so important, but then, I'm
pretty sure it can't be done anyway. A workaround is to create a .url
file for the desired location, and then you can drag and drop the .url
file. Just go to the proper path using localhost in your browser, and
then drag the "create a link" icon next to the location bar onto your
desktop. TIMTOWDTI.
Pete
> --
> Thanks,
>
> The Privateer <privateer@thevortex.com>
--
Pete's Bikindex - http://www.bikindex.com/
* * A Lycos Top 5% Site - Best of Cycling * *
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3065
**************************************