[8574] in Perl-Users-Digest
Perl-Users Digest, Issue: 2191 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 27 00:09:16 1998
Date: Thu, 26 Mar 98 21:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Mar 1998 Volume: 8 Number: 2191
Today's topics:
Re: 2$b || !2$b ? ; brian_r_parkes@hotmail.com
Re: Bidirectional Filehandle??? (Jason Gloudon)
Class-Eroot install <davidc@wrs.com>
do vs eval; configuration files (Tom Rokicki)
Re: do vs eval; configuration files (Tom Rokicki)
Ending test of perl script <cauleyfj@ix.netcom.com>
Flogging a Dead Horse Re: Primes via regexen <jefpin@bergen.org>
Re: get user information from the web <webmaster@fccjmail.fccj.cc.fl.us>
Re: Going Rates for PERL Programming??? <zenin@archive.rhps.org>
Re: Going Rates for PERL Programming??? asr@cornpone.nerdc.ufl.edu
Re: Help unpacking Little-Endian shorts and longs (brian d foy)
How do I create a reference to a specific mem loc? <dcarter@ch2m.com>
IMAP support? (Clint Harris)
Re: need regexp help <jefpin@bergen.org>
Re: need regexp help <rjk@coos.dartmouth.edu>
Re: Odd-Numbered Array to Hash <rjk@coos.dartmouth.edu>
Re: Oracle & Perl connect? <zenin@archive.rhps.org>
Re: Perl internals <walker@ncbi.nlm.nih.gov>
Re: PROPOSAL: The Perl Dictionary <rjk@coos.dartmouth.edu>
Re: PROPOSAL: The Perl Dictionary (David Adler)
Re: PROPOSAL: The Perl Dictionary (David Adler)
Re: PROPOSAL: The Perl Dictionary (David Adler)
Re: Q about CPAN Date module <rjk@coos.dartmouth.edu>
Searching for Larry Wall's humor and a Win32 file quest <mdanna@ghg.net>
Re: Searching for Larry Wall's humor and a Win32 file q <webmaster@fccjmail.fccj.cc.fl.us>
Re: Searching for Larry Wall's humor and a Win32 file q (Andrew M. Langmead)
Steven Kidd??? <downtube@downtube.com>
trivial example reveals a taint problem? <hoco@shell5.ba.best.com>
Re: ts: why have "push" and "unshift"? (Mike Stok)
Where can I learn about linking C library with Perl? <kjyeo@ns.koscom.co.kr>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Mar 1998 18:58:32 -0600
From: brian_r_parkes@hotmail.com
Subject: Re: 2$b || !2$b ? ;
Message-Id: <6fetic$kc5$1@nnrp1.dejanews.com>
$that = (@ISA = qw(question)); [sic]
In article <6fdpps$bd$1@plug.news.pipex.net>,
"David Rayner" <david@thames.com> wrote:
>
> 2$b || !2$b ? ;
>
> I'm having trouble get this Perl script to work, in fact it's
> turning out to something of a tragedy <G>
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Fri, 27 Mar 1998 00:10:02 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Bidirectional Filehandle???
Message-Id: <slrn6hlrg6.6e.jgloudon@manitoba.bbn.com>
Douglas Clifton <doug@weboneinc.net> wrote:
>If you open it for "+>" you get both read and write access
>to the file, however the file will be truncated so a read
>is impossible.
That's why there is "+<", which the original could have found by
reading the docs.
--
Jason Gloudon
------------------------------
Date: Thu, 26 Mar 1998 19:51:42 -0800
From: David Cross <davidc@wrs.com>
Subject: Class-Eroot install
Message-Id: <351B224E.5C7B@wrs.com>
The Class-Eroot and Class-Visitor packages are needed before the
SGML-SPGrove package will run. But Eroot does not follow the usual
perl Makefile.PL
make
make test
make install
pattern. Do the contained packages (Eroot.pm and Template.pm) need to be
in particular directories under Perl5.004_04? . . or has the package
(1995) been superceded by more recent ones that aren't mentioned in the
SPGrove docs?
Thanks for any help on this,
David Cross
<davidc@wrs.com>
------------------------------
Date: 26 Mar 1998 17:54:48 -0800
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: do vs eval; configuration files
Message-Id: <6ff0t8$201@cello.hpl.hp.com>
Do vs eval vs packages *and* Perl as a config file language.
I've encountered some strange behavior in packages and files, do and
eval, lexical and package/global variables.
In all cases, the configuration file simply sets `$a = 1'.
Do compiled in package main run in package main affects $::a.
Do compiled in package main run in package User affects $User::a.
Do compiled in package User run in package User affects $User::a.
Eval compiled in package main run in package main affects $User::a.
Eval compiled in package main run in package User affects main's my($a).
Eval compiled in package User run in package User affects *nothing*
that I can find.
There are strange things going on here.
(Some context. I use something like User::do below to read configuration
files; I explicitly export (through typeglobs) specific functions to the
User package and then `do' the config file in the User package so the user
has access to what I want him to [although he can always cheat by using
$main::x] and then I can look around in %User:: to see what he has done
and/or copy vars from %User:: to %main:: as necessary. This seems to
provide an adequate amount of protection and control while still giving
the user most of the power of Perl.)
My perl:
This is perl, version 5.004_04 built for PA-RISC1.1
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
The output of my script:
::do $::a X my($a) 2 $User::a 3 $User::my(a) 4
::eval $::a 1 my($a) X $User::a 3 $User::my(a) 4
::do2 $::a 1 my($a) 2 $User::a X $User::my(a) 4
::eval2 $::a 1 my($a) X $User::a 3 $User::my(a) 4
User::do $::a 1 my($a) 2 $User::a X $User::my(a) 4
User::eval $::a 1 my($a) 2 $User::a 3 $User::my(a) 4
My script (three files):
---test.pl---
$a = 'X' ;
1 ;
---main.pl---
#!/usr/local/bin/perl -w
require User ;
use strict ;
use vars qw($a) ;
$a = 1 ;
my($a) = 2 ;
sub dofile {
my($filename) = shift ;
my($succ) = do $filename ;
if (!$succ || $@ ne "") {
$@ = "Perhaps file not found?" if ($@ eq "") ;
die "Error in $filename $@\n" ;
}
}
sub evalfile {
my($filename) = shift ;
eval `cat $filename` ;
if ($@ ne "") {
die "Error in $filename $@\n" ;
}
}
sub dofile2 {
package User ;
my($filename) = shift ;
my($succ) = do $filename ;
if (!$succ || $@ ne "") {
$@ = "Perhaps file not found?" if ($@ eq "") ;
die "Error in $filename $@\n" ;
}
}
sub evalfile2 {
package User ;
my($filename) = shift ;
eval `cat $filename` ;
if ($@ ne "") {
die "Error in $filename $@\n" ;
}
}
sub reset_vars {
$::a = 1 ;
$a = 2 ;
User::reset_a() ;
}
sub print_vars {
print "\$::a $::a my(\$a) $a " ;
User::print_a() ;
print "\n" ;
}
reset_vars() ; print "::do " ; ::dofile("test.pl") ; print_vars() ;
reset_vars() ; print "::eval " ; ::evalfile("test.pl") ; print_vars() ;
reset_vars() ; print "::do2 " ; ::dofile2("test.pl") ; print_vars() ;
reset_vars() ; print "::eval2 " ; ::evalfile2("test.pl") ; print_vars() ;
reset_vars() ; print "User::do " ; User::dofile("test.pl") ; print_vars() ;
reset_vars() ; print "User::eval " ; User::evalfile("test.pl") ; print_vars() ;
---User.pm---
package User ;
use strict ;
use vars qw($a) ;
$a = 3 ;
my($a) = 4 ;
sub dofile {
my($filename) = shift ;
my($succ) = do $filename ;
if (!$succ || $@ ne "") {
$@ = "Perhaps file not found?" if ($@ eq "") ;
die "Error in $filename $@\n" ;
}
}
sub evalfile {
my($filename) = shift ;
eval `cat $filename` ;
if ($@ ne "") {
die "Error in $filename $@\n" ;
}
}
sub reset_a {
$User::a = 3 ;
$a = 4 ;
}
sub print_a {
print "\$User::a $User::a \$User::my(a) $a " ;
}
1;
More details on my Perl:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=hpux, osvers=9, archname=PA-RISC1.1
uname='hp-ux ballroom a.09.07 a 9000735 2003327014 two-user license '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O', gccversion=
cppflags='-D_HPUX_SOURCE -Aa -I/usr/local/include'
ccflags ='-D_HPUX_SOURCE -Aa -I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -L/usr/local/lib -L/usr/gnu/lib'
libpth=/usr/local/lib /usr/gnu/lib /usr/lib/pa1.1 /lib /usr/lib
libs=-lnet -lndbm -ldld -lm -lc -lndir -lcrypt
libc=/lib/libc.sl, so=sl
useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
cccdlflags='+z', lddlflags='-b -L/usr/local/lib -L/usr/gnu/lib'
Characteristics of this binary (from libperl):
Built under hpux
Compiled at Feb 3 1998 10:26:43
@INC:
/usr/local/lib/perl5/PA-RISC1.1/5.00404
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/PA-RISC1.1
/usr/local/lib/perl5/site_perl
.
------------------------------
Date: 26 Mar 1998 18:03:21 -0800
From: rokicki@cello.hpl.hp.com (Tom Rokicki)
Subject: Re: do vs eval; configuration files
Message-Id: <6ff1d9$2lp@cello.hpl.hp.com>
Oops; typo in my previous article:
Eval compiled in package main run in package main affects $User::a.
should be
------------------------------
Date: Thu, 26 Mar 1998 22:43:36 -0500
From: "Frank J. Cauley" <cauleyfj@ix.netcom.com>
Subject: Ending test of perl script
Message-Id: <351B2068.7D34E4EB@ix.netcom.com>
When testing a perl script using the DOS prompt, how does one pass
parameters to the program ? How does one get the perl script to continue
when it goes offline?
------------------------------
Date: Thu, 26 Mar 1998 11:02:22 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: "John L. Allen" <allen@gateway.grumman.com>
Subject: Flogging a Dead Horse Re: Primes via regexen
Message-Id: <Pine.SGI.3.95.980326110020.4369A-100000@vangogh.bergen.org>
On 23 Oct 1997, John L. Allen wrote:
>time perl -le '$N = shift; while ($_.=1, $n++<$N) {
> print $n if /^(?!(11+)\1+$)/ }' $N
>
>time perl -le '$N = shift; while ($_.=1, $n++<$N) {
> print $n if !/^(11+?)\1+$/ }' $N
>
>time perl -le '$N = shift; while ($_.=1, $n++<$N) {
> print $n if !/^(11{1,${\int sqrt length}}?)\1+$/ }' $N
>
>For N=3000, I got real times of
>
> 1m36.93s
> 0m43.57s
> 0m30.32s
Hmmm... obviously. your regex there is a little incorrect. Try this
regex. Abigail, this is faster than your current one.
Abby's: /^(11+)\1+$/
Faster: /^(11{1,int sqrt})\1+$/
The faster one has a difference (at N = 3000) of about 5 seconds.
--
| I am returning this otherwise good typing paper to you because
| someone has printed gibberish all over it and put your name at the
| top.
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: Fri, 27 Mar 1998 00:30:21 GMT
From: Webmaster <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: get user information from the web
Message-Id: <351AF1BA.6605B775@fccjmail.fccj.cc.fl.us>
liang wrote:
> hello all,
> I am trying to use perl to get all the information possible from the
> client side when he enters my web page. All I know is gethost() to get
> his host information. But I knew there must be more, can anyone help me?
>
> lzhu@emory.edu
>
> thanks in advance.
To see an example of CGI.pm in action go to-
http://webmaster.fccj.org/cgi/xRegEx.cgi
To see what I found out when you went to the above go to-
http://webmaster.fccj.org/wcjReportLog.html
If you are interested in the code -
send me an e-mail - it's for sell :-)
Sneex
PS - You can easily write it yourself, just study CGI.pm :-)
------------------------------
Date: 27 Mar 1998 03:29:37 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Going Rates for PERL Programming???
Message-Id: <890969744.481230@thrush.omix.com>
benjamin j snyder <bens@colon.cis.ohio-state.edu> wrote:
: Where does someone who contracts or free-lances PERL programming advertise
: their service?
In there .sig. I really meen it. When I was still contracting I
used to get far more leads then I could handle through my .sig and
the web page it used to point to. Of course, I was also #6 of the
top 10 posters last week so my .sig gets around a bit. :-)
By simply answering questions in this group I give possible clients
an idea of what my development and communication skills where, and
general personality. Information that can not clearly be gained
from just reading someone's web page or resume. It's not two hard
to see differences in peoples skills when one person is giving
clear answers to questions about building multithreaded database
proxy servers while another is having a hard time finding the man
page for the CGI module.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 26 Mar 1998 23:43:57 -0500
From: asr@cornpone.nerdc.ufl.edu
Subject: Re: Going Rates for PERL Programming???
Message-Id: <y9era3od9pu.fsf@cornpone.nerdc.ufl.edu>
"Peter Perchansky" <fp@pmpcs.com> writes:
> Wef wrote in message <35179f1e.11959503@news>...
> >Here's what my one and only client told me about the going rates for
> >PERL/CGI scripting for the WWW.
> >
> >$45/hour for "tweaking" existing scripts. Meaning the client wants ou
> >to change a few lines in a 'formmail.pl' script for instance...
> >
> >$100/hour for custom scripting... Meaning the client wants something
> >entirely different than what he/she can find on the web...
I'd reverse those, if anything.
At least $60 for original work, at least double that to modify someone else's
code.
-Allen S. Rout
-$20 to do it, $40 if you watch, $80 if you help
------------------------------
Date: Thu, 26 Mar 1998 21:29:40 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Help unpacking Little-Endian shorts and longs
Message-Id: <comdog-ya02408000R2603982129400001@news.panix.com>
Keywords: from just another new york perl hacker
In article <351AB312.10CA9891@mci.com>, Clinton Bodine <Clinton.Bodine@mci.com> posted:
>Hi All,
>
>I'm an a DEC Alpha running Digital Unix 4.0 and Perl 5.003.
have you played with the n,N and v,V templates for (un)pack? the
v,V templates seem to get their name from VAX (ta da!) :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Fri, 27 Mar 1998 15:18:23 +1000
From: "Darren Carter" <dcarter@ch2m.com>
Subject: How do I create a reference to a specific mem loc?
Message-Id: <6ff95u$lpo$1@reader1.reader.news.ozemail.net>
How can I create a reference (pointer) to a specific memory location? In C
(Borland flavour) I could use a macro called MK_FAR_PTR(segment,offset) to
create a far pointer to a mem location. I want to use a PERL script to read
values from the parallel port (mem address 0x378) from a digital<->analog
I/O card.
Any clues, please?
Thanks,
Darren
------------------------------
Date: 27 Mar 1998 00:50:48 GMT
From: clint.harris@software.com (Clint Harris)
Subject: IMAP support?
Message-Id: <6fet58$c8d$1@gte2.gte.net>
Hi,
Does anyone have an IMAP module or script in perl?
-Clint
--
+----------------------------------------------------------------+
| Clint Harris Software.com, Inc. |
| clint.harris@software.com |
| Phone: 805-882-2470 Santa Barbara, CA 93101 |
| Fax: 805-882-2473 http://www.software.com |
+----------------------------------------------------------------+
| Software.com, Inc. - The Internet Infrastructure Company (tm) |
+----------------------------------------------------------------+
------------------------------
Date: Thu, 26 Mar 1998 20:24:35 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
Subject: Re: need regexp help
Message-Id: <Pine.SGI.3.95.980326202124.13606A-100000@vangogh.bergen.org>
>benjamin j snyder (bens@chippewa.cis.ohio-state.edu) wrote:
>
>: I am having trouble with a few things, mainly regexps.
>
>: I have the following line:
>: @id_info = split (/./,$value);
> ^^^
>
> if ($value =~ tr/.// > 1)
> {print "more than one dot in '$value'\n"}
> else
> {print "less than or equal to one dot in '$value'\n"}
best make that $value =~ tr/././ because he may need $value later, WITH
the '.'.
> if ( $value =~ /^[a-zA-Z0-9]+\.[a-zA-Z0-9]{4}$/ )
> {print '$value' is in the correct format\n"}
> else
> {print '$value' is not formatted correctly\n"}
Some I picked up from ^Pudge on #perl in IRC:
to get a-zA-z0-9, a shortcut is [^\W_] because:
1) a ^ at the beginning of a [...] means NOT the following
2) \W is the opposite of \w (\w is [a-zA-Z0-9_]
3) the _ adds to the \W so that it doesn't allow for an _
Just some more little pointers. :)
--
A bird in the hand leaves a nasty stain.
- Jeff Pinyan
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: Thu, 26 Mar 1998 22:51:27 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: need regexp help
Message-Id: <351B2241.4BF6F7A@coos.dartmouth.edu>
I have a life, and I can prove it! wrote:
>
Now prove that you've read and understood the documentation.
> > if ($value =~ tr/.// > 1)
> > {print "more than one dot in '$value'\n"}
> > else
> > {print "less than or equal to one dot in '$value'\n"}
>
> best make that $value =~ tr/././ because he may need $value later, WITH
> the '.'.
Nice try.
DB<1> $_ = 'a.b.c'
DB<2> p tr/.//
2
DB<3> x $_
0 'a.b.c'
>From the definition of tr/SEARCHLIST/REPLACEMENTLIST/cds
(perlop documentation, also Programming Perl, 2nd ed, pg 75)
If the REPLACEMENTLIST is null, the SEARCHLIST is replicated.
--
_ / ' _ / - 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: Thu, 26 Mar 1998 23:45:03 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Odd-Numbered Array to Hash
Message-Id: <351B2ED4.34BD849@coos.dartmouth.edu>
Bart Lateur wrote:
>
> Art Cohen wrote:
>
> > @data = ("name", "Art", "phone");
>
> >I want to convert this to a hash %data where $data{'name'} eq "Art" and
> >$data{'phone'} eq "", however, simply saying
> >
> > %data = @data;
> >
> >doesn't work... the last field ("phone") simply gets thrown into the bit
> >bucket. Is there any way to avoid this?
>
> Well, add one element to the array if it has an odd number of elements.
> This ought to work:
>
> push @data,'' if @data & 1;
>
> Yup, it looks like it does.
Sure, it "works". But I'd hate to think anyone would seriously consider doing
it. If you're trying to make a hash from an odd number of elements, the
problem is in how you populate the array. Arbitrarily adding a null string to
the end of the array is like covering up a hole in the wall with duct tape.
What if the array were populated like this?
@lines = ('name:Art', 'phone:', 'email:art@vandelay.com')
foreach (@lines) {
push (@data, split /:/);
}
# @data = ('name', 'Art', 'phone', 'email', 'art@vandelay.com')
push @data,'' if @data & 1;
%data = @data;
# %data = ('name' => 'Art', 'phone' => 'email', 'art@vandelay.com' => '');
Obviously *not* what was desired.
--
_ / ' _ / - 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: 27 Mar 1998 03:31:09 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: Oracle & Perl connect?
Message-Id: <890969836.187261@thrush.omix.com>
Vinnie <browns1@borg.com> wrote:
: I am trying to connect to a ORACLE useing PERL. I keep getting the
: error
: Error connecting to DSN=tacc;UID=iftw;PWD=iftw; Error: [12641] []
: "[Oracle][ODBC Oracle Driver][Oracle OCI]ORA-12641: TNS:authentication
: service failed to initialize."
What does "oerr ORA 12641" say...?
This also does not show your code, or the exact error message.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Thu, 26 Mar 1998 19:34:21 -0500
From: Roland Walker <walker@ncbi.nlm.nih.gov>
To: Tom Nurkkala <nurkkala@mirage.skypoint.net>
Subject: Re: Perl internals
Message-Id: <351AF40D.CF9E7987@ncbi.nlm.nih.gov>
Tom Nurkkala wrote:
>
> Does there exist any internals documentation for Perl, beyond what's
> int the perlguts man page?
You may wish to look at the excellent PerlGuts Illustrated
http://home.sol.no/~aas/perl/guts/
by Gisle Aas.
R
------------------------------
Date: Thu, 26 Mar 1998 22:34:57 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <351B1E62.666B08D@coos.dartmouth.edu>
Eli the Bearded wrote:
>
> Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen <lassehp@imv.aau.dk> wrote:
> > In article <eli$9803251350@qz.little-neck.ny.us>, Eli the Bearded
> > <*@qz.to> wrote:
> > >perl -e 's ssqqprint qq\0just another new york perl hacker\n\0see'
> > Bareword found where operator expected at -e line 1, near "s ssqqprint qq\0just"
> ...
> > It seems perl is being perlturbed by your perlformance.
>
> No, I think something *else* was perlturbed by the embedded backspaces
> in that. The following two lines are identical in my editor, but one is
> two bytes longer than the other.
>
> perl -we 's ssqqprint qq\0just another new york perl hacker\n\0see'
> perl -we 's ssqq^Hprint qq\0just another new york perl hacker\n\0^Hsee'
I'm curious if you have actually run this snippet of code, or if you were so
amazed at your cleverness you just assumed it would work... :-)
[I changed the ^H and \0 to {} and () for convenience]
~ > perl -we 's ssqq{print qq(just another new york perl hacker\n)}see'
Bareword found where operator expected at -e line 1, near "s ssqq{print qq(just"
(Do you need to predeclare s?)
syntax error at -e line 1, near "s ssqq{print qq(just another "
Unquoted string "n" may clash with future reserved word at -e line 1.
Unmatched right bracket at -e line 1, at end of line
Execution of -e aborted due to compilation errors.
~ > perl -we 's ssqq{print qq(ju\st another new york perl hacker\n)}see'
Use of uninitialized value at -e line 1.
Use of uninitialized value at -e line 1.
just another new york perl hacker
Apparently perl considers the 's' in 'just' to be one of the delimiters.
> Both Randal and Chip seemed perlturbed to learn that <s>, <BS>, and <NUL>
> are perfectly good delimiter characters.
On the other hand, if you want to embed the delimiter in the regex or the
substitution, you have to escape it.
Also note that using s as the delimiter means \s matches a literal s and not a
whitespace character:
DB<1> $_ = ' s'
DB<2> p s s\ss!s
1
DB<3> x $_
0 ' !'
--
_ / ' _ / - 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: 27 Mar 1998 04:38:31 GMT
From: dha@panix.com (David Adler)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <6ffag7$3sn@news1.panix.com>
On Wed, 25 Mar 1998 06:06:01 -0500, brian d foy <comdog@computerdog.com> wrote:
>In article <6fai4r$prm$1@nnrp1.dejanews.com>, brian_r_parkes@hotmail.com posted:
>
>perlilous - mucking with the internals or trying to understand Chip.
... or trying to outdrink Randal.
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: 27 Mar 1998 04:51:33 GMT
From: dha@panix.com (David Adler)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <6ffb8l$3sn@news1.panix.com>
Uperl Volta - country where perl programmers control the electricity.
Amperlsand - half a short circuit.
Perls of wisdom - the camel.
Apperl - alternate name for macperl
I must be more tired than I think I am...
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: 27 Mar 1998 04:53:59 GMT
From: dha@panix.com (David Adler)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <6ffbd7$3sn@news1.panix.com>
On 26 Mar 1998 13:35:21 GMT, Eli the Bearded <*@qz.to> wrote:
>in that. The following two lines are identical in my editor, but one is
>two bytes longer than the other.
>
>perl -we 's ssqqprint qq\0just another new york perl hacker\n\0see'
>perl -we 's ssqq^Hprint qq\0just another new york perl hacker\n\0^Hsee'
>
>Both Randal and Chip seemed perlturbed to learn that <s>, <BS>, and <NUL>
>are perfectly good delimiter characters.
>
>Elijah
>------
>would have bare nulls in this if he thought newsservers could cope
You would, wouldn't you? I can hear the screams already...
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"The perversity of the Universe tends towards a maximum."
------------------------------
Date: Thu, 26 Mar 1998 23:29:30 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Stan Horwitz <stan@thunder.temple.edu>
Subject: Re: Q about CPAN Date module
Message-Id: <351B2B2F.A04C30F4@coos.dartmouth.edu>
[posted and mailed]
Stan Horwitz wrote:
>
> Here's one of many things I tried:
>
> use Date::Manip;
>
> $date1 = "11/20/98";
> $dow = 4;
> $date2 = &Date_GetNext(&ParseDate($date1), $dow, 0);
>
> print " The date following ".$date1." is ".&ParseDateString($date2)."\n";
> exit;
>
> The output is:
>
> The date following 11/20/98 is 1998112600:00:00
>
> Which is incorrect. I am not concerned with the time, but the date part
> should be 19981121, but the program's results are five days a head. What
> in the world am I doing wrong?
11/20/98 is a Friday. Thus, $dow should probably be 6, not 4. Date_GetNext
appears to be advancing ahead to the next Wednesday (as you asked it to) and
*then* calculating the next date.
>From the definition of Date_GetNext:
# $dow is the second argument to Date_GetNext
# $curr_dow is the calculated day of the week for the first argument
...
if ($dow == $curr_dow) {
$date=&DateCalc_DateDelta($date,"+0:0:1:0:0:0:0",\$err,0) if (! $today);
} else {
$curr_dow -= 7 if ($curr_dow>$dow); # make sure next date is greater
$num = $dow - $curr_dow;
$date=&DateCalc_DateDelta($date,"+0:0:0:$num:0:0:0",\$err,0);
}
...
On the other hand, that whole block is skipped if the second argument to
Get_DateNext is not defined. Try calling the subroutine like this:
&Date_GetNext($date1); # (parses the date for you if necessary)
Note: I figured this out solely from looking at the code, so it could be
wrong. The README says to look at the man page for documentation on all the
subroutines. Unfortunately, the Date::Manip distribution doesn't appear to
include a man page. >:-(
--
_ / ' _ / - 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: Thu, 26 Mar 1998 18:57:37 -0600
From: "Mark J. Danna" <mdanna@ghg.net>
Subject: Searching for Larry Wall's humor and a Win32 file questions
Message-Id: <351af95f.0@news.ghgcorp.com>
I am getting discouraged and need some of Larry Wall's humor. I am new to
this newsgroup and I can't figure out why I can't get a response to my Win32
file question. (This is my 3rd time to submit this question.) I have
looked for hours at FAQ's and books, but I can't find or I am blind to the
solution. Any response, either positive or negative would be greatly
appreciated.
Q. Is it that I don't use "UNIX", or does it take several tries to get a
response?
PERL is a super tool for Systems Administration (Thanks Larry!). Please
help me understand what it takes to become a real PERL programmer.
Here is my real question!
Q. I am looking for a function/module that returns Win32 file dates and
sizes (as displayed in a directory command). I believe that a dir
filename.ext>>dir.txt can be used with the returned value being placed in an
array, but has anyone written any functions/modules that returns these
values? I need these values for a comparison function when installing
patches to applications.
I am aware of the -x File Test (ref. page 121 "Learning PERL on Win32
Systems, O'Reilly & Assoc.) and the stat Function (page 123), but these use
PERL's Epoch age in the calculation for the creation/modification date. I
would like to believe that there is a more efficient way to return these
values directly from the system.
Thanks in advance,
Mark
------------------------------
Date: Fri, 27 Mar 1998 01:38:10 GMT
From: Webmaster <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: Searching for Larry Wall's humor and a Win32 file questions
Message-Id: <351B019E.456BECC5@fccjmail.fccj.cc.fl.us>
Mark J. Danna wrote:
> Q. I am looking for a function/module that returns Win32 file dates and
> sizes (as displayed in a directory command). I believe that a dir
> filename.ext>>dir.txt can be used with the returned value being placed in an
> array, but has anyone written any functions/modules that returns these
> values? I need these values for a comparison function when installing
> patches to applications.
>
> I am aware of the -x File Test (ref. page 121 "Learning PERL on Win32
> Systems, O'Reilly & Assoc.) and the stat Function (page 123), but these use
> PERL's Epoch age in the calculation for the creation/modification date. I
> would like to believe that there is a more efficient way to return these
> values directly from the system.
>
> Thanks in advance,
> Mark
Here is one way to do that -
system("dir c:\\Temp >>Listing.out");
open (dirList, "c:/Listing.out") || die ("Get a grip! $!\n");
while (<dirList>) {
print $_;
}
exit;
HTH,
Sneex
PS - I just started using:
Win32 port Copyright (c) 1995-1996 Microsoft Corporation. All rights reserved.
Developed by ActiveWare Internet Corp., http://www.ActiveWare.com
Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998
This is perl, version 5.003_07
Copyright 1987-1996, Larry Wall
+ suidperl security patch
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
------------------------------
Date: Fri, 27 Mar 1998 03:47:52 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Searching for Larry Wall's humor and a Win32 file questions
Message-Id: <EqGL7s.1FD@world.std.com>
"Mark J. Danna" <mdanna@ghg.net> writes:
>Q. Is it that I don't use "UNIX", or does it take several tries to get a
>response?
Its more like the fact that you phrased the question in a way that
there is no answer. Its was kind of like saying "I want to use this
car to drive to the mall, but I don't want to use the steering wheel."
>Q. I am looking for a function/module that returns Win32 file dates and
>sizes (as displayed in a directory command).
[stuff deleted]
>I am aware of the -x File Test (ref. page 121 "Learning PERL on Win32
>Systems, O'Reilly & Assoc.) and the stat Function (page 123), but these use
>PERL's Epoch age in the calculation for the creation/modification date. I
>would like to believe that there is a more efficient way to return these
>values directly from the system.
The timestamps are stored on the filesystem itself in a serial
format. (If I remember correctly, it stores them as the number of even
seconds since Jan 1, 1980 instead of seconds since Jan 1, 1970, but a
simple multiplication and addition bases them on the date the C
runtime library is expecting.) The "dir" command is reading this data
and transforming into a human readable format.
Saying that you don't want to use stat(), that you want something more
efficient makes it impossible to answer. The stat() function is
returning something very close to what is actually on the disk, and
you aren't going to get anything more efficient.
#!/usr/bin/perl -w
for $file (@ARGV) {
($date) = (stat($file))[9];
($mon,$day,$year,$hour,$min) = (localtime($date))[4,3,5,2,1];
$mon++; #localtime's month is 0 based.
$year %= 100; # dir only displays the last two digits.
$ampm = ($hour < 12 ? 'a' : 'p'); # figure out AM or PM
$hour %= 12; # 12 hour clock
$hour = 12 unless $hour; # 0 hour is 12AM
printf "%02d-%02d-%02d %2d:%02d%s\n",
$mon,$day,$year,$hour,$min,$ampm;
}
--
Andrew Langmead
------------------------------
Date: Thu, 26 Mar 1998 19:38:24 -0500
From: Downtube <downtube@downtube.com>
Subject: Steven Kidd???
Message-Id: <351AF500.12A8@downtube.com>
This message is for Steven Kidd, if anyone has his new e-mail address
could you please forward it to me.
Steven,
I have tried to e-mail you for a while now, and they all get bounced
back could you please get in touch with me. talk to you.....
yan
http://www.downtube.com
------------------------------
Date: 27 Mar 1998 03:15:22 GMT
From: Howard Cohen <hoco@shell5.ba.best.com>
Subject: trivial example reveals a taint problem?
Message-Id: <6ff5ka$jeb$1@nntp1.ba.best.com>
This is a problem for the experts who may follow this newsgroup.
I am working with:
perl, version 5.004_04 built for i586-linux
And this trivial example script fails!
#!/usr/local/bin/perl -T
$ENV{PATH}="/bin";
$host=`/bin/hostname`;
print "host=$host\n";
I get this error message:
Insecure $ENV{ENV} while running with -T switch at testit line 4.
Is this some kind of joke? I would expect it to complain about $ENV{PATH}
if it wanted to complain about something... What might $ENV{ENV} be?
I'm obviously not using that scalar. Tainting only applies to scalars,
so what is the problem here? Grrrr.
It runs fine on all others systems I've tried, including a linux system
running 5.003 and a FreeBSD system running 5.004 (plus a SunOS 4.1.3 and
Solaris 2.5).
FYI, the /bin directory on this system has perms:
drwxr-xr-x 2 root root 4096 Mar 3 15:23 /bin
These are the same perms on others systems where this script *does* work.
I've studied the Programming Perl (2nd edition) notes on "Cleaning up
your path" (page 359) but these notes shed no light on this problem.
I didn't compile perl on these systems so I don't know what they might have
done.
Are there any compile-time or install-time parameters that might affect
this? Is it possible that the person who prepared this version of perl
at this particular ISP *crippled it intentionally*? Is there a bug in
perl 5.004?
This isn't actually a beginner question... Please help if you can.
Thanks for your consideration,
Howard Cohen
hoco@timefold.com
------------------------------
Date: 27 Mar 1998 02:12:40 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: ts: why have "push" and "unshift"?
Message-Id: <6ff1uo$i75@news-central.tiac.net>
In article <6feidr$js7$1@orthanc.reference.com>, <tsatan@hotmail.com> wrote:
>One follow-up question: any ideas why the perl compiler doesn't
>optimize "@arr = ($x, @arr)" into "unshift @arr, $x"?
>Or am I the only perlson who would do something like that? ;-)
In a compiler that produces storable intermediate code that may be a
worthwhile thing to do, but for me (and I use perl as a scripting
language) I'd rather not have too many complex optimisations slowing down
the load part of load 'n' go.
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Fri, 27 Mar 1998 11:27:05 +0900
From: kjyeo <kjyeo@ns.koscom.co.kr>
Subject: Where can I learn about linking C library with Perl?
Message-Id: <351B0E78.ED7A012D@ns.koscom.co.kr>
I want to know how I can link c library with perl
Pleae any one answer me..
------------------------------
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 2191
**************************************