[17854] in Perl-Users-Digest
Perl-Users Digest, Issue: 14 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jan 8 06:25:39 2001
Date: Mon, 8 Jan 2001 03:25:12 -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: <978953111-v10-i14@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 8 Jan 2001 Volume: 10 Number: 14
Today's topics:
opening a file, NOT a filehandle 2obvious@my-deja.com
Re: opening a file, NOT a filehandle (Eric Bohlman)
Pattern Matching <hafateltec@hotmail.com>
Re: Pattern Matching <Peter.Dintelmann@dresdner-bank.com>
Re: perl / CGI backend to change a user's unix password <fozz@iodynamics.com>
Perl How-to site? <alexk@typhoon.xnet.com>
Re: Perl How-to site? (Bernard El-Hagin)
Re: Shall use a reference instead? <michael-a-mayo@worldnet.att.net>
Re: still having problems with cookies (Rafael Garcia-Suarez)
Re: What do you call the => operator? (Randal L. Schwartz)
Re: What do you call the => operator? (Abigail)
Re: What do you call the => operator? <bart.lateur@skynet.be>
Re: xs trouble on Win32 (building Win32::API) (Helgi Briem)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 08 Jan 2001 04:10:00 GMT
From: 2obvious@my-deja.com
Subject: opening a file, NOT a filehandle
Message-Id: <93beim$n60$1@nnrp1.deja.com>
I'm a Windows 98 user. I have this text-to-speech conversion software
called ReadPlease. When text files are saved with the .rps extension,
double clicking on opens ReadPlease and also automatically begins
reading the file. I'm trying to write a script that opens an .rps
file, but "open" in the perl sense doesn't refer to what I'm trying to
do.
I've attempted using the system() method and investigated all modules
with "Win32" in them, but I haven't had any success.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 8 Jan 2001 09:26:24 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: opening a file, NOT a filehandle
Message-Id: <93c140$g9q$1@bob.news.rcn.net>
2obvious@my-deja.com wrote:
> I'm a Windows 98 user. I have this text-to-speech conversion software
> called ReadPlease. When text files are saved with the .rps extension,
> double clicking on opens ReadPlease and also automatically begins
> reading the file. I'm trying to write a script that opens an .rps
> file, but "open" in the perl sense doesn't refer to what I'm trying to
> do.
> I've attempted using the system() method and investigated all modules
> with "Win32" in them, but I haven't had any success.
Try using system() to call the Win32 'start' command, as in:
system ('start myfile.rps');
start is a very small program that basically passes its arguments to the
Win32 API ShellExecute function, which looks up the associated application
for the file's type, starts that application in a new process, and then
returns.
------------------------------
Date: Mon, 8 Jan 2001 13:55:14 +1000
From: "Mike McPherson" <hafateltec@hotmail.com>
Subject: Pattern Matching
Message-Id: <93bdo4$duv$1@brokaw.wa.com>
I am having some difficulty figuring out how to set up a pattern match to
evaluate a ip address in the xxx.xxx.xxx.xxx format.
Please help
$patern_match_ip =
$patern_match_name =
if ($Webaddress = $patern_match_ip || $patern_match_name) {
print "\nGood address\n";
}else{
print "\nBad address\n";
}
Thanks
------------------------------
Date: Mon, 8 Jan 2001 09:49:15 +0100
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Pattern Matching
Message-Id: <93bv00$9r65@intranews.bank.dresdner.net>
Hi,
"Mike McPherson" <hafateltec@hotmail.com> wrote in message
news:93bdo4$duv$1@brokaw.wa.com...
> I am having some difficulty figuring out how to set up a pattern match to
> evaluate a ip address in the xxx.xxx.xxx.xxx format.
I thought it is somewhere in the FAQ...
What about
/^(?:\d{1,3}\.){3}\d{1,3}$/
HTH. Regards,
Peter Dintelmann
------------------------------
Date: Mon, 08 Jan 2001 03:20:51 -0700
From: "Doran Barton" <fozz@iodynamics.com>
Subject: Re: perl / CGI backend to change a user's unix password ?
Message-Id: <93c472$g6g$1@news.xmission.com>
In article <XLz56.117269$yR4.3209986@news1.rdc1.tx.home.com>, "Brett L.
Moore" <bmoore@door.net> wrote:
> I am new to perl and am attempting to develop the script to change a
> user's password on Solaris/Irix machines. The HTML front end was the
> easy part, as I feared.
>
> Can I simply perform system calls to passwd ? I am betting it is more
> complicated than that - for example, I would like to trap an invalid
> username / password condition to report failure to the user.
I won't go into the obvious security issues of doing password management
through a HTTP server. :-)
I haven't played with Irix/Solaris much lately, but on Linux, the
'passwd' program has a --stdin option which lets you pass the password
string to the program as standard input.
If your 'passwd' program doesn't implement something like this, you can
try the Expect module to create virtual tty and do Send-Expect
interaction with the 'passwd' command.
IMO, these are the most elegant solutions. You _could_ manage the
passwd/shadow files directly in Perl code, but this would be inefficient
and _not_ elegant.
You may also want to check out the setpwent() function. I believe it is
included as part of the POSIX module.
-=Fozz
--
------------------------------------------------------------------------------
fozz@iodynamics.com -- Doran L. Barton - Chief Super Hero, Iodynamics LLC
"A good messenger expects to get shot." -- Larry Wall
------------------------------
Date: Mon, 8 Jan 2001 08:24:30 +0000 (UTC)
From: Alexander Kilimnik <alexk@typhoon.xnet.com>
Subject: Perl How-to site?
Message-Id: <93btfu$9op$1@flood.xnet.com>
Hello:
I am considering developing a perl howto/resource site. Do you feel this
is beneficial to the Perl community or am I wasting my time?
Regards,
Alex
------------------------------
Date: Mon, 8 Jan 2001 08:27:57 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Perl How-to site?
Message-Id: <slrn95iugc.2q0.bernard.el-hagin@gdndev25.lido-tech>
On Mon, 8 Jan 2001 08:24:30 +0000 (UTC), Alexander Kilimnik
<alexk@typhoon.xnet.com> wrote:
>
>Hello:
>
>I am considering developing a perl howto/resource site. Do you feel this
>is beneficial to the Perl community or am I wasting my time?
Such a site already exists.
www.perl.org
Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print \Bernard'
------------------------------
Date: Mon, 08 Jan 2001 07:15:34 GMT
From: "Michael Mayo" <michael-a-mayo@worldnet.att.net>
Subject: Re: Shall use a reference instead?
Message-Id: <qOd66.21282$7f3.1508149@bgtnsc07-news.ops.worldnet.att.net>
<bababozorg@aol.com> wrote in message news:9377tk$jmj$1@nnrp1.deja.com...
> Now... this thing just accored to me that i could pass it as a
> reference to each of the subs instead of the actual $config...
>
> so i would pass:
>
> MyOtherModule::MySub(\$config)
In Perl (unlike C++), there is no difference between an object and a reference
to an object. The reference to the object *is* the object.
-Mike
------------------------------
Date: Mon, 08 Jan 2001 08:53:14 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: still having problems with cookies
Message-Id: <slrn95j003.uvs.rgarciasuarez@rafael.kazibao.net>
Sian Baldwin wrote in comp.lang.perl.misc:
> I posted this question a couple of days agao and got a resonse from
> Rafael...unfortunately, this didn't resolve the problem...so I am still in
> need of help, here was my original posting:
>
> I have written some code that takes user details and enters them in a
> database and then sets a cookie with the users name. I then use this cookie
> to welcome the user back on the main home page when they return to the
> site...my problem is that I cannot retrieve the cookie???
>
> Here is the code I am trying to retrieve the cookie with:
>
> #!/local/bin/perl
>
> use CGI qw(:standard :html3);
> use CGI::Carp ('fatalsToBrowser');
>
> %stored_cookie = cookie('ID');
>
> $personalised = $stored_cookie{name} ?
> "Welcome back, $stored_cookie{name}!" : "Customizable Page";
>
> print header();
> print start_html('Home Page');
> print h1($personalised);
>
> print end_html;
>
> I always get the "customizable page" bit, rather than the "welcome back
> whoever" bit....I have checked my cookies folder and a cookie has clearly
> been lodged by the other script....I cannot figure this one out??
Show us the code that _sets_ the cookie. Perhaps some value is set, but
is incorrect and can't be read with your code.
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 07 Jan 2001 11:16:27 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: What do you call the => operator?
Message-Id: <m18zonkwac.fsf@halfdome.holdit.com>
>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
Uri> well, more misprone to doing the wrong thing. in some cases if the
Uri> bareword is a perl operator it could be executed instead of being
Uri> quoted. there have been other issues with use integer not playing well
Uri> with -foo as a key and quoted by =>. some of these are fixed in some
Uri> versions but i can't quote which. so i rarely use the quote side effect
Uri> of =>.
It blows (up) when you get used to being "cutesy" as in:
rename "fred" => "barney";
and then someone comes along one day and maintains the code as:
use constant SOURCE => "fred";
...
rename SOURCE => "barney";
Ooops... no longer renaming "fred" to "barney"... you're renaming
"SOURCE" to "barney".
Just say *NO* to "cutesy" uses of =>. Use it only when you really
do want that left side to be a quoted bareword.
I see *far* too many cutesy uses of it. Use comma, durn it.
print join " ", 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: 8 Jan 2001 09:37:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: What do you call the => operator?
Message-Id: <slrn95j2il.eg2.abigail@tsathoggua.rlyeh.net>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDCLXXXVI September
MCMXCIII in <URL:news:m18zonkwac.fsf@halfdome.holdit.com>:
][ >>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:
][
][ Uri> well, more misprone to doing the wrong thing. in some cases if the
][ Uri> bareword is a perl operator it could be executed instead of being
][ Uri> quoted. there have been other issues with use integer not playing well
][ Uri> with -foo as a key and quoted by =>. some of these are fixed in some
][ Uri> versions but i can't quote which. so i rarely use the quote side effect
][ Uri> of =>.
][
][ It blows (up) when you get used to being "cutesy" as in:
][
][ rename "fred" => "barney";
][
][ and then someone comes along one day and maintains the code as:
][
][ use constant SOURCE => "fred";
][ ...
][ rename SOURCE => "barney";
][
][ Ooops... no longer renaming "fred" to "barney"... you're renaming
][ "SOURCE" to "barney".
][
][ Just say *NO* to "cutesy" uses of =>. Use it only when you really
][ do want that left side to be a quoted bareword.
If I write:
rename fred => "barney";
I really do want the left side to be quoted.... ;-)
][ I see *far* too many cutesy uses of it. Use comma, durn it.
][
][ print join " ", Just => another => Perl => 'hacker,'
It isn't more of a problem than auto quoting barewords in hash keys.
rename "fred", "barney";
$renamed {fred} ++;
And now someone comes along and maintains the code as:
use constant SOURCE, "fred";
rename SOURCE, "barney";
$renamed {SOURCE} ++;
Oops. Same problem.
Abigail
--
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print
qq{Just Another Perl Hacker\n}}}}}}}}}' |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w
------------------------------
Date: Mon, 08 Jan 2001 10:00:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: What do you call the => operator?
Message-Id: <ip3j5tka9s6s2lt92hsn4a3hcr09gdq000@4ax.com>
Abigail wrote:
>}} well, most perl hackers call it fat comma.
>
>I guess I'm either not a Perl hacker, or not most.
It's very safe to say it's the latter, and not just for this "fat
comma". :-)
Anyway, here's my two Euro-cents: I prefer "fat arrow" over "fat comma"
any time. First of all, it is *supposed* to look like an arrow. And
second, Perl has a "thin arrow": "->". Otherwise, I'd just have called
it an "arrow".
--
Bart.
------------------------------
Date: Mon, 08 Jan 2001 10:37:27 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: xs trouble on Win32 (building Win32::API)
Message-Id: <3a599781.2762752397@news.itn.is>
On Sun, 07 Jan 2001 18:50:39 +0100, Bjoern Hoehrmann
<bjoern@hoehrmann.de> wrote:
>* Soren Andersen wrote in comp.lang.perl.misc:
>>I am trying to compile the module Win32::API (http://dada.perl.it/) on WinNT4
>>sp6 using MinGW - gcc-2.95.2.1 and having a rough go of it with the xs code.
>>The compilation fails because this code has an undeclared identifier:
>
>>Anybody (perhaps familiar with xs and Win32/MSVC++) got any insights?
>
>Well, I tried to build it with VC++ 6.0 and got
>
> API.xs(155) : error C2065: 'na' : undeclared identifier
>
Why not try the recommended standard method
from the FM?
From the command line:
set HTTP_proxy=myproxy.mydomain.com:XXXX
#substituting your own proxy server and
#port number (for XXXX).
# (If you have a proxy. You can also set it
# more permanently in Control Panel - System - Environment)
>
cd c:/perl/bin # or wherever you have installed perl
perl ppm.pl
#This will run the Perl Package Manager
#that comes with Activestate's Perl distribution.
#This will give you a prompt that looks like:
PPM>
type install Win32::API
# ppm will download the module and install it.
Type quit when you have finished.
Rregards,
Helgi Briem
------------------------------
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 V10 Issue 14
*************************************