[12435] in Perl-Users-Digest
Perl-Users Digest, Issue: 6035 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 17 17:07:29 1999
Date: Thu, 17 Jun 99 14:00:24 -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 Thu, 17 Jun 1999 Volume: 8 Number: 6035
Today's topics:
Re: @INC question <bbgraph@mail2.ee.net>
Re: @INC question <bbgraph@mail2.ee.net>
Re: A (E I O U?) <gbartels@xli.com>
Re: a thread on threads (the skinny on the schedule) <gbartels@xli.com>
Re: a thread on threads (the skinny on the schedule) <tchrist@mox.perl.com>
A <graeme@shentel.net>
A <graeme@shentel.net>
Address form parsing mod??? stuart@mohawk.net
Re: Afraid to ask about Y2K! (Bart Lateur)
Re: Afraid to ask about Y2K! (Paul David Fardy)
Re: cgi query error <uucon@my-deja.com>
Re: cgi query error <craig@mathworks.com>
Creating Datasources? <khowe@performance-net.com>
getting the values out of a reference <mikes@athabascau.ca>
Re: getting the values out of a reference (Greg Bacon)
Re: How can I 'edit' a datafile? <tchrist@mox.perl.com>
How do I the equiv. of csh echo $0 in perl? <inscoe@iag.net>
Re: How do I the equiv. of csh echo $0 in perl? (Greg Bacon)
Re: how to connect to an Oracle database via a cgi scri cool_water420@my-deja.com
Re: How to extract emails from Outlock Express <duraip@extendsys.com>
Re: matinal musings and the madrugada <emschwar@rmi.net>
Re: matinal musings and the madrugada <dhenders@cpsgroup.com>
Re: matinal musings and the madrugada <gbartels@xli.com>
Re: matinal musings and the madrugada <jcreed@cyclone.jprc.com>
Re: my() in a loop (Lee)
Mysterious segmentation fault in mod_perl hovinen@my-deja.com
Re: Mysterious segmentation fault in mod_perl <craig@mathworks.com>
Re: Mysterious segmentation fault in mod_perl <rootbeer@redcat.com>
Re: Neet Perl Obfucation Program <revjack@radix.net>
Re: Neet Perl Obfucation Program (Greg Bacon)
Re: Neet Perl Obfucation Program <gbartels@xli.com>
Re: Neet Perl Obfucation Program (Jerome O'Neil)
Re: Newbie Array Question <hojo@i-tel.com>
Re: Newbie Array Question <rootbeer@redcat.com>
Re: newbie learning "my" declarations (Lee)
Re: odd autoincrement behavior ? (Andrew Allen)
Re: perl on-line <tchrist@mox.perl.com>
premature end of script headers j_a_p@my-deja.com
Re: premature end of script headers <rootbeer@redcat.com>
Re: qr// doesn't save my day! (Bart Lateur)
Re: Signature removal regex? <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Jun 1999 15:11:25 -0400
From: "Bob Stickel" <bbgraph@mail2.ee.net>
Subject: Re: @INC question
Message-Id: <7kbhnt$2p3$1@news2.ee.net>
Tad,
Thanks....I wasn't sure whther the files had to be in both directories or
hard coded to the path where they reside...
Bob
================================
Tad McClellan wrote in message ...
>Bob Stickel (bbgraph@mail2.ee.net) wrote:
>
>: I'm just getting started with Perl and I'm not sure what the @INC does.
>
>
> It tells perl where to look for files that you have "require"d
> or "use"d.
>
>
>: Occasionally, a routine will fail with the @INC being referenced to not
>: found in c:\perl\lib, c:\perl\site\lib....
>
>
> It is not @INC that is not being found. It is a file that you
> asked to be "pulled in", but perl cannot find the file in any
> of the dirs listed in @INC.
>
>
>: Just wondering what it is and what I should do to fix it when I get these
>: errors.
>
>
> use lib '/path/to/modules/dir';
>
>
>--
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 17 Jun 1999 15:13:02 -0400
From: "Bob Stickel" <bbgraph@mail2.ee.net>
Subject: Re: @INC question
Message-Id: <7kbhqu$2pb$1@news2.ee.net>
Abigail,
Mostly because I didn't know what I was doing or what to look for or where
to look for help...hence, the post....
sorry....
Bob
==============================
Abigail wrote in message ...
>Bob Stickel (bbgraph@mail2.ee.net) wrote on MMCXV September MCMXCIII in
><URL:news:7k86f1$av2$1@news2.ee.net>:
>|| I'm just getting started with Perl and I'm not sure what the @INC does.
>
>
>There's a man page devoted to explaining all special variables.
>There's another man page devoted explaining all the error messages.
>
>
>Why didn't you consult them first?
>
>
>
>Abigail
>--
>perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: Thu, 17 Jun 1999 14:55:49 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: A (E I O U?)
Message-Id: <376944B5.2727E982@xli.com>
and sometimes Y
Greg
------------------------------
Date: Thu, 17 Jun 1999 14:27:49 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: a thread on threads (the skinny on the schedule)
Message-Id: <37693E25.7884E0A8@xli.com>
Tom Christiansen wrote:
(heavily snipped, sorry if anything when out of context)
> It's highly unclear how they light-weight processes (threads) interact
> with process-oriented features, such as signals. It's also a lot easier
> to debug without LWP. Handing a script kiddie threads is like handing a
> six-year old an Uzi.
so, to summarize, I'm hearing the following disadvantages to threads:
1) performance (slower) (pretend its acceptable)
2) unclear behaviour with process-oriented stuff
3) more difficult to debug
4) dangerous to use in unskilled hands (pretend I know what I'm doing)
which could be further summarized in:
1) performance
2a, b, c) undefined behaviour makes design and debug difficult.
is it undefined because no one has gotten around to defining it?
or is it undefined by nature of it being unpredictable in who/what/when
things get scheduled?
_Break_
so I just got the IPC::Sharable-0.30.readme file off of CPAN.
here are some disadvantages I see to using it with fork() to solve
my program problem.
1) alpha software, use at your own risk
2) uses perl "tie" to share data between multiple perl processes
2a) Tie will slow everything down, since it has to use code
to shuffle the data around between teh protected forked data.
would this be on the order of a 15 to 25 percent hit?
2b) Tie can only handle scalars and hashes.
tie can only partly handle arrays.
3) memory hit?
since it uses fork with protected data, and tie to
pass copies of data all around, wont that mean that
trying to have large chunks of shared data results in
large chunks of redundant memory?
------------------------------
Date: 17 Jun 1999 14:41:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: a thread on threads (the skinny on the schedule)
Message-Id: <37695d80@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Eric The Read <emschwar@rmi.net> writes:
:Tom Christiansen <tchrist@mox.perl.com> writes:
:> Also, the LW part of LWP is definitely overvalued these days. Linux
:> "threads" are still faster than NT "processes".
:
:Er, unless I'm reading that wrong, your second sentence is contradicting
:the first. Did you switch Linux and NT there, or was there some other
:point I'm being too dense right now to catch?
No, it's not contradicting itself. I'm saying that NT light-weight
processes (threads) are slow, and that Linux non-shared threads (processes)
are fast. Or maybe I'm only reading what I think I'm reading instead
of what's there.
--tom
--
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Thu, 17 Jun 1999 19:27:49 GMT
From: "Graeme Davies" <graeme@shentel.net>
Subject: A
Message-Id: <V_ba3.1437$jK5.248451@typ11.nn.bcandid.com>
------------------------------
Date: Thu, 17 Jun 1999 15:33:08 -0400
From: "Graeme Davies" <graeme@shentel.net>
Subject: A
Message-Id: <V_ba3.1438$jK5.248451@typ11.nn.bcandid.com>
a
------------------------------
Date: Thu, 17 Jun 1999 17:55:33 GMT
From: stuart@mohawk.net
Subject: Address form parsing mod???
Message-Id: <7kbcqf$pso$1@nnrp1.deja.com>
Does anyone know of a single Perl module for checking web mail address
form data(which is such a common thing nowadays e.g Name, Address1,
Address2, City, State, Zip)? Or must one use a set of separate modules
such as Lingua-EN-NameParse-0.04 and Geography::USStates, etc.?
When I search on CPAN for address seems I get only mods associated with
email addresses. Thanks for all help and hoping I have not mis-posted
:o)
-Stuart
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 19:20:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <376a4a73.702051@news.skynet.be>
Eric The Read wrote:
>But I think we'd better end this thread; it's making me Zeno-phobic.
It also lacks Perl content. ;-)
Bart.
------------------------------
Date: 17 Jun 1999 19:28:38 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7kbi96$fr2$1@coranto.ucs.mun.ca>
"Keith G. Murphy" <keithmur@mindspring.com> writes:
> Generally speaking, I go with new school for this reason:
>If I were to ask you what time it was, if you looked at your clock or
>watch and said, "Twelve o'clock", if this were during the day, it would,
>in a number of cases approaching infinity, be post meridian; and if it
>were at night, it would be after midnight, therefore ante meridian.
Good point. A digital clock shows "12:00" for a full minute, yet
only for an instant is it exactly 12 o'clock. Isn't it reasonable
to round "12:00:16 am" to "12:00 am"?
"00:00:02" equiv "12:00:02 AM" approx "12:00 AM" -- logical
"00:00:02" equiv "12:00:02 AM" approx "12:00 PM" -- illogical
Labelling midnight "12am" is incorrect, but it seems less so than "12pm".
FYI, strftime(%r) produces "12:00:00 AM" (on FreeBSD and Digital UNIX).
Paul Fardy
--
#include <time.h>
#include <stdio.h>
main()
{
time_t epoch = 0;
struct tm *tm = gmtime(&epoch);
char buf[BUFSIZ];
strftime(buf, (sizeof buf) - 1, "%Y-%m-%d %r", tm);
puts(buf);
}
------------------------------
Date: Thu, 17 Jun 1999 18:57:54 GMT
From: Ryan Corder <uucon@my-deja.com>
Subject: Re: cgi query error
Message-Id: <7kbgfb$rdo$1@nnrp1.deja.com>
I checked the perldiag man page. and didnt get anything out of it.
ryan
In article <7kb5r9$mmi$1@nnrp1.deja.com>,
Ryan Corder <uucon@my-deja.com> wrote:
> In my browser, when i run a script using CGI.pm i get the following error:
>
> Software error:
> Can't call method "param" without a package or object reference at
> /home/domain/public_html/dwctest/upload.cgi line 124.
>
> this is line 124:
>
> if ($query->param) {
>
> this is the line to check if the form is submitted, right?
>
> any ideas?
>
> ryan
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 16:13:19 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: cgi query error
Message-Id: <376956DF.4EF8BE08@mathworks.com>
You need to have a CGI object. Most likely you need to do:
$query = new CGI;
somewhere in the beginning of your code.
Do yourself a favor and check out the following URL:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
Craig
Ryan Corder wrote:
> I checked the perldiag man page. and didnt get anything out of it.
>
> ryan
>
> In article <7kb5r9$mmi$1@nnrp1.deja.com>,
> Ryan Corder <uucon@my-deja.com> wrote:
> > In my browser, when i run a script using CGI.pm i get the following error:
> >
> > Software error:
> > Can't call method "param" without a package or object reference at
> > /home/domain/public_html/dwctest/upload.cgi line 124.
> >
> > this is line 124:
> >
> > if ($query->param) {
> >
> > this is the line to check if the form is submitted, right?
> >
> > any ideas?
> >
> > ryan
> >
> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.
> >
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 16:25:31 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Creating Datasources?
Message-Id: <qUba3.34224$%65.69174@tor-nn1.netcom.ca>
Does anyone know of a module that allows creation of ODBC datasource names
from a web browser (UNIX or NT)?
Thanks
Kevin
------------------------------
Date: 17 Jun 1999 13:18:57 -0700
From: Mike Sosteric <mikes@athabascau.ca>
Subject: getting the values out of a reference
Message-Id: <m3ogiepolq.fsf@sociology.localnet.edu>
Ok, i'm pulling my hair out over this. Using Perl DBI, I
do a query that returns say 10 rows.
I only want the first item in each row, so i use
my $names = $sth->fetchall_arrayref([0]); #
to get only the first column.
Now, I want to take the resulting array (which is really reference) and
copy the values to a another array
my (@name) = @$names;
and then output a scrolling list using CGI thus
$w->scrolling_list(-name=>'Username', -values=>@names);
But all I get is scalar references, I don't get the actual values.
And I can't seem to get them out. There must be something I'm doing
can anyone hel?
thanks in advance
----code in a line
my $names = $sth->fetchall_arrayref([0]); # get reference
my (@name) = @$names; #copy to a new array
$w->scrolling_list(-name=>'Username', -values=>@names); t
------------------------------
Date: 17 Jun 1999 19:21:55 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: getting the values out of a reference
Message-Id: <7kbhsj$9tr$2@info2.uah.edu>
In article <m3ogiepolq.fsf@sociology.localnet.edu>,
Mike Sosteric <mikes@athabascau.ca> writes:
: I only want the first item in each row, so i use
:
: my $names = $sth->fetchall_arrayref([0]); #
:
: to get only the first column.
Eek. That's not gonna get it. The [0] is just a reference to an array
containing a lonely 0. Try something like
my @names = map { $_->[0] } @{ $sth->fetchall_arrayref };
: Now, I want to take the resulting array (which is really reference) and
: copy the values to a another array
:
: my (@name) = @$names;
Taken care of.
: and then output a scrolling list using CGI thus
:
: $w->scrolling_list(-name=>'Username', -values=>@names);
Ditto.
Greg
--
The sight of the child emerging is something you shouldn't miss, but don't
look when they administer the epidural or the episiotomy. Never look at an
episiotomy.
-- Garrison Keillor
------------------------------
Date: 17 Jun 1999 14:51:55 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How can I 'edit' a datafile?
Message-Id: <37695feb@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
jhawk39@idt.net (AJ) writes:
:I've tried opening the file until it comes to the line I want to
:change....writing that array to a second file....then writing the form
:information in. Then going back to the first file and reading
:everything that followed the line I was changing into an array....and
:then writing that to the 'second file'. It didn't work, and I decided
:the God of Perl hated me.
% man perlfaq5
(skip to question 2)
Also, the Ram talks about this in at least three different
recipes, which you can download.
--tom
--
X-Windows: A moment of convenience, a lifetime of regret.
--Jamie Zawinski
------------------------------
Date: 17 Jun 1999 21:06:00 GMT
From: Kevin Inscoe <inscoe@iag.net>
Subject: How do I the equiv. of csh echo $0 in perl?
Message-Id: <7kbnvo$ohu$1@news.iag.net>
In a csh script I can print the full patch of the script
by doing an echo $0 such as:
#!/bin/csh -f
echo $0 " executing"
$ test.csh
/opt/bin/test.csh executing
How can I do this in Perl 5?
I tried $argv[0] but aprently shell stacks params differently
then perl does.
TIA
~kevin
------------------------------
Date: 17 Jun 1999 20:56:52 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: How do I the equiv. of csh echo $0 in perl?
Message-Id: <7kbnek$b50$1@info2.uah.edu>
In article <7kbnvo$ohu$1@news.iag.net>,
Kevin Inscoe <inscoe@iag.net> writes:
: In a csh script I can print the full patch of the script
: by doing an echo $0 such as:
:
: #!/bin/csh -f
:
: echo $0 " executing"
Perl borrows quite a bit from the shells. The perlvar manpage documents
Perl's special variables. Maybe you should search that manpage for $0
to find out what's similar to $0.
Greg
--
I can please only one person per day.
Today is not your day.
Tomorrow isn't looking good either.
-- Dogbert
------------------------------
Date: Thu, 17 Jun 1999 19:37:25 GMT
From: cool_water420@my-deja.com
Subject: Re: how to connect to an Oracle database via a cgi script writtenin Perl
Message-Id: <7kbipk$sg2$1@nnrp1.deja.com>
In article <Pine.GSO.4.02A.9906170941300.13900-
100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Thu, 17 Jun 1999, Todd Moore wrote:
>
> > Where should I install the DBD::Oracle module?
>
> First choice is generally under a directory in Perl's default @INC
search
> path. Second choice is any other available directory, which you'll be
able
> to add to @INC via the 'use lib' pragma. See the docs for 'lib' for
more.
>
> > Is there a DBI that also has to be installed?
>
> The README file for the module should make it clear what else is
needed.
>
> > If so, can that be installed in my directory also?
>
> Sure, why not? It sounds good to me. :-)
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
>
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 17 Jun 1999 19:27:28 GMT
From: "pjd" <duraip@extendsys.com>
Subject: Re: How to extract emails from Outlock Express
Message-Id: <7kbi70$24b$0@198.102.102.248>
Outlook express exposes (Atleast the version 4.x) something called a
SimpleMAPI interface.
Using this protocol, you can access the folders , send mail, read mail do
all sorts of stuff.
This is implemented as a DLL. You can access this easily from a C Program.
I am not sure about doing this from perl. Unless someone has written an
extenstion , you may be out of luck.
You can write a small COM wrapper for this protocol (better yet, find one)
and happily use it from Win32::OLE..
Mosl Roland wrote in message <7k8qsm$3pe$1@orudios.magnet.at>...
>I would like to extract all emails from
>Outlock Express 5 and store the
>messages in an own database system.
>
>First step: how to extract from the
>Outlock Express files?
>
>
>--
>Mosl Roland - http://www.pege.org
>clear targets for a confused civilization
>
>
>
>
------------------------------
Date: 17 Jun 1999 13:06:09 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: matinal musings and the madrugada
Message-Id: <xkfso7qk5pa.fsf@valdemar.col.hp.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> For an equivalent in anglophonic culture, consider the words
> lunch/dinner (weekdays) versus dinner/supper (holidays or Sundays up at
> the grandparents).
In most anglophonic cultures I've seen, "dinner" always means "the main
meal of the day", whether it's eaten around midday or in the evening.
Frex, in the southeastern US, "dinner" is almost always the noon-ish
meal, because agri-cultures (heh, couldn't restrain myself) tend to eat
light dinners and go to bed early (what with often having to start the
day at 5am). Urban cultures, OTOH, tend to eat a rushed lunch, and take
their time over a leisurely dinner.
So it's not so much a workdays/non-workdays distinction as one based on
which meal is the most important in that context.
> If I could think of Perl context, I'd add some. :-)
So what happens when you evaluate an expression in madrugada context? :^)
-=Eric
------------------------------
Date: 17 Jun 1999 14:31:30 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: matinal musings and the madrugada
Message-Id: <877lp2mxnx.fsf@camel.cpsgroup.com>
>>>>> "Tom" == Tom Christiansen <tchrist@mox.perl.com> writes:
Tom> For an equivalent in anglophonic culture, consider the words
Tom> lunch/dinner (weekdays) versus dinner/supper (holidays or
Tom> Sundays up at the grandparents). These words shift in
Tom> meaning.
I've heard this explained by defining dinner as the largest meal
of the day, while lunch and supper or the noon and evening meals,
respectively. Hence, if lunch is your loargest meal it is also
your dinner. Same for supper.
(*Quick say something about perl so this post is on topic*)
------------------------------
Date: Thu, 17 Jun 1999 14:46:24 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: matinal musings and the madrugada
Message-Id: <37694280.89E53898@xli.com>
Tom Christiansen wrote:
> This morning-nonmorning thing is culturally dependent, you know.
> In Spain at 2 o'clock p.m., one man might address the other with "buenas
> tardes" while the other might respond "buenos dias", and both would
> be correct. That's because the "tarde" guy had eaten his meal already
> (although this would be a tad early for that), whereas the second one
> hadn't eaten yet, so it was still "dia" for him. Odd, eh?
Actually, the Marine Corps had the same rule when you saluted an
officer,
and you would say "Good morning, sir" or afternoon, or evening based
on whether you'd eaten chow or not. round midnight, it would always
roll over to "morning" though.
course, the Marine Corps always dated their documents YY/MM/DD
(which was a pain in the butt to unlearn in civilian life)
so I dont know that they're the leaders in time standards.
Greg
------------------------------
Date: 17 Jun 1999 15:40:34 -0400
From: Jason Reed <jcreed@cyclone.jprc.com>
Subject: Re: matinal musings and the madrugada
Message-Id: <a1g13q39al.fsf@cyclone.jprc.com>
Eric The Read <emschwar@rmi.net> writes:
> So what happens when you evaluate an expression in madrugada context? :^)
(undef,undef,$hour) = localtime;
if ($hour >= 1 and $hour <= 4) {
sleep((12 - $hour) * 60 * 60);
}
---Jason
------------------------------
Date: Thu, 17 Jun 1999 14:36:27 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: my() in a loop
Message-Id: <B38EB86B9668411A1F@204.112.166.88>
In article <ebohlmanFDCop8.Et@netcom.com>,
ebohlman@netcom.com (Eric Bohlman) wrote:
>Lee (rlb@intrinsix.ca) wrote:
>: In article <7k39m0$es$1@news1.bu.edu>,
>: John Siracusa <macintsh@cs.bu.edu> wrote:
>: >So, where do you put your my()'s, and why?
>:
>: I always do as in Example 1 [declarations outside the loop], because I'm
>too durn lazy to find
>out what the : repercussions of style-2 declarations may or may not be.
>
>But sometimes putting the declaration outside the loop has repercussions
>as well. "Always" is an awfully strong word. Can you tell why this code
>doesn't work properly?
>
>my @params;
>while (<INPUT>) {
> chomp;
> @params=split(/:/);
> push @paramlist,\@params;
>}
Nope. :)
I would guess that @paramlist might end up containing a list of references
to the final value of @params.
Which is why I would never write that. I'd find some long-winded and
inefficient way to do it. Someone was recently accused of writing FORTRAN
in Perl. I write Lisp in Perl. When I think lists, I think in Lisp, even
though I haven't actually programmed in Lisp for 10+ years.
If/when I solve certain Perl security and performance issues to my
employer's satisfaction, I will enthusiastically throw C in the rubbish and
learn to think in Perl.
Final point: if I wanted @params to be "local" to while, I'd wrap the
declaration and loop in a block or sub. It ain't always pretty, but that's
what I do.
Lee
------------------------------
Date: Thu, 17 Jun 1999 19:05:07 GMT
From: hovinen@my-deja.com
Subject: Mysterious segmentation fault in mod_perl
Message-Id: <7kbgsr$rjk$1@nnrp1.deja.com>
Hello
I have a script and a bunch of modules that I'm trying to run under
mod_perl. Whenever I try to run the script, it parses through and
executes the code in all of the modules and then mysteriously segfaults.
I have been trying for several hours and still cannot locate the exact
point where the segmentation fault occurs. Running the script manually
does not cause this problem, and the Perl interpreter reports no
warnings when run with `perl -w -T'.
Any help in solving this problem would be appreciated. I'm running Perl
5.00503, Apache 1.36, and mod_perl 1.19.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 16:25:56 -0400
From: Craig Ciquera <craig@mathworks.com>
Subject: Re: Mysterious segmentation fault in mod_perl
Message-Id: <376959D4.98DCAB47@mathworks.com>
What platform is all of this taking place on and what is the exact error
message
that you receive.
NOTE: I know that you cannot run Apache, mod_perl and the ActiveState Perl
and expect it to work. In this case you would need to get Perl from the
Apache web site.
Craig
hovinen@my-deja.com wrote:
> Hello
>
> I have a script and a bunch of modules that I'm trying to run under
> mod_perl. Whenever I try to run the script, it parses through and
> executes the code in all of the modules and then mysteriously segfaults.
> I have been trying for several hours and still cannot locate the exact
> point where the segmentation fault occurs. Running the script manually
> does not cause this problem, and the Perl interpreter reports no
> warnings when run with `perl -w -T'.
>
> Any help in solving this problem would be appreciated. I'm running Perl
> 5.00503, Apache 1.36, and mod_perl 1.19.
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 13:50:05 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Mysterious segmentation fault in mod_perl
Message-Id: <Pine.GSO.4.02A.9906171344220.13900-100000@user2.teleport.com>
On Thu, 17 Jun 1999 hovinen@my-deja.com wrote:
> Whenever I try to run the script, it parses through and executes the
> code in all of the modules and then mysteriously segfaults. I have
> been trying for several hours and still cannot locate the exact point
> where the segmentation fault occurs.
If you can use gdb or a similar debugger to examine a core file, it should
become clear what it is (at a low level) which is causing the segfault.
The low-level cause may be somewhat removed from your Perl code, though.
It may help to build a perl binary with -DDEBUGGING (and perhaps also the
other tools offer this type of option). Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 17 Jun 1999 19:07:17 GMT
From: Celeste Gaines <revjack@radix.net>
Subject: Re: Neet Perl Obfucation Program
Message-Id: <7kbh15$m50$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Harry P Bloomberg explains it all:
: I need to be able to deliver some code written in Perl and I want
:to make it very difficult for unauthrorized personnel to read.
If you want to protect something, put it in a protected place.
------------------------------
Date: 17 Jun 1999 19:11:59 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Neet Perl Obfucation Program
Message-Id: <7kbh9v$9tr$1@info2.uah.edu>
In article <7kbg1t$kb9$1@usenet01.srv.cis.pitt.edu>,
hpb+@pitt.edu (Harry P Bloomberg) writes:
: I need to be able to deliver some code written in Perl and I want
: to make it very difficult for unauthrorized personnel to read.
Write it in INTERCAL.
Greg
--
Sam: What'd you like, Normie?
Norm: A reason to live. Gimmie another beer.
------------------------------
Date: Thu, 17 Jun 1999 14:53:44 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: Neet Perl Obfucation Program
Message-Id: <37694438.EB756DBB@xli.com>
Harry P Bloomberg wrote:
> I need to be able to deliver some code written in Perl and I want
> to make it very difficult for unauthrorized personnel to read.
get a good lawyer to write you a good license and forget about it.
Greg
------------------------------
Date: 17 Jun 1999 20:44:09 GMT
From: jeromeo@atrieva.com (Jerome O'Neil)
Subject: Re: Neet Perl Obfucation Program
Message-Id: <7kbmmp$b4n$1@brokaw.wa.com>
In article <7kbg1t$kb9$1@usenet01.srv.cis.pitt.edu>,
hpb+@pitt.edu (Harry P Bloomberg) writes:
> So, could someone please point me towards a Perl obfucation program,
> free or commercial?
vi -x mycode.pl
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Thu, 17 Jun 1999 18:22:24 GMT
From: hojo <hojo@i-tel.com>
Subject: Re: Newbie Array Question
Message-Id: <7kbecj$qhb$1@nnrp1.deja.com>
In article <7kb93i$gq7@catapult.gatech.edu>,
Franklin Edward Sadler <gte482i@prism.gatech.edu> wrote:
> Is there any way to declare the size of an array in PERL without
having to
> put anything into it yet? For ex..
simply scop it as such:
my @array = (0..3) #for empty array length 4 (0,1,2,3)
Remember though, with perl this array is dynamic so you can increase the
size at any given time!
--
=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 13:18:19 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newbie Array Question
Message-Id: <Pine.GSO.4.02A.9906171317210.13900-100000@user2.teleport.com>
On Thu, 17 Jun 1999, hojo wrote:
> my @array = (0..3) #for empty array length 4 (0,1,2,3)
In what sense is this array empty? (Although I'm not sure that any array
with length four can really be said to be empty....)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 17 Jun 1999 14:36:26 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: newbie learning "my" declarations
Message-Id: <B38EB86A96684119F6@204.112.166.88>
In article <376a9027.2971003@news.skynet.be>,
bart.lateur@skynet.be (Bart Lateur) wrote:
>Lee wrote:
>
>>It's nasty when your script breaks because you change $me++ to $me += 2.
>
>It doesn't break. "+=" is warning immune if the target is undef, just
>the same as with "++".
Hmmmm. So it is. But I have had scripts break (warning + CGI = broken, when
done badly), so I suppose I must publicly confess to having had the supreme
bad taste to write $me = $me + 2; in a poorly designed CGI script or two.
Lee
------------------------------
Date: 17 Jun 1999 19:52:29 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: odd autoincrement behavior ?
Message-Id: <7kbjlt$7oa$1@fcnews.fc.hp.com>
Allan M. Due (Allan@due.net) wrote:
<weirdness with ++ snipped>
This can be explained all rather simply:
the order of evaluation in perl expressions is undefined, except
the documented cases (?: , and or && ||)
That said, most of the time it does it the way you expect it to, and
generally starting from the precedence "direction" (see perlop). The
big gotcha is that things that return lvalues can return a reference
to the variable rather than the value of the variable, which only
evaluate to the value of the variable when next read. A simple example
is that:
print @a=(++$a,++$a,++$a),@b=(++$a,++$a)
prints 33355. AFAIK, operators that can return lvalues are:
terms (except most sub calls) and some list operators (like substr)
->
prefix ++ and --
unary +
some named unary operators (like pos)
?: (if both parts lvalues)
= and friends
, (if building a list of lvalues)
Andrew
------------------------------
Date: 17 Jun 1999 14:54:41 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perl on-line
Message-Id: <37696091@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, "Leonid Goltser" <leonid76@erols.com> writes:
:I want to try to run perl scripts (with cgi) on-line
Um, how could you run them *off-line*? Simulate Perl on pencil
and paper, or something?
--tom
--
If you get all your information from local TV news, you end up knowing less
than if you just stayed home on the couch and drank gin from the bottle.
-- Garrison Keillor
------------------------------
Date: Thu, 17 Jun 1999 18:07:37 GMT
From: j_a_p@my-deja.com
Subject: premature end of script headers
Message-Id: <7kbdh0$q5o$1@nnrp1.deja.com>
I wrote two simple programs using perl and cgi.
The first is a simple counter that is called
using SSI. The program works from the command
line perfectly. However when run from the page
where the SSI is located nothing appears. After
checking the error log it says that there is a
premature end of script headers. Another program
is a guest log book. After writing the script is
typed $perl -c form.cgi and the response was
syntax ok. When trying to run this off of the
web site an Internal Server Error was given.
Again I checked the error log and an premature
end of script headers was given. Does anyone
know why.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Thu, 17 Jun 1999 12:48:50 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: premature end of script headers
Message-Id: <Pine.GSO.4.02A.9906171248370.13900-100000@user2.teleport.com>
On Thu, 17 Jun 1999 j_a_p@my-deja.com wrote:
> Subject: premature end of script headers
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 17 Jun 1999 19:17:32 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: qr// doesn't save my day!
Message-Id: <37694975.448023@news.skynet.be>
Tom Phoenix wrote:
>Someone has misinformed you that qr// precompiles a pattern to make it
>faster, or something of the sort.
That someone may well be TomC, whoe, even this week, wrote in this
newsgroup that "You don't need eval to compile /$pattern/ because now
you have qr//" (typed from memory).
Bart.
------------------------------
Date: 17 Jun 1999 14:56:05 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Signature removal regex?
Message-Id: <376960e5@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
Here's what I do:
#!/usr/local/bin/perl -w
#
# cfoq: check for overquoted by tchrist@mox.perl.com
# (wants perl 5.0 or better; developed under 5.002)
#
# INPUT: a news article
# OUTPUT: if -v, then shows how much it found and where
#
# OPTIONS: -v for verbose flag
# -t NN to change tolerance percentage from 50%
# -m for minimum lines that get subject to percentage counting;
# otherwise, it just checks for ANY new lines. This way
# short little 6-line messages with 4 lines of quoting don't
# get hassled
#
# EXIT: 2 (bad failure) if no new lines
# 1 (failure) if tolerance exceeded
# 0 (success) otherwise
# 5.0 might work, but I developed it under 5.002
require 5.002;
use strict;
use vars qw{
$MINLINES $opt_m
$VERBOSE $opt_v
$TOLERANCE $opt_t
};
use Getopt::Std;
getopts("vt:m:") || die "usage: $0 [-v] [-t tolerance] [-m minlines] [input_file]\n";
my (
$total, # total number of lines, minus sig and attribution
$quoted_lines, # how many lines were quoted
$percent, # what percentage this in
$pcount, # how many in this paragraph were counted
$match_part, # holding space for current match
$gotsig, # is this the sig paragraph?
);
$total = $quoted_lines = $pcount = $percent = 0;
$MINLINES = $opt_m || 20;
$VERBOSE = $opt_v;
$TOLERANCE = $opt_t || 50;
$/ = ''; # set record reading to paragraph mode
<ARGV>; # consume and discard header of message
while (<ARGV>) {
# strip sig line, remember we found it
$gotsig = s/^-- \n.*//ms;
# strip attribution, possibly multiline
if ($. == 2) { s/\A.*?(<.*?>|\@).*?:\n//s }
# toss trailing blank lines into one single line
s/\n+\Z/\n/;
# now reduce miswrapped lines from idiotic broken PC newsreaders
# into what they should have been
s/(>.*)\n\s*([a-zA-Z])/$1 $2/g;
# count lines in this paragraph
$total++ while /^./mg;
# is it a single line, quoted in the customary fashion?
if ( /^(>+).*\n\Z/ ) {
$quoted_lines++;
print " 1 line quoted with $1\n" if $VERBOSE;
next;
}
# otherwise, it's a multiline block, which may be quoted
# with any leading repeated string that's neither alphanumeric
# nor string
while (/^(([^\w\s]+).*\n)(\2.*\n)+/mg) { # YANETUT
$quoted_lines += $pcount = ($match_part = $&) =~ tr/\n//;
printf "%2d lines quoted with $2\n", $pcount if $VERBOSE;
}
last if $gotsig;
}
$percent = int($quoted_lines / $total * 100);
print "$quoted_lines lines quoted out of $total: $percent%\n"
if $VERBOSE;
if ($total == $quoted_lines) {
print "All $total lines were quoted lines!\n" if $VERBOSE;
exit(2);
}
if ($percent > $TOLERANCE) {
if ($total < $MINLINES) {
print "but since $total is less than $MINLINES lines, that's ok\n"
if $VERBOSE;
exit 0;
} else {
exit 1;
}
} else {
exit 0;
}
--
"The reasonable man conforms himself to his environment. The
unreasonable man conforms his environment to himself. Therefore
all change depends on the unreasonable man."
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6035
**************************************