[7791] in Perl-Users-Digest
Perl-Users Digest, Issue: 1416 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 5 14:16:46 1997
Date: Fri, 5 Dec 97 11:00:55 -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 Fri, 5 Dec 1997 Volume: 8 Number: 1416
Today's topics:
"uninitialized value" -- but it's initialized! <ed@texas.net>
Re: "uninitialized value" -- but it's initialized! (brian d foy)
Re: "uninitialized value" -- but it's initialized! (M.J.T. Guy)
Bug in perl5.00404: strange behaviour of eval qx{} (Marek Rouchal)
Cross-platform way of interacting with user? (John Brownie)
Re: Cross-platform way of interacting with user? <ebohlman@netcom.com>
Re: DBI, DBD::Oracle, Oraperl.pm <Steve_Kilbane@cegelecproj.co.uk>
Re: eval, catch/try, and parameters <ed@texas.net>
Re: eval, catch/try, and parameters (M.J.T. Guy)
File Editing (Lops)
Re: help for a perl beginner! (brian d foy)
Joys of tainting (Philip)
Matching lowercase letter in regexp (Honza Pazdziora)
Re: Matching lowercase letter in regexp <zenin@best.com>
Re: need direct access to VTOC <qdtcall@esb.ericsson.se>
NY.pm welcomes Perl-ers going to Internet World (brian d foy)
Re: Pattern matching (or not....) (Bart Lateur)
People with 2 years of Perl 5 urgently required... <skemp@best-people.co.uk>
Perl 5 Contract Opportunity <skemp@best-people.co.uk>
Perl and Curses (Ho Chiu Yin)
Re: Perl Contractors Wanted <ghowland@hotlava.com>
Re: Perl editor needed (Bart Lateur)
Re: Perl Overhead <ed@texas.net>
Perl-ISAPI W32: -->perpetual hourglass (William R. Mussatto)
Re: Q: lambda fun, loop, string to expr <dformosa@st.nepean.uws.edu.au>
Re: Q: Learning perl with no progr. experience <dformosa@st.nepean.uws.edu.au>
Re: READING the last few lines of a HUGE FILE. (Philip)
Recommended PERL-book? <christian.bjelle@sesig.mail.abb.com>
Re: Recommended PERL-book? <ghowland@hotlava.com>
Re: Recommended PERL-book? <zenin@best.com>
Running the same program many times? <abrigham@mail.northroute.net>
Re: SybPerl <doublein@email.havas-intermediation.fr>
Re: URGENT- need perl script for winNT -to process gene (Jeremy D. Zawodny)
what's wrong with this? ddrayton@aol.com
Re: what's wrong with this? (brian d foy)
Re: Windows 95 flock problem (hapless newbie question) (Philip)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 4 Dec 1997 06:55:49 GMT
From: Edward Henigin <ed@texas.net>
Subject: "uninitialized value" -- but it's initialized!
Message-Id: <665k5l$hgm$1@news3.texas.net>
Why does this script
#!/usr/bin/perl -w
use strict;
sub A { "LLL" }
sub B { "LCLL" }
eval { sub C { A . B } };
print "$@\n" if $@;
print "c is: ",C,".\n";
produce this output?
$ ./script.pl
Use of uninitialized value at ./dink.pl line 6.
c is: LLLLCLL.
Line 6 is the eval. A and B are both defined. Heck, if
they weren't, the script wouldn't produce the expected output,
would it?
Ed
------------------------------
Date: Thu, 04 Dec 1997 02:31:36 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: "uninitialized value" -- but it's initialized!
Message-Id: <comdog-ya02408000R0412970231360001@news.panix.com>
In article <665k5l$hgm$1@news3.texas.net>, Edward Henigin <ed@texas.net> wrote:
> Why does this script
>
>#!/usr/bin/perl -w
>use strict;
>
>sub A { "LLL" }
>sub B { "LCLL" }
>eval { sub C { A . B } };
>print "$@\n" if $@;
>print "c is: ",C,".\n";
>
> produce this output?
>
>$ ./script.pl
>Use of uninitialized value at ./dink.pl line 6.
>c is: LLLLCLL.
> Line 6 is the eval. A and B are both defined.
it's not A and B that are the problem - it's C (try it with
eval { sub C {} };
). to get past this, you can do something like
eval { local $^W = 0; sub C { A . B } };
or something with an anonymous subroutine
my $C = sub { A. B };
print "c is: ",&$C,".\n";
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 4 Dec 1997 12:58:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: "uninitialized value" -- but it's initialized!
Message-Id: <6669e6$sfa$1@lyra.csx.cam.ac.uk>
Edward Henigin <ed@texas.net> wrote:
> Why does this script
>
>#!/usr/bin/perl -w
>use strict;
>
>sub A { "LLL" }
>sub B { "LCLL" }
>eval { sub C { A . B } };
>print "$@\n" if $@;
>print "c is: ",C,".\n";
>
> produce this output?
>
>$ ./script.pl
>Use of uninitialized value at ./dink.pl line 6.
>c is: LLLLCLL.
I'd call that a bug, and have reported it to perlbug.
Maybe the same bug as Marek Rouchal has reported with eval qx{}.
Mike Guy
------------------------------
Date: 4 Dec 1997 08:54:03 +0100
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: Bug in perl5.00404: strange behaviour of eval qx{}
Message-Id: <665nir$54r@buffalo.HL.Siemens.DE>
Please take a minute time and consider this small code snippet:
#!/usr/local/bin/perl -w
sub bla {
#$str = `echo 'print "$_[0]";'`; # line A
eval `echo 'print "$_[0]";'`; # line B
#eval $str; # line C
1; # line D
}
$a = "gnu";
&bla($a);
__END__
In this state it works as expected, i.e. it prints "gnu".
If "line D" is commented out, I get a "use of uninitialized value".
If lines A and C are made valid, and B and D commented out, the
same "use of uninitialized value" appears. In the latter cases no
"gnu" is printed.
Machine: SunOS 5.5.1 Generic sun4u sparc SUNW,Ultra-1
I reported the bug by perlbug, too.
Kind regards,
Marek
PS. If you want to reply by email, please remove -nospam- from
the address. Thank you.
--
Marek Rouchal Phone : +49 89/636-25849
SIEMENS AG, HL CAD SYS Fax : +49 89/636-23650
Balanstr. 73 mailto:Marek.Rouchal@-nospam-hl.siemens.de
81541 Muenchen PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de
------------------------------
Date: Thu, 04 Dec 1997 11:38:38 +0200
From: john.brownie@pp.inet.fi (John Brownie)
Subject: Cross-platform way of interacting with user?
Message-Id: <john.brownie-ya02408000R0412971138380001@news.inet.fi>
I'm a newcomer to Perl, although with experience of C, awk, etc. I've got
a successful script working on the Mac, but I need it to work on DOS
and/or Windows (probably both 3.1 & 95). The major problem is how to
handle interacting with the user.
Is there a portable way of asking for user input and for file names? I am
using MacPerl-specific methods at present, although they are locked away
in subroutines, so that I can replace things as necessary. If there is no
general way to handle multiple platforms, do I have to supply different
versions for the different platforms?
DOS should be easy: I expect that I could use STDIN and STDOUT for
interaction. Windows is more like the Mac :-) in that I would expect to
use dialog boxes.
Any help or pointers to help?
Thanks,
John Brownie
I usually work in Papua New Guinea, but I'm in Finland now, with the
following email account:
john.brownie@pp.inet.fi
My permanent email address is:
john_brownie@sil.org
------------------------------
Date: Thu, 4 Dec 1997 11:52:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Cross-platform way of interacting with user?
Message-Id: <ebohlmanEKnyBr.M14@netcom.com>
John Brownie <john.brownie@pp.inet.fi> wrote:
: Is there a portable way of asking for user input and for file names? I am
: using MacPerl-specific methods at present, although they are locked away
: in subroutines, so that I can replace things as necessary. If there is no
: general way to handle multiple platforms, do I have to supply different
: versions for the different platforms?
: DOS should be easy: I expect that I could use STDIN and STDOUT for
: interaction. Windows is more like the Mac :-) in that I would expect to
: use dialog boxes.
You should look into PerlTK for the GUI platforms.
------------------------------
Date: Thu, 04 Dec 1997 09:34:46 GMT
From: Steve Kilbane <Steve_Kilbane@cegelecproj.co.uk>
Subject: Re: DBI, DBD::Oracle, Oraperl.pm
Message-Id: <c47cd$9222e.2cd@news.cegelecproj.co.uk>
In article <01bd0029$862b84a0$3e03b480@mm>, "Phil R Lawrence" <prl2@lehigh.edu> writes:
> 1. Must you have installed DBI to make use of Oraperl.pm?
Yep. It's there somewhere. Try this:
perl -e "use DBI; print map { qq{$_ -> $INC{$_}\n} } keys %INC;"
> 2. Is Oraperl.pm different from DBD::Oracle? Or is Oraperl.pm what you
> end up with after you install DBD::Oracle?
Oraperl is a wrapper around DBD::Oracle. Apart from being the
"recommended" Oracle interface, it provides some settings for
the database access that are different from the defaults for
DBI as a whole, but are closer to what the old oraperl provided.
You can use Oraperl.pm, or you can use DBI and DBD::Oracle
directly.
> 3. If I am only interested in accessing Oracle databases, and no other
> varieties, what benefit is there using the DBI oop-looking method as
> opposed to plain old 'use Oraperl' method?
Preferred style? Do you like the oop style, or do you prefer others.
You might find that you have to move to other databases *anyway*,
as long-term plans seem to change in the short-term. :-)
On the other hand, when I moved from Oracle to SQL Server,
it took about half an hour to write enough of a new Oraperl.pm
that called DBD::ODBC that most of my scripts didn't need much
work (we won't mention differences in SELECT syntax, etc. :-) )
--
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.
------------------------------
Date: 4 Dec 1997 07:19:56 GMT
From: Edward Henigin <ed@texas.net>
Subject: Re: eval, catch/try, and parameters
Message-Id: <665lis$hgm$2@news3.texas.net>
Where can I find out more about the 'use constant' pragam?
I don't see anything about it in the perlmod manpage.
Heck, the perlfunc manpage, on the section on 'use', says:
See the perlmod manpage for a list of standard
modules and pragmas.
....
12/Jun/97 Last change: perl 5.004, patch 01 80
but when I look at the perlmod manpage, I don't see a list
of modules and pragmas. Pointers?
Ed
--
Tom Phoenix <rootbeer@teleport.com> wrote:
: I don't see why you're using eval here. Why don't you simply define those
: subs directly? Or, better, use 5.004's 'use constant' pragma? Hope this
: helps!
: --
: Tom Phoenix http://www.teleport.com/~rootbeer/
: rootbeer@teleport.com PGP Skribu al mi per Esperanto!
: Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
: Ask me about Perl trainings!
------------------------------
Date: 4 Dec 1997 12:44:03 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: eval, catch/try, and parameters
Message-Id: <6668ij$rvm$1@lyra.csx.cam.ac.uk>
Edward Henigin <ed@texas.net> wrote:
> Where can I find out more about the 'use constant' pragam?
>I don't see anything about it in the perlmod manpage.
>
> Heck, the perlfunc manpage, on the section on 'use', says:
>
> See the perlmod manpage for a list of standard
> modules and pragmas.
>....
>12/Jun/97 Last change: perl 5.004, patch 01 80
>
>
> but when I look at the perlmod manpage, I don't see a list
>of modules and pragmas. Pointers?
Oops! perlmod got split into perlmod and perlmodlib a few releases back.
That reference should be to perlmodlib, where you'll find
use autouse MODULE => qw(sub1 sub2 sub3)
Defers require MODULE until someone calls one of
the specified subroutines (which must be
exported by MODULE). This pragma should be used
with caution, and only when necessary.
blib manipulate @INC at compile time to use
MakeMaker's uninstalled version of a package
diagnostics force verbose warning diagnostics
integer compute arithmetic in integer instead of double
less request less of something from the compiler
lib manipulate @INC at compile time
locale use or ignore current locale for builtin
operations (see the perllocale manpage)
ops restrict named opcodes when compiling or running
Perl code
overload overload basic Perl operations
sigtrap enable simple signal handling
strict restrict unsafe constructs
subs predeclare sub names
vmsish adopt certain VMS-specific behaviors
vars predeclare global variable names
Mike Guy
------------------------------
Date: Thu, 4 Dec 1997 19:41:32 GMT
From: lops@I_should_put_my_domain_in_etc_NNTP_INEWS_DOMAIN (Lops)
Subject: File Editing
Message-Id: <EKoK18.AuA@konark.ncst.ernet.in>
Hello,
I have a problem related to file editing .
I want to change the data in particular location in the file later .
How can I change the data stored in the file ?
Cheers,
Uday.
uday@konark.ncst.ernet.in
------------------------------
Date: Thu, 04 Dec 1997 02:15:48 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: help for a perl beginner!
Message-Id: <comdog-ya02408000R0412970215480001@news.panix.com>
In article <348616D3.4199@aol.com>, snailgem@aol.com wrote:
>> 1. I (and most others) suggest you use "chomp" instead of "chop" to
>> delete the newline from your input. It's safer.
>Why is that?
chop removes the last character no matter what it is. chomp only removes
a trailing $INPUT_RECORD_SEPARATOR. thus, if all you want to do is remove
trailing newlines, chomp is much safer.
>Most of the code I read (even on this newgroup) uses 'chop'.
is most of the code you read perl4 by any chance?
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 04 Dec 1997 02:30:23 GMT
From: fil_nospam@login.net (Philip)
Subject: Joys of tainting
Message-Id: <348606d9.30136707@nntphost.login.net>
OK, anybody see the problem with this code :
next unless($t=~/([a-zA-Z0-9&=\+]+)/); # line 0
$r=quotemeta($1); # line 1
$r="$r\\W" if(length($t)<=2); # line 2
$t is tainted, lines 0 and 1 untaint it in $r. Line 2 causes $r to
become tainted. If I change line 2 to :
$r="$r\\W" if(length($1)<=2); # $r is no longer tainted
All I can think of is that $r is dependant on the (tainted) length of
$t. But if so, then all I can say is *WOW*, that's quite a powerful
parse. Also, how could the length of one string impact de security of
another?
Can anyone justify this? Is this documented anywhere?
TIA,
-Philip
PS : perl -v
This is perl, version 5.004_02
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.
PPS : perl -V
[snip]
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under MSWin32
Compiled at Aug 9 1997 21:42:37
%ENV:
PERL5LIB="D:\LANGUAGE\perl\perl5.306\lib\i386-win32"
@INC:
D:\LANGUAGE\perl\perl5.306\lib\i386-win32
D:\LANGUAGE\PERL\PERL5.004\lib\site
D:\LANGUAGE\PERL\PERL5.004\lib
c:\perl\lib
c:\perl\lib\site
c:\perl\lib\site
.
PPPS : remove the _nospam to respond to me.
------------------------------
Date: Thu, 4 Dec 1997 10:51:35 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Matching lowercase letter in regexp
Message-Id: <adelton.881232695@aisa.fi.muni.cz>
Hello,
I might be missing something in the FAQs, but: how do I match lowercase
letter (locale-smart, of course)? I can do
s/\w/ ("\l$&" eq $&) ? "$&:" : $& /ge;
but I would prefer something like
s/\l/$&:/g;
without the /e. Is there such a syntax around or can it be considered
for the next version?
Thanks for your time,
--
------------------------------------------------------------------------
Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 4 Dec 1997 12:48:15 GMT
From: Zenin <zenin@best.com>
Subject: Re: Matching lowercase letter in regexp
Message-Id: <881239862.762535@thrush.omix.com>
[ posted & mailed ]
Honza Pazdziora <adelton@fi.muni.cz> wrote:
: I might be missing something in the FAQs, but: how do I match lowercase
: letter (locale-smart, of course)? I can do
: s/\w/ ("\l$&" eq $&) ? "$&:" : $& /ge;
Ack! It's code like this that makes me loth perl sometimes... :-)
: but I would prefer something like
: s/\l/$&:/g;
Close...really, really close. :-)
s/\l\w/$&:/g;
\l doesn't match anything. It's just a modifier for something that
_does_ match something. :-)
Hope this helps!
--
-Zenin
zenin@best.com
------------------------------
Date: 04 Dec 1997 11:46:10 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: need direct access to VTOC
Message-Id: <is67p5gzd9.fsf@godzilla.kiere.ericsson.se>
Andrew Gehring <andrew_gehring@mk.com> writes:
> Any one know of a mod or way to directly access the VTOC on a Solaris
> system?
I've never heard of any modules for that (which doesn't mean that they
don't exist). Wrapping the read_vtoc function in an XS shouldn't be
too hard, though.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Thu, 04 Dec 1997 04:37:25 -0500
From: comdog@computerdog.com (brian d foy)
Subject: NY.pm welcomes Perl-ers going to Internet World
Message-Id: <comdog-ya02408000R0412970437250001@news.panix.com>
if you are in New York City for Internet World (or anything else) next
week and would like to hang out with a bunch of new-york-savvy
perl-ers rather than staying in your hotel room or drinking alone
in some spinning bar, send me a note and i'll be able fill you in
on anything that NY.pm, the New York Perl Mongers, may be doing.
if we were able to plan our informal gatherings ahead of time, we
would have a URL for our activities, but we tend to show up at some pub
agreed upon earlier that day. Perl book authors or columnists usually
get a free dinner out of the deal :)
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 04 Dec 1997 09:45:29 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Pattern matching (or not....)
Message-Id: <34865d19.1082516@news.tornado.be>
Mark Mielke <markm@nortel.ca> wrote:
>You both lose... the original author said "using perl4 unfortun'" :-)
Perl4 supports "\b", AFAIK.
As for the other problem, try this:
$search = "C++"; #example
$search =~ s/(\W)/\\\1/g;
/$search/ etc.
I would have thought you could figure this out by yourself. It's even in
the pods (but don't ask me where).
Bart.
------------------------------
Date: Thu, 04 Dec 1997 08:52:59 GMT
From: "Simon Kemp" <skemp@best-people.co.uk>
Subject: People with 2 years of Perl 5 urgently required...
Message-Id: <01bd0090$0d11c180$6f0a010a@LJBWV.best-people.co.uk>
for a contract opportunity in Scotland - call Simon Kemp on 44 171 300 9062
or skemp@best-people.co.uk
I have some excellent contract opportunities for 3-12 months with a rapidly
expanding small firm who have just landed 6 major contracts for on-line
credit card clearing. They want both junior and senior programmers with
UNIX/NT, Internet knowledge, Perl 5 with Object Orientated Programming, C
and HTTP. Electronic Commerce, Cryptography and SET is prefered.
I
------------------------------
Date: Thu, 04 Dec 1997 08:52:59 GMT
From: "Simon Kemp" <skemp@best-people.co.uk>
Subject: Perl 5 Contract Opportunity
Message-Id: <01bd0090$62fa3fa0$6f0a010a@LJBWV.best-people.co.uk>
I have some excellent contract opportunities for 3-12 months with a rapidly
expanding small firm who have just landed 6 major contracts for on-line
credit card clearing. They want both junior and senior programmers with
UNIX/NT, Internet knowledge, Perl 5 with Object Orientated Programming, C
and HTTP. Electronic Commerce, Cryptography and SET is prefered.
Call Simon Kemp - 44 171 300 9062
Skemp@best-people.co.uk
I
------------------------------
Date: 4 Dec 1997 07:10:54 GMT
From: 97Eyin@uxmail.ust.hk (Ho Chiu Yin)
Subject: Perl and Curses
Message-Id: <665l1u$eqp@ustsu10.ust.hk>
I have compile PERL 5.003 and Curses 1.02 in solaris, hpux9.*
and hpux10.*. It works well for solaris and hpux9.*. However, it
seems that the standend and standout semms not working well in
hpux10.*. All character become <reverse> after first running the
standout, no normal character can be display then when I issue the
next standend. That is all thing become <reverse> no matter what
I do then.
Does anybody have any suggestion on this?
Thanks
Stephen
------------------------------
Date: Thu, 04 Dec 1997 13:15:40 +0100
From: Gary Howland <ghowland@hotlava.com>
Subject: Re: Perl Contractors Wanted
Message-Id: <34869EEC.4072@hotlava.com>
Martien Verbruggen wrote:
>
> In article <348470CE.13D5FA40@martech.pageactive.com>,
> Peter Marshall <peterm@martech.pageactive.com> writes:
>
> > - we are Perl savy, you will not have to deal Perl wannabes
>
> savy?
> wannabes?
> deal Perl?
>
> > - you are one two types (yes there are more types)
>
> more than 'one two types'? 'four eight type'?
>
> > b) you like to be invovled from start contribute to the
> > creative solution
>
> invovled from start contribute?
>
> > DONOT POST REPLY Email to peterm@pageactive.com or call the
> > number below.
>
> Gosh, you guys sound professional. I am too intimidated to reply now..
Give him a break. (You have to bear in mind he's probably just an MBA,
not a perl techie).
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: Thu, 04 Dec 1997 09:45:33 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Perl editor needed
Message-Id: <34875f70.1680759@news.tornado.be>
James Ludlow <ludlow@us.ibm.com> wrote:
>If it's giving you problems though, just remember that you
>are using Perl, and stripping the ^M off of each line of a file on the
>Unix side would be a fairly trivial task.
>
>I'll even bet that some of the more experienced readers of this
>newsgroup would be able to do it as a one-liner. Hmmm... any takers?
I have no Perl that supports the command line options sufficiently
enough to actually test it (actually it's a shell problem), but here's
my stab:
perl -p -i.bak -e 'tr/\015//d' *.txt
HTH,
Bart.
------------------------------
Date: 4 Dec 1997 07:24:36 GMT
From: Edward Henigin <ed@texas.net>
Subject: Re: Perl Overhead
Message-Id: <665lrk$hgm$3@news3.texas.net>
Yeah, and apache + mod_perl is *very* fast. Very cool stuff.
And it's *easy* to extend apache with perl by plugging your perl
functions into the request chain. And with the persistence you get
from mod_perl, your scripts can cache information from one invocation
to the next, giving further performance gains.
apache + mod_perl is really the neatest thing since sliced
bread.
Ed
--
brian d foy <comdog@computerdog.com> wrote:
: you could do that with Perl using mod_perl and the Apache-like servers
: or FastCGI.
: --
: brian d foy <comdog@computerdog.com>
: NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
: CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 04 Dec 1997 06:59:42 GMT
From: mussatto@earthlink.net (William R. Mussatto)
Subject: Perl-ISAPI W32: -->perpetual hourglass
Message-Id: <665kbr$lf0@chile.earthlink.net>
Just installed perl-isap variant from activesite. Script accepted but
no output is produced only and infinite loop (pointer and hourglass in
Win NT 32). Perl.exe works fine. Any ideas?
bill Mussatto
------------------------------
Date: 4 Dec 1997 06:32:19 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Q: lambda fun, loop, string to expr
Message-Id: <881217043.63454@cabal>
In <66385g$d3e$1@nntp2.ba.best.com> "Xah" <xah@best.com> writes:
[...]
>Question: In Perl, an anonymous subroutine at runtime is defined like:
> $subref = sub BLOCK;
>Must anonymous subroutine always be bound to a variable? If so, isn't the
>advantage of ANONYMOUS routine lost?
It has to be bound to something or otherwise the subroutine will get
escape from the program and get collected by the garbige collector.
The advanige of an anonymouse subroutine is that you can pass it between
subrouteans and have the its scope the same as the verabiles.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep. I do not reply to mungged
Support NoCeM http://www.cm.org/ addresses.
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: 4 Dec 1997 06:15:37 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Q: Learning perl with no progr. experience
Message-Id: <881216043.191310@cabal>
In <slrn6864ds.lve.rodgerd@orwell.rm.gen.nz> rodgerd@orwell.rm.gen.nz (Rodger Donaldson) writes:
>On 1 Dec 1997 13:15:16 GMT, ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> wrote:
[...]
>>Perl is not a good lannguge to learn programing on IMHO.
>I beg to differ. Perl is a naturalistic languange that allows one to do
>useful things quickly.
This is true and I would not argue against it. However perl has a lot of
percularities that make it difficalt to use for first time programmers. I
don't think that Perl is a good learning languge for simmler reasons C
isn't a good languge to learn.
--
Please excuse my spelling as I suffer from agraphia see the url in my header.
Never trust a country with more peaple then sheep. I do not reply to mungged
Support NoCeM http://www.cm.org/ addresses.
I'm sorry but I just don't consider 'because its yucky' a convincing argument
------------------------------
Date: Thu, 04 Dec 1997 05:35:07 GMT
From: fil_nospam@login.net (Philip)
Subject: Re: READING the last few lines of a HUGE FILE.
Message-Id: <34863d82.44131416@nntphost.login.net>
>On Sat, 29 Nov 1997 16:26:40 GMT, Guy Doucet <gdoucet@ait.acl.ca>
>wrote:
>
>>But what if I want to read only the last few lines of an enourmously
>>large log file. I'm talking a few MBytes or maybe 10MBytes. I don't want
>>to write to it, only read it. The lines in the file are all different
>>lengths.
A sub-optimal solution :
Say you know that the last line is less then 1024. You seek that much
back from the end of the file. Then scan forward to find the last \n
in the file.
Like :
$lines=10;
$max_len=1024;
@last_lines[1 .. $lines]=();
seek(HNDL, -$max_len*$lines, 2) or die "unable to seek, $!";
while(<HNDL>)
{
unshift @last_lines, $_;
pop @last_lines;
}
And $last_line might contain your 10 last lines of the file in reverse
order. Of coures, you would include use such a kludge in production
code, *would* you? I'd go with File::IO (or is it IO::File) and more
comments.
-Philip
------------------------------
Date: Thu, 04 Dec 1997 11:38:51 +0100
From: Christian Bjelle <christian.bjelle@sesig.mail.abb.com>
Subject: Recommended PERL-book?
Message-Id: <3486883B.4CDE@sesig.mail.abb.com>
Hello.
I want to find a book that describes the basics of PERL, that also
doesn't get useless after a few days; i.e. it should be useful as a
reference when the PERL-basics has stuck in my head :)
I suppose there is some book out there that is to PERL what 'The C
programming language' by K&R is to C.
Many thanks in advance. (By the way, this question is most likely
answered in an faq somewhere isn't it?)
--
Christian Bjelle - Programmer
Disclaimer:
My views are my own, and usually doesn't coincide with my employer's.
----------------------------------------------------------------------
------------------------------
Date: Thu, 04 Dec 1997 12:45:44 +0100
From: Gary Howland <ghowland@hotlava.com>
To: Christian Bjelle <christian.bjelle@sesig.mail.abb.com>
Subject: Re: Recommended PERL-book?
Message-Id: <348697E8.31CC@hotlava.com>
Christian Bjelle wrote:
>
> Hello.
> I want to find a book that describes the basics of PERL, that also
> doesn't get useless after a few days; i
"Advanced Perl Programming" is the best perl book by a long shot.
I find it useful since some of the real world problems he addresses were
almost identical to ones I was working on at the time (such as a
database library that provides an identical interface to raw files and
SQL databases).
However, the best selling point, which you are unlikely to find in any
other perl book, is the author's *unbiased* comparisons between perl
features and features of other languages such as java, tcl and python.
Nothing irritates me more than an author pushing his own languages, and
criticising others, especially when he is not an expert at the other
languages. This is especially prevalent with perl programmers.
Gary
--
pub 1024/C001D00D 1996/01/22 Gary Howland <gary@hotlava.com>
Key fingerprint = 0C FB 60 61 4D 3B 24 7D 1C 89 1D BE 1F EE 09 06
------------------------------
Date: 4 Dec 1997 12:40:56 GMT
From: Zenin <zenin@best.com>
Subject: Re: Recommended PERL-book?
Message-Id: <881239423.506991@thrush.omix.com>
Christian Bjelle <christian.bjelle@sesig.mail.abb.com> wrote:
: I suppose there is some book out there that is to PERL what 'The C
: programming language' by K&R is to C.
"The Blue Camel", or more officially, "Programming Perl".
IMHO, it's not possible to program in Perl without it. :-)
: Many thanks in advance. (By the way, this question is most likely
: answered in an faq somewhere isn't it?)
man perlbook
Which is also were you can find ordering info.
--
-Zenin
zenin@best.com
------------------------------
Date: Thu, 4 Dec 1997 03:55:28 -0500
From: Andrew Brigham <abrigham@mail.northroute.net>
Subject: Running the same program many times?
Message-Id: <Pine.LNX.3.96.971204034253.11899A-100000@mail.northroute.net>
Currently I have a script which works like this
@lines; #assuming that I've already put some data in this array
foreach $line(@lines){
$info = `systemcommand $line`;
stuff to edit $info etc...;
}
of course this basically would run the "systemcommand" (whatever that
maybe) once for every argument I have in @lines... But now I'm searching
for a faster way to do this. Something that would run multiple copies of
"systemcommand" at the same time with different arguments... instead of
one after the other after another and so on and on...
Any suggestions would be appreciated :-)
-------------------------------
- Andy
abrigham@northroute.net
------------------------------
Date: Thu, 04 Dec 1997 13:09:50 +0100
From: L Doublein <doublein@email.havas-intermediation.fr>
Subject: Re: SybPerl
Message-Id: <34869D8E.741E@email.havas-intermediation.fr>
Mark Strivens wrote:
>
> I'm trying to compile SybPerl 2.08 on a Sun Solaris 2.5.1 machine
> using gcc 2.7.2.3 and CTlib version 11.1.
>
> After running 'perl Makefile.PL;make' I get many errors, in the first
> compile step:
>
> gcc -c -I/sybase/include -I/usr/local/include -I/opt/local/include -O
> -DVERSION=\"2.07\" -DXS_VERSION=\"2.07\" -fpic -I/opt/local/lib/perl5
> /sun4-solaris/5.00301/CORE -DCTLIBVS=100 -DSYBPLVER='"2.07"' -DDO_TIE
> CTlib.c
>
> I get errors such as:
>
> In file included from
> /opt/local/lib/perl5/sun4-solaris/5.00301/CORE/perl.h:104,
> from CTlib.c:26:
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:71:
> parse error before `fpos_t'
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:71:
> warning: data definition has no type or storage class
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:286:
> parse error before `fpos_t'
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/stdio.h:288:
> parse error before `*'
> In file included from
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/param.h:37,
> from
> /opt/local/lib/perl5/sun4-solaris/5.00301/CORE/perl.h:132,
> from CTlib.c:26:
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
> parse error before `off_t'
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
> warning: no semicolon at end of struct or union
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:166:
> warning: no semicolon at end of struct or union
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:167:
> warning: data definition has no type or storage class
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:168:
> parse error before `}'
> /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.7.2.3/include/sys/types.h:168:
> warning: data definition has no type or storage class
>
> Does anybody have any idea why this might be? Any suggestions
> gratefully received!!
>
> Mark
>
> --------------------------------------------------------------------
> Mark Strivens Telephone : 01235-824 536 (direct line)
> Informatics Group, 01235-834 393 (switchboard)
> MRC, Fax : 01235-824 540
> Harwell,
> Oxfordshire, OX11 0RD. email : mark@har.mrc.ac.uk
> United Kingdom. URL : http://www.mgc.har.mrc.ac.uk/
> ====================================================================
Hy mark,
I had the same pblm on a hp-ux.
I recompile perl with gcc in ansi mode (this the default on my hp but I
don't remember if it is the same with sun).
LOLO
------------------------------
Date: Thu, 04 Dec 1997 05:14:18 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: URGENT- need perl script for winNT -to process generic forms
Message-Id: <34873c04.386211542@woody.wcnet.org>
[original author automagically cc'd via e-mail]
On Wed, 03 Dec 1997 17:29:40 -0500, Michael Szymanski
<mike-s@home.com> wrote:
>URGENT- need perl script for winNT -to process generic forms
>(similar to matts script archive, unix ver)
>
>New to the whole NT cgi thing... ANy one have a generic script that you
>can email me that will work? any thing to note on nt aside from
>general.. perl install etc..?
I'd suggest Lincoln Stein's MailMerge Perl script.
I've set it up on numerous Unix and NT boxes.
Jeremy
--
Jeremy D. Zawodny jzawodn@wcnet.org
Web Server Administrator www@wcnet.org
Wood County Free Net (Ohio) http://www.wcnet.org/
------------------------------
Date: Thu, 04 Dec 1997 01:16:23 -0500
From: ddrayton@aol.com
Subject: what's wrong with this?
Message-Id: <34864AA7.2AD1@aol.com>
open (FILE, "$sf_cfg") or die ("Can't open it");
while (<FILE>) {
$newfile=$_;
$newfile=~ s/$old_prodlist/$new_prodlist/g;
print $newfile;
}
close (FILE);
print $newfile will just print $old_prodlist without the substitution.
Thank you.
------------------------------
Date: Thu, 04 Dec 1997 02:34:43 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: what's wrong with this?
Message-Id: <comdog-ya02408000R0412970234430001@news.panix.com>
In article <34864AA7.2AD1@aol.com>, ddrayton@aol.com wrote:
> $newfile=$_;
> $newfile=~ s/$old_prodlist/$new_prodlist/g;
> print $newfile;
>print $newfile will just print $old_prodlist without the substitution.
without knowing what $old_prodlist is, it is difficult to diagnose. you
might try
$newfile=~ s/\Q$old_prodlist/$new_prodlist/g;
which will quote any metacharacters in $old_prodlist.
also, do you really need the $newfile variable?
s/\Q$old_prodlist/$new_prodlist/g;
print;
will do the same thing.
--
brian d foy <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Thu, 04 Dec 1997 02:40:58 GMT
From: fil_nospam@login.net (Philip)
Subject: Re: Windows 95 flock problem (hapless newbie question)
Message-Id: <348617d8.34488505@nntphost.login.net>
On Tue, 2 Dec 1997 20:45:29 -0800, "etta" <etta@none.com> wrote:
>As far as I know there is no work real work around except comment out the
>flock and hope that system sorts it out is self. I have done this and have
>had no problem when I made a counter script.
Personnaly, I check for $Config{'d_flock'}; Makes your code more
portable.
>Warren Burstein wrote in message
><01bcff6a$47674de0$cd785ac2@wb.jen.co.il>...
>> "Benjamin Geer" <benjamin.geer@worldnet.att.net> writes:
>>
>>> Using code lifted from "Learning Perl for Win32", I'm writing a little
>>CGI
>>> script, under Windows 95, that takes form input and appends it to a file.
>>> The program runs fine, as long as this line is commented out :
>>>
>>> flock(MESSAGES, $LOCK_EX) || die("Can't flock $filename : $!");
>>
>>When I use flock on Windows 95, using Activeware "Perl for Win32 Build
>>313", which is Perl version 5.003_07, I get:
>>
>> flock() is not available on Win95!
>>
>>Is there another way to lock files? fcntl locking doesn't work, either:
>>
>> Your vendor has not defined Fcntl macro F_GETLK, used at fcntl line 2.
>>--
>>The entire world is a very strange carrot
>>but the farmer is not worried at all
>>
>
>
------------------------------
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 1416
**************************************