[9606] in Perl-Users-Digest
Perl-Users Digest, Issue: 3200 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 19 23:07:23 1998
Date: Sun, 19 Jul 98 20:00:27 -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, 19 Jul 1998 Volume: 8 Number: 3200
Today's topics:
Re: /^[a-z0-9]/ (Abigail)
c.l.p.mod newgroup (John Stanley)
Re: Can a Crontab run perl script (John Stanley)
Re: Can a Crontab run perl script (-)
Re: convert to text darrensw@pacbell.net
Re: eradicate / strip tabs from input (Martien Verbruggen)
File locking in Perl? (Christian Boehme)
Re: File locking in Perl? (Martien Verbruggen)
files of type darrensw@pacbell.net
Re: files of type (Larry Rosler)
Re: FTP between two Unix machines (Martien Verbruggen)
Re: GMTIME darrensw@pacbell.net
Re: GMTIME (Larry Rosler)
Re: How can I use a $ in s///? (Ronald J Kimball)
Re: How can I use a $ in s///? (Larry Rosler)
Re: How can I use a $ in s///? <*@qz.to>
Re: How do I clear an array? (-)
join and warnings on undef values <uri@sysarch.com>
Re: m//g strange behaviour ? <tchrist@mox.perl.com>
Re: multiple forks??? (Martien Verbruggen)
Re: Perl Beautifier Home Page <zenin@bawdycaste.org>
Re: Perl Beautifier Home Page (Abigail)
Perl commands in NT Q's: (was Re: Win32 install prob-- <sponge@iav.com>
Re: Reading in an email message into a Perl program (Ronald J Kimball)
Re: Reading in an email message into a Perl program (Martien Verbruggen)
Re: Restricting refering domains access to script? <tchrist@mox.perl.com>
Re: Restricting refering domains access to script? (-)
search string darrensw@pacbell.net
Re: search string (Larry Rosler)
sub's and rsh rlogin <nospam@nospam.com>
Re: upload in CGI perl (Martien Verbruggen)
Re: Web Components (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Jul 1998 02:27:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: /^[a-z0-9]/
Message-Id: <6ou9uv$63f$1@client3.news.psi.net>
Jonathan Feinberg (jdf@pobox.com) wrote on MDCCLXXXIII September MCMXCIII
in <URL: news:7m19er3d.fsf@mailhost.panix.com>:
++ abigail@fnx.com (Abigail) writes:
++
++ > /[^a-z0-9]/
++ >
++ > But that disallowes A-Z and accented letters as well. Perhaps you want /\W/.
++
++ Huh?
++
++ print join "\n", grep /^[^a-z0-9]/, qw(apple Brown betty Delight);
++
++ Does that not print "Brown\nDelight" on your box?
Yes. And
print join "\n", grep /^[^a-z0-9]/, qw /a::: b;;; s[][]/
prints
a:::
b;;;
s[][]
Your point being?
Abigail
--
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: 19 Jul 1998 22:02:18 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: c.l.p.mod newgroup
Message-Id: <6otqda$qav$1@news.NERO.NET>
Would someone who has a copy of the newgroup message please post a copy
here?
------------------------------
Date: 19 Jul 1998 22:00:15 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Can a Crontab run perl script
Message-Id: <6otq9f$qap$1@news.NERO.NET>
In article <35B1A56C.85E14798@compugen.co.il>,
Avi Rosenberg <avir@compugen.co.il> wrote:
>Also remember that when you run a script from cron, it might be
>executing
>with a different uid than your interactive checks...
A cron that runs its commands as anything other than the user whose
command it is is broken and should be removed from the system.
------------------------------
Date: Mon, 20 Jul 1998 01:49:50 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Can a Crontab run perl script
Message-Id: <35b2a214.84303322@news2.cais.com>
stanley@skyking.OCE.ORST.EDU (John Stanley) Said this:
>In article <35B1A56C.85E14798@compugen.co.il>,
>Avi Rosenberg <avir@compugen.co.il> wrote:
>>Also remember that when you run a script from cron, it might be
>>executing
>>with a different uid than your interactive checks...
>
>A cron that runs its commands as anything other than the user whose
>command it is is broken and should be removed from the system.
>
Yeah, I don't think uid, but maybe he just meant that it runs with a
different set of environment settings, which I am pretty certain can
happen.
------------------------------
Date: Sun, 19 Jul 1998 22:42:03 GMT
From: darrensw@pacbell.net
Subject: Re: convert to text
Message-Id: <35b27626.24494849@news.pacbell.net>
On Sun, 19 Jul 1998 21:35:36 GMT, darrensw@pacbell.net wrote:
Done it !!
Thanks
Darren
------------------------------
Date: 20 Jul 1998 00:30:16 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: eradicate / strip tabs from input
Message-Id: <6ou32o$2oh$2@nswpull.telstra.net>
In article <35B0F3A9.3297@nospam.callisto.si.usherb.ca>,
ELSS Admin <elssa09@nospam.callisto.si.usherb.ca> writes:
> I need a piece of code that will erase tabs from a form input.
>
> Will something like this work?
>
> $FORM{'message'} =~s/\t//g;
Have you tried it?
Another way would be tr/\t//d;
> Please reply by e-mail if possible.
It's not possible. Your From: field doesn't contain a valid email
address. Your Reply-To: field doesn't contain a valid email address.
Your message body doesn't contain a valid email address. My news
reader is too lazy to copy, edit and paste invalid email addresses.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | 75% of the people make up 3/4 of the
Commercial Dynamics Pty. Ltd. | population.
NSW, Australia |
------------------------------
Date: 20 Jul 1998 00:46:40 +0200
From: cb8@irz.inf.tu-dresden.de (Christian Boehme)
Subject: File locking in Perl?
Message-Id: <6ott0g$je7@irz606.inf.tu-dresden.de>
Hi there,
I'm writing a CGI script that each time a user accesses a specified
file increments a number saved in that file and gives that user a unique
number. Ideally, this would be a time stamp in the millisecond region
but I really have no idea where to get the millisecs from any time command
in UNIX. The problem is that when there are two accesses virtually at the
same time (within a fraction of a second) I'd still like them to be uniquely
from one another so the best solution I can think of at the moment is a
file locking mechanism to prevent two instances of the same program reading
and writing the same file at the same time. Question now is, can I do that
with Perl also? I already thought of invoking a UNIX command from Perl to
access the file with that guarantee of one instance writing to it at any
one time while the other blocks. However, I'd appreciate any help & input
on the matter as to how accomplish this.
Thanks and regards,
Christian
--
"May The Funk Be With You" -- Jedi Knights, Clear Recs. #406
------------------------------
Date: 20 Jul 1998 00:59:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: File locking in Perl?
Message-Id: <6ou4q3$3ku$2@nswpull.telstra.net>
In article <6ott0g$je7@irz606.inf.tu-dresden.de>,
cb8@irz.inf.tu-dresden.de (Christian Boehme) writes:
> but I really have no idea where to get the millisecs from any time command
> in UNIX. The problem is that when there are two accesses virtually at the
in perl:
use Time::HiRes
in 'UNIX':
many unices provide system calls to get and set this sort of info.
It's system dependent. You'll have to consult your local manual.
> file locking mechanism to prevent two instances of the same program reading
You'll need that. Randal Schwartz has written an excellent column
about this: http://www.stonehenge.com/merlyn/ Go to the WebTechniques
columns, and I think it's the fourth...
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | A Freudian slip is when you say one
Commercial Dynamics Pty. Ltd. | thing but mean your mother.
NSW, Australia |
------------------------------
Date: Sun, 19 Jul 1998 23:02:35 GMT
From: darrensw@pacbell.net
Subject: files of type
Message-Id: <35b27ab7.25664231@news.pacbell.net>
Hi
Is there a preferred file extension for writing and creating on the
server.
I see some people use .dat files and others .txt.
Thanks,
Darren
------------------------------
Date: Sun, 19 Jul 1998 16:25:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: files of type
Message-Id: <MPG.101c2039ef47e7f2989767@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35b27ab7.25664231@news.pacbell.net> on Sun, 19 Jul 1998
23:02:35 GMT, darrensw@pacbell.net <darrensw@pacbell.net> says...
> Hi
>
> Is there a preferred file extension for writing and creating on the
> server.
>
> I see some people use .dat files and others .txt.
Windows/DOS commands and applications ascribe semantics to file-name
extensions. Standard Unix commands don't (though 'perl' does, re
libraries and modules). No hablo Mac.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 19 Jul 1998 23:14:21 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: FTP between two Unix machines
Message-Id: <6otukd$cb$1@nswpull.telstra.net>
In article <7xr9zkmskx.fsf@fidelio.vcpc.univie.ac.at>,
Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> writes:
> The Net::FTP module would be a good starting point.
>
> And I realise this might be regarded as blasphemous in
> c.l.p.*, but what about using cfengine or rdist for this
> job?
No blasphemous at all. rdist is designed to do this sort of stuff. It
is not blasphemous to suggest to people to use the tools that are
already there.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | I'm just very selective about what I
Commercial Dynamics Pty. Ltd. | accept as reality - Calvin
NSW, Australia |
------------------------------
Date: Sun, 19 Jul 1998 22:05:51 GMT
From: darrensw@pacbell.net
Subject: Re: GMTIME
Message-Id: <35b26d99.22305285@news.pacbell.net>
On Sun, 19 Jul 1998 14:36:33 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:
Aaaaah, gotcha.
Is there a way then to code or amend GMTIME within the script to keep
up with the times(e.g. GMTIME + 1). Or even a manual fix as I am sure
I can manage this twice a year.
Thanks very much by the way, appreciated.
Darren
>
>But if it is 12noon P*D*T in the US then it is 20:00 (8:00pm) in the UK
>(BST), but it is 19:00 GMT (UTC).
>
>--
>Larry Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com
------------------------------
Date: Sun, 19 Jul 1998 15:51:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: GMTIME
Message-Id: <MPG.101c184ca55f4d42989765@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35b26d99.22305285@news.pacbell.net> on Sun, 19 Jul 1998
22:05:51 GMT, darrensw@pacbell.net <darrensw@pacbell.net> says...
> On Sun, 19 Jul 1998 14:36:33 -0700, lr@hpl.hp.com (Larry Rosler)
> wrote:
>
> Aaaaah, gotcha.
Hmmm. Another self-antonym (like cleave/cleave). 'Gotcha.' = 'I got
[understood] you.' || 'I got [caught] you.'
> Is there a way then to code or amend GMTIME within the script to keep
> up with the times(e.g. GMTIME + 1). Or even a manual fix as I am sure
> I can manage this twice a year.
There are a few games you can play, but messing with gmtime is not
appropriate. On Unix systems, at least, it is used by the OS to record
events, and it wouldn't do to have it other than monotonically
increasing.
To compute localtime from gmtime (taking DST into account), Unix systems
use a table /usr/lib/tztab and the TZ environment variable. You can mess
with either or both of those without retribution, I think.
In my work, I record all events using gmtime and report them in local
time using a constant offset [by default, the current offset in seconds,
gmtime($^T) - localtime($^T)]. They are thus still monotonic, but off by
one local hour half the year or so.
If your application requires accurate reporting of local time, you have
to calculate the twice-yearly transitions (as Unix does) and apply them
yourself. There may be code for this in one of the popular CPAN
date/time modules, but I haven't looked.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 19 Jul 1998 14:56:52 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How can I use a $ in s///?
Message-Id: <1dcf4x1.1akeeo319fm4gmN@bay1-52.quincy.ziplink.net>
Larry Rosler <lr@hpl.hp.com> wrote:
> 'Class' => sub { $_ = ']x' x 20; s|([]@!#%&{}=,;<>/$(*)+-])|\@$1|g },
That regex is still not quite right.
DB<1> x $(
0 0
DB<2> $_ = '(0$'
DB<3> s|([]@!#%&{}=,;<>/$(*)+-])|\@$1|g
DB<4> x $_
0 '(@0$'
DB<5>
You need to backslash the dollar sign.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 19 Jul 1998 16:15:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How can I use a $ in s///?
Message-Id: <MPG.101c1dd2fecf24ad989766@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <1dcf4x1.1akeeo319fm4gmN@bay1-52.quincy.ziplink.net> on Sun,
19 Jul 1998 14:56:52 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu>
says...
> Larry Rosler <lr@hpl.hp.com> wrote:
>
> > 'Class' => sub { $_ = ']x' x 20; s|([]@!#%&{}=,;<>/$(*)+-])|\@$1|g },
>
> That regex is still not quite right.
...
> You need to backslash the dollar sign.
Yes. You are the second poster to point this out.
I did a quick check through perlre, and didn't find an explicit list of
metacharacters within a character class. Perhaps the following is
useful. (It might be in Friedl, but that's at my office.)
^ (as the first character) complement the character class
] (not the first character) terminate the character class
- (not the first or last character) specify a range of characters
$ interpolate the characters in the specified scalar variable
\ introduce an octal/hex/control character, or escape metacharacter
interpretation of the next character
I think/hope that's complete and correct.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Jul 1998 02:15:56 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: How can I use a $ in s///?
Message-Id: <eli$9807192209@qz.little-neck.ny.us>
In comp.lang.perl.misc, Larry Rosler <lr@hpl.hp.com> wrote:
> I did a quick check through perlre, and didn't find an explicit list of
> metacharacters within a character class. Perhaps the following is
> useful. (It might be in Friedl, but that's at my office.)
>
> ^ (as the first character) complement the character class
> ] (not the first character) terminate the character class
or as the second, just after a ^
> - (not the first or last character) specify a range of characters
> $ interpolate the characters in the specified scalar variable
except when the last character
@ interpolate the array in a double-quotish manner (uses $")
> \ introduce an octal/hex/control character, or escape metacharacter
> interpretation of the next character
\b interpret as a backspace (^H), which while standard for double-
quotish interpretation normally, is not normal in other RE
contexts
> I think/hope that's complete and correct.
Well, you missed a few things I find obvious, I filled them in above.
There might still be others. &foo and %foo probably do fun things,
but I have not tried them.
Elijah
------
corrected someone here about the @ interpolation recently
------------------------------
Date: Mon, 20 Jul 1998 01:53:59 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: How do I clear an array?
Message-Id: <35b2a29f.84442109@news2.cais.com>
cberry@cinenet.net (Craig Berry) Said this:
>Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
>: Craig Berry <cberry@cinenet.net> wrote:
>:
>: > Not true (to my way of thinking). 'undef @array' says "I'm entirely done
>: > with @array; nuke it," while '@array = ()' says "@array is still around,
>: > it just doesn't contain anything right now." That's a big (semantic)
>: > distinction. And if I mean "it's empty now" but use undef to get there, I
>: > get "use of undefined value" warnings (quite properly).
>:
>: I wasn't able to reproduce this behavior. Could you post a bit of code
>: that shows how @array = () gives different warnings than undef @array?
>
>Yeah, looks like you're right -- I was extrapolating (falsely, it turns
>out) from the warning given for use of an undef scalar. O Perl Gurus, how
>come
But the overall point was just that, in times when clarity of coding
is maybe a little more important than the finer details and
intricacies of the language itself (and quite possibly process
efficiency), using undef(@array) could make it clearer to future code
readers, or even to yourself in future debugging/modification.
It's really just a "coding habit" stylistic thing, more than anything
else. Both get you from point a to point b. And like always,
TMTOWTDI
------------------------------
Date: 19 Jul 1998 19:53:50 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: join and warnings on undef values
Message-Id: <x7iuktmm7l.fsf@sysarch.com>
i am using dbi/dbd and fetching rows of records, some of which have null
fields. these are converted to undef by dbi/dbd. i then join them for
printing to a file. if i have warnings enabled (which i do as a standard
matter, tom c) i of course get warnings with the join of undef values. i
currently disable warnings around that join with $^W=0. i don't want to
do a
@row = map { defined( $_ ) ? $_ : '' ) @row ;
is there any better way to do this? i think join shouldn't trigger
warnings on undef. maybe there are cases where that is useful but not
with rdbms's. this is another reason for lexical warnings or warning
levels so i can disable join warnings in the sub but leave other
warnings active.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 20 Jul 1998 01:28:32 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: m//g strange behaviour ?
Message-Id: <6ou6g0$7pu$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Rick Delaney <rick.delaney@shaw.wave.ca> writes:
:[Aside: When is \G useful?]
($number = " 23 and no more") =~ s/\G /0/g;
print $number;
00023 and no more
--tom
--
"I discount everything Djikstra has to say because he doesn't actually
run his programs" --Rob Pike, On Djikstra's belief that bugs in your
program are a moral failure to prove your program mathematically correct.
------------------------------
Date: 20 Jul 1998 00:42:45 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: multiple forks???
Message-Id: <6ou3q5$3ku$1@nswpull.telstra.net>
In article <6orlcu$4b4$1@msunews.cl.msu.edu>,
"AJS" <spence79@pilot.msu.edu> writes:
> Hey All:
>
> I am wondering how I can spawn multiple children from 1 parent? I am
The following is something I use regularly. It's based on stuff from
perlipc, and other man pages.
This code just forks a number of children, who all go off and do
something. The parent just waits for them all to complete and then
does some post processing on whatever the children did. In some of the
programs I have based on this, the children each create a log file
(based on their 'sequence' number). After completion, the parent
collates all of the log files into one. In some other programs the
children check the state of various resources that need to be
accessed, When everything is ok, the parent goes ahead and accesses
what it needs.
# perldoc perlipc
for more ideas on how you can get your children to communicate.
Martien
#!/usr/local/bin/perl5 -w
use strict;
use Carp;
#
# Globals
#
my $NUM_CHILD = 5;
my $waitedpid = 0;
sub REAPER
{
$waitedpid = wait;
$SIG{CHLD} = \&REAPER; # Grrrrr to SYSV
logmsg("Reaped $waitedpid" . ($? ? " with exit $?" : ''));
}
$SIG{CHLD} = \&REAPER;
#
# Spawn NUM_CHILD children
#
for (my $i = 0; $i < $NUM_CHILD; $i++)
{
spawn(\&childproc, $i);
}
#
# Wait for all the children to finish
#
wait;
#
# Do post processing here
#
exit 0;
#
# Child procedure wrapper
#
sub childproc
{
#
# This is what the children will actually do
#
return 0;
}
#
# This is how we spawn
#
sub spawn
{
my $coderef = shift;
unless ($coderef && ref($coderef) eq 'CODE')
{
confess "USAGE: spawn CODEREF";
}
my $pid;
if (!defined($pid = fork))
{
logmsg("cannot fork: $!");
return;
}
elsif ($pid)
{
logmsg("Spawned child with pid $pid");
return; # Parent
}
# else I'm the child, go ahead
exit &$coderef( @_ );
}
#
# Routine to log some messages to stdout
#
sub logmsg
{
print "$0 $$: @_ at ", scalar localtime, "\n";
}
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | The gene pool could use a little
Commercial Dynamics Pty. Ltd. | chlorine.
NSW, Australia |
------------------------------
Date: 20 Jul 1998 02:29:49 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Beautifier Home Page
Message-Id: <900902377.396027@thrush.omix.com>
Austin Schutz <spamsux-tex@habit.com> wrote:
: Zenin wrote:
: > Russ Allbery <rra@stanford.edu> wrote:
: > : ($VERSION = (split (' ', q$Revision: 1.2 $ ))[1]) =~ s/\.(\d)$/.0$1/;
: > Try that with 1.2.1 or 1.100 and you'll get burned hard.
>snip<
: But the whole point of doing something like
: ($VERSION = (split (' ', q$Revision: 1.2 $ ))[1]) =~s/\.(\d)$/.0$1/;
: is so that if it fails no one will understand why anyway.
...no, it's not.
: If you wanted it to be understood and work reliably you would just do
: $VERSION = "1.2.1";
: and be done with it. But that's not very elite.
That's the problem, the above is *not* reliable.
First off, that directly translates to '1.2', no matter what
you've got after the second (or X number) decimal
point (UNIVERSAL::VERSION will blow chunks). Second, it requires
the author to manually update that value every time they check
in there code with RCS or whatever revision control program you're
using. In any large application with many files, this is very
easy to overlook. Besides, laziness is the virtue of the
programmer, so why would anyone want to manually do something
over and over all the time that is so easy to automate?
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 20 Jul 1998 02:33:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl Beautifier Home Page
Message-Id: <6ouaa1$63f$2@client3.news.psi.net>
Austin Schutz (spamsux-tex@habit.com) wrote on MDCCLXXXIII September
MCMXCIII in <URL: news:35B18511.1EF6@habit.com>:
++ Zenin wrote:
++ >
++ > Russ Allbery <rra@stanford.edu> wrote:
++ > >snip<
++ > : That's unnecessarily long for most people's version numbers. Try this
++ > : instead. :)
++ > : ($VERSION = (split (' ', q$Revision: 1.2 $ ))[1]) =~ s/\.(\d)$/.0$1/;
++ >
++ > Try that with 1.2.1 or 1.100 and you'll get burned hard.
++
++ But the whole point of doing something like
++
++ ($VERSION = (split (' ', q$Revision: 1.2 $ ))[1]) =~s/\.(\d)$/.0$1/;
++
++ is so that if it fails no one will understand why anyway. If
++ you wanted it to be understood and work reliably you would just do
++
++ $VERSION = "1.2.1";
++
++ and be done with it. But that's not very elite.
And RCS won't update that automagically.
I tend to use:
($VERSION) = '$Revision: 1.2 $' =~ /([\d.]+)/;
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: 19 Jul 1998 23:48:31 GMT
From: "Neal Miyake" <sponge@iav.com>
Subject: Perl commands in NT Q's: (was Re: Win32 install prob--another idiot)
Message-Id: <01bdb36f$0498b3a0$680918cf@default>
Clinton Gormley <*clinton@consol.co.uk> wrote:
> With IIS 3, you need to edit the registry to make IIS reognise .pl files
as
> scripts : the instructions can be found on the micrsoft knowledge base at
:
> http://support.microsoft.com/support/kb/articles/q150/6/29.asp
<snip>
Thank you very much for your prompt response. BTW, found out I was using
IIS4, not 3. After following the directions, the perl script ran! (well,
it didn't really run, but after correcting the paths, it should. (I hope)
However, I do have a few more questions relating the Perl for Win32 running
on NT and porting some unix-based script over:
1. Do I need to have the trailing "?" when calling the script? (eg
http://www.xyz.com/scripts/test.pl?.) Seems like it's not necessary.
2. Is there a equivalent "date" command under NT. I know in NT at the
command line, you can do a "date /t" to get back the date without prompt to
change it, but I would like to capture the date as a string. Tried those
backquotes to no avail.
3. What about "pwd"? Any NT command line equivalent?
4. Would like to use the date and time functions to create an unique
number to build data file names. Any easy way to grab these in NT? Guess
I could use the printf command if I can get #2 going.
That's all for now. Again, thanks Clint, and anyone else willing to help
this somewhat lost soul.
Aloha and cheers,
Neal Miyake (still stressing in Hawaii)
------------------------------
Date: Sun, 19 Jul 1998 14:56:43 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Reading in an email message into a Perl program
Message-Id: <1dcf4cd.1bmto57u1k1zaN@bay1-52.quincy.ziplink.net>
Ronald J Kimball <rjk@coos.dartmouth.edu> wrote:
> Here is code that fixes both of these problems. A header which appears
> more than once gets a reference to a list.
Oops. Each time the same header appears, the list is nested deeper.
Not what I had in mind...
$prevfield = 'OOPS';
while (<>) {
last if /^$/;
($field, $value) = /^(\S*)\s*(.*)/;
if (length $field) { # is this line a new field?
if (exists $fields{$field}) { # repeat occurence of field?
if (ref $fields{$field}) { # already ref to array
push @{$fields{$field}}, $value;
} else {
$fields{$field} = [ $fields{$field}, $value ];
}
} else {
$fields{$field} = $value;
}
$prevfield = $field; # save field name
} else {
(ref $fields{$prevfield} ? # is value a ref (to array)?
$fields{$prevfield}[-1] : # append to last element
$fields{$prevfield} # append directly to value
) .= "\n$value";
}
}
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 20 Jul 1998 00:24:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Reading in an email message into a Perl program
Message-Id: <6ou2ns$2oh$1@nswpull.telstra.net>
In article <01bdb1e1$70b96c80$1295cdcf@dbowen>,
"George H" <george@tapestry.net> writes:
> I am trying to write a program to parse email messages as they arrive and
> extract certain headers. Right now, I am trying to write the simplest of
> programs to just test that I can even do anything with an e-mail message.
[snip]
> Has anyone done something like this and have an example? I am stuck.
Yes, I have. And I use the module Mail::Internet for it. If you are
just interested in the headers, you might be successful with
Mail::Header.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: 19 Jul 1998 22:03:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Restricting refering domains access to script?
Message-Id: <6otqg4$p3b$2@csnews.cs.colorado.edu>
In comp.lang.perl.misc, some idiot who screws up his address writes:
You obviously don't know me very well. I do not pertain to the category
you seem to think I do. Hint: my first undergraduate degree was in a
language that isn't English.
--tom
--
sum to check equivalent files should use sum -a. --Andrew Hume
------------------------------
Date: Mon, 20 Jul 1998 01:59:57 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Restricting refering domains access to script?
Message-Id: <35b2a43e.84857800@news2.cais.com>
Tom Christiansen <tchrist@mox.perl.com> Said this:
>In comp.lang.perl.misc, some idiot who screws up his address writes:
>
>You obviously don't know me very well. I do not pertain to the category
>you seem to think I do. Hint: my first undergraduate degree was in a
>language that isn't English.
>
ahh.... Then you of all people should be more flexible about how
people use the language. I mean, assuming this guy was a non-english
speaking person, he did a very decent job of getting his question
across using english. That was all that I meant of that ;)
------------------------------
Date: Sun, 19 Jul 1998 23:41:28 GMT
From: darrensw@pacbell.net
Subject: search string
Message-Id: <35b283e2.28011279@news.pacbell.net>
Hi
How can I lock a search so that it only returns exact matches?
e.g. if I type car I would want the results to be for car and not
carton
Thanks,
Darren
------------------------------
Date: Sun, 19 Jul 1998 17:13:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: search string
Message-Id: <MPG.101c2b8c1bbe573e989768@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35b283e2.28011279@news.pacbell.net> on Sun, 19 Jul 1998
23:41:28 GMT, darrensw@pacbell.net <darrensw@pacbell.net> says...
> Hi
>
> How can I lock a search so that it only returns exact matches?
>
> e.g. if I type car I would want the results to be for car and not
> carton
Read about the '\b' zero-width assertion in `perldoc perlre`.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 20 Jul 1998 01:05:52 +0000
From: me <nospam@nospam.com>
Subject: sub's and rsh rlogin
Message-Id: <35B297F0.97421E41@nospam.com>
Hi guys,
I'm new to programming and I need a little help. I am trying to write a
script
that will start other scripts. Some of them are on different machines.
I'm having two problems:
1) There are about twenty scripts that I need to call from this menu
program,
but I am having trouble with my sub's. I am using the users input as
the
name of my sub then, calling the apporite sub. The problem is that I
keep
getting this error:
"Undefined subroutine &main::1 called at ./zonegen line 16, <>
chunk 1."
I think this may be the problem, (but I wasn't able to find the
answer in
any of the books I have) am I allowed to use integers as the name of
a sub? The reason I say this is because
when I change the name of the sub to something else (like "a" for
example)
it works fine.
2) The next thing I will have to do is call these scripts from several
different
macines. I have looked into "rsh" and "rlogin" but again I get
errors:
"rsh -l username hostname command" results in "permission denied".
"Can't locate object method "username" via package "hostanme" at
./zonegen line 24, <> chunk 1."
Basically, I just want to launch a script on a different machine.
This is a snippet of my code:
open (MENU,"menu");
while (<MENU>) {
print;
}
print "\n\nEnter Selection: ";
chomp($selection=<>);
print ("\n\n");
if ($selection < 22) {
&$selection;
}
else {
print ("Invalid selection\!\n\n");
}
sub 1 {
do 'dcs';
}
terrencemckenna@netscape.net
------------------------------
Date: 19 Jul 1998 23:20:52 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: upload in CGI perl
Message-Id: <6otv0k$cb$2@nswpull.telstra.net>
In article <Pine.SOL.3.96.980717163012.7915A-100000@ux8.cso.uiuc.edu>,
Indra Rosadi <rosadi@students.uiuc.edu> writes:
> Hi,
> I am just wondering if somebody can give me a small example about
> uploading files in CGI perl.. I keep getting stuck in this problem..
> Thanks a bunch..
The documenation that comes with CGI has one:
# perldoc CGI
[snip]
CREATING A FILE UPLOAD FIELD
print $query->filefield(-name=>'uploaded_file',
-default=>'starting value',
-size=>50,
-maxlength=>80);
[snip]
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Sun, 19 Jul 1998 17:05:05 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Web Components
Message-Id: <hiqto6.son.ln@localhost>
New Book News (noSpam@somedomain.com) wrote:
: Programming Web Components
: By Reaz Hoque and Tarun Sharma
: platforms. Java Masters Reaz
: Hoque and Tarun Sharma bring you
spam.
: Buy it online:
: http://www.amazon.com/exec/obidos/ISBN%3D0079123163/reazhoqueA/002-8026182-4000044
I've seen calls to boycott Amazon in the past, but I had not seen
first hand any abuses by them.
Now I have.
Boycott Amazon!
You can buy books online from:
http://www.barnesandnoble.com
http://www.borders.com
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3200
**************************************