[10568] in Perl-Users-Digest
Perl-Users Digest, Issue: 4160 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 5 14:07:44 1998
Date: Thu, 5 Nov 98 11:00:19 -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, 5 Nov 1998 Volume: 8 Number: 4160
Today's topics:
ActiveState vs. Perl? <topper@virginia.edu>
Changing @INC <gbc1@axe.humboldt.edu>
Re: delete a file under win95 (!) (ms)
Re: Help on $^0... <rwilliamson@uno.gers.com>
Re: HELP: perl script fails on setuid binary <rootbeer@teleport.com>
Re: HELP: perl script fails on setuid binary (Robert S. Campbell)
Re: HELP: perl script fails on setuid binary <rootbeer@teleport.com>
Re: How does a function know if its being called inside (M.J.T. Guy)
Re: How to make Python's marshal module available in Pe (Jon Drukman)
Re: indenting perl elsif clauses in emacs <barnett@houston.Geco-Prakla.slb.com>
Re: Internal Server Error latsharj@my-dejanews.com
LONG Re: Heterogeneous Data Structures: possible? If s <d-edwards@nospam.uchicago.edu>
Re: Not to start a language war but.. <rgh@inmet.com>
Re: Perl at Webjump - lonely perler! <jdporter@min.net>
Re: perl questions PLEASE HELP ASAP! <jdporter@min.net>
Re: perl&cgi question <jdw@dev.tivoli.com>
perl/split() question. <tim@iuinc.com>
Problem compiling perl 5.004_04 with gcc 2.8.1 <ncmoura@net.mailcom.pt>
Processing form <flanker@sonnet.ru>
Re: Processing form <rootbeer@teleport.com>
Re: Recovering from aborted script <kmattson@qualcomm.com>
Re: reg. expr question. (Patrick Timmins)
Re: reg. expr question. (clay irving)
Re: seperating paragraphs (kind of like $/) rhaig@news.hackboy.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 05 Nov 1998 12:52:30 -0500
From: "David J. Topper" <topper@virginia.edu>
Subject: ActiveState vs. Perl?
Message-Id: <3641E5DE.77591E08@virginia.edu>
Hello,
I downloaded a version of Perl from CPAN last week. I just installed it
on my NT server and can't for the life of me get the darn thing to run
perl scripts through my MS web server. I've configured the registry the
same way it used to be configured for ActiveState. But it does not
work.
None of the docs offer input on this. Lame. I'd be up and running in 5
minutes on one of my Unix boxes.
Anyone have some tips here? My boss won't let me use Apache on a Unix
box yet for stuff he wants to do. Must use Access. Blech!
The real issue here is of course using the ODBC drivers for Perl under
NT.
I'd really appreciate some help. Email responses preferred.
Thanks,
Dave Topper
--
David Topper
Technical Director - Virginia Center for Computer Music
Programmer Analyst - School of Arts and Sciences
http://www.panix.com/~topper
(804) 924-6887
------------------------------
Date: Thu, 05 Nov 1998 10:40:26 -0800
From: Greg Coit <gbc1@axe.humboldt.edu>
Subject: Changing @INC
Message-Id: <3641F11A.739FEE9F@axe.humboldt.edu>
We just installed perl 5.005_2 and our scripts return the following
error when we use any Modules:
Can't locate LWP/Simple.pm in @INC
(@INC contains:
/usr/local/lib/perl5/5.00502/alpha-dec_osf
/usr/local/lib/perl5/5.00502
/usr/local/lib/perl5/site_perl/5.005/alpha-dec_osf
/usr/local/lib/perl5/site_perl/5.005 .)
The correct directory is: /usr/local/lib/perl5/site_perl
Is there anyway to change the @INC globally? (ie. without altering all
of our scipts). Or should we:
1) Reinstall and provide the correct paths during installation
2) Rearrange our directories to match the current @INC
3) #2 then #1
Thanks for your help.
--
Scott Kelley
jsk2@axe.humboldt.edu
Help Desk
Information Technology Resource Center
Humboldt State University
www.humboldt.edu/~help
help@axe.humboldt.edu
826-HELP (4357)
------------------------------
Date: Thu, 5 Nov 1998 10:40:33 -0800
From: "Ron Aaron (ms)" <"REDMOND\\v-ronaar"@microsoft.com>
Subject: Re: delete a file under win95 (!)
Message-Id: <Pine.WNT.4.05.9811051038570.145-100000@v-ronaar2.dns.microsoft.com>
On Tue, 3 Nov 1998, Avshi Avital wrote:
> what could be more simple then that?!
> well, i tried:
>
> unlink 'file_name'
> system('del file_name');
>
> and even:
>
> exec('del file_name');
>
> but the file stays. so what's the trick?
Avshalom,
Is the file 'read-only' or 'hidden'? Try running "attrib file_name"
to see what attributes are set.
Then you could, e.g.:
system ("attrib -rh $file_name");
Kol tuv,
Ron
> thanx,
> --
> Avshalom Avital
> Information Retrieval Laboratory
> Bar-Ilan University, Israel
> avitala@macs.biu.ac.il
>
>
>
>
>
--
Ron Aaron Moss Bay Engineering
Precision Crafted Software
http://www.mossbayeng.com/~ron
------------------------------
Date: Thu, 5 Nov 1998 10:33:04 -0800
From: "Rusty Williamson" <rwilliamson@uno.gers.com>
Subject: Re: Help on $^0...
Message-Id: <g9m02.98$DA6.20636@news.connectnet.com>
Hi Tom!
>with the fact that zero is not the letter O. Hope this helps!
Dah! Yes that's the problem.
Thanks!
------------------------------
Date: Thu, 05 Nov 1998 18:01:34 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <Pine.GSO.4.02A.9811051000410.3759-100000@user2.teleport.com>
On 5 Nov 1998, Robert S. Campbell wrote:
> Insecure dependency in piped open while running setuid at
> /usr/local/bin/k1580 line 207.
Have you seen what perldiag says about this message? See also perlsec.
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 5 Nov 1998 18:40:43 GMT
From: rsc@snipe.scd.ucar.edu (Robert S. Campbell)
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <71srfb$gbl$1@ncar.ucar.edu>
Apparently I was concentrating on the wrong thing. I had to "untaint" the
$printer variable I was passing to the setuid lp:
$safe = $printer; $safe =~ /^(.*)$/; $safe = $1;
Which worked.
Thanks for all the help everyone!
Bob Campbell
------------------------------
Date: Thu, 05 Nov 1998 18:55:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: HELP: perl script fails on setuid binary
Message-Id: <Pine.GSO.4.02A.9811051052420.3759-100000@user2.teleport.com>
On 5 Nov 1998, Robert S. Campbell wrote:
> Apparently I was concentrating on the wrong thing. I had to "untaint"
> the $printer variable I was passing to the setuid lp:
The fact that the lp program is set-id doesn't matter here...
> $safe = $printer; $safe =~ /^(.*)$/; $safe = $1;
>
> Which worked.
...But this matters. Did you know that you're implicitly promising Perl
that that pattern will match only truly safe names for printers? Please,
don't use this code to extract untainted data; write a correct pattern.
Otherwise, you're throwing away Perl's ability to use taint checking to
keep you safe. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 5 Nov 1998 18:11:55 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How does a function know if its being called inside eval {} ?
Message-Id: <71sppb$8h5$1@pegasus.csx.cam.ac.uk>
In article <71on4u$itd$1@nnrp1.dejanews.com>, <mlehmann@prismnet.com> wrote:
>I would like to use exceptions in my constructors, but only if my
>constructors are inside an eval. The die command seems to know if it is
>inside and eval and does different actions depending on its context. I
>basically want to do the same thing, but I do not see how die is doing this.
>Writing a C extension is essentially not an option, so I hope that this
>context sensing can be done with perl, not XS or internal guts, code.
See the $^S variable in perlvar.
Note that this variable is only available in perl5.004_04 and later.
Mike Guy
------------------------------
Date: 5 Nov 1998 17:54:02 GMT
From: jsd@hudsucker.gamespot.com (Jon Drukman)
Subject: Re: How to make Python's marshal module available in Perl?
Message-Id: <slrn743pom.n2b.jsd@hudsucker.gamespot.com>
In article <71qcqe$nn1$1@nnrp1.dejanews.com>, skip@calendar.com wrote:
>I would like to make the functionality of Python's marshal module availble in
>Perl. The most straightforward way (to me) would be to modify the existing
>marshal.c file to marshal and unmarshal the desired objects. Short-term I
>only need the basics: lists, tuples, strings, ints, floats and dictionaries.
>That stuff should all map between Python and Perl fairly well (equating
>tuples and lists for the time being, and assuming dictionaries only have
>strings as keys). I'm going to ignore more advanced functionality for now
>(perhaps indefinitely).
this may be way more complexity than you want, but you could investigate
ILU (ftp://ftp.parc.xerox.com/pub/ilu/ilu.html) or COPE (CORBA Perl).
they are a lot more work but in the end you will be able to share
objects between and call functions from multiple languages. i was
frankly amazed when i was able to get hashes of lists of lists
generated from python into my perl programs on the fly. spooky!
if you just want to hack it, you could use perl's Data::Dumper to
get a text representation of your perl structures and somehow
convince python to import them (you'd need to write a python
program that can parse Dumper's output and generate the proper
python data structures from it.)
--
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Fear the government that fears your computer.
------------------------------
Date: Thu, 05 Nov 1998 12:48:57 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: indenting perl elsif clauses in emacs
Message-Id: <3641F319.13602F34@houston.Geco-Prakla.slb.com>
tbhanson@startribune.com wrote:
>
> Hmmm, can anyone explain how to get emacs in perl mode to indent elsif clauses
> like this:
>
> if (x) {
> a;
> } elsif (y) {
> b;
> } else {
> c;
> }
>
<snip>
>
> --Tim Hanson
>
> p.s. I tried asking this in an emacs group, but got no bites.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Perhaps you have a broken version of emacs? Perhaps you missed a
semi-colon or other end-block character?
I've gotten similar 'bizarre' results in the past, but only when I've
left off an end-block character.
I'm using solaris 2.5.1, with emacs:
XEmacs 20.0 [Lucid] (sparc-sun-solaris2.4) of Mon Oct 14 1996 on etude
HTH.
Dave
--
Dave Barnett Software Support Engineer (281) 596-1434
If you ate pasta, and antipasta, would you still be hungry?
------------------------------
Date: Thu, 05 Nov 1998 18:07:38 GMT
From: latsharj@my-dejanews.com
Subject: Re: Internal Server Error
Message-Id: <71spha$rha$1@nnrp1.dejanews.com>
In article <01be086d$0c8bd260$025b9cd1@pip-squeek>,
"AL WILLEN" <WILLEN@prodigy.net> wrote:
> As of last Friday, all the PERL programs I've written have generated an
> "Internal Server Error" message being thrown back at me when the script is
> evoked.
>
> I received a cryptic message from a friend of a friend of a friend who says
> (and I quote): "Al has run into the age old dos carriage return problem
> .. he needs to fix_cr the perl files before they will run properly."
>
What happens when you run it from the command line? What does it say in the
server error log? Did you ftp the files over in ASCII mode? or run dos2unix
(or one of its friends) on them?
--
Regards,
Dick
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 5 Nov 1998 18:43:29 GMT
From: Darrin Edwards <d-edwards@nospam.uchicago.edu>
Subject: LONG Re: Heterogeneous Data Structures: possible? If so, how?
Message-Id: <tg7lxa0ylq.fsf@noise.bsd.uchicago.edu>
Charles Roten <croten@bigger.aa.net> writes:
> I want to do something more than a little odd ... I want to build a
> structure $DataStructure such that sometimes
>
> $DataStructure->[$index]->{$key}
>
> refers to a scalar/string, and sometimes to a named hash or array.
"WHWYTI?" :)
Seriously though, it took me quite a bit of experimentation
before I felt at all comfortable with structures like this.
The good news is that IMO the syntax is consistent enough that
once you get the hang of it, you'll be able to make your structures
as deeply nested and as complicated as you want (need).
> As in (string case)
>
> $FireWall_Rule->[7]->{"install"}->"firewall_box"
I'm not quite sure what you mean here, but from what you
said above I think you have in mind something like
$FireWall_Rule->[7]->{"install"} = "firewall_box";
In other words "install" is the key to your hash, and you
want the string on the right to be the value, is that the
idea? (If not the rest of my post will be garbage, and I
apologize for the misunderstanding...)
When I was taking Mandarin in college, one of the teachers
told us once that if we had a lot of trouble parsing a
sentence, sometimes it would help to try "reading the
sentence backwards" -- not that Mandarin word order is that
different from English, just that sometimes the ideas are
"laid out" differently than we'd be expecting. I've found
that advice has helped me a lot with perl, especially with
reference syntax. :)
So if you "suppress" thinking about the fact that $FWR->[7]
is a reference, pointing to a hash, then the above syntax is
seen to be simply a hash insertion:
$hashname{"install"} = "firewall_box";
> but (array case)
>
> $FireWall_Rule->[7]->{"services"}->[0]->"telnet"
> $FireWall_Rule->[7]->{"services"}->[1]->"login"
> $FireWall_Rule->[7]->{"services"}->[2]->"echo-request"
Again, I guess that instead of those last arrows, you just
meant assignment to the array @{$FWR->[7]->{"services"}}...
Three ways to do that, direct assignment like you have above
(changing final "->"'s to "="), or all at once:
@{$FWR->[7]->{"services"}} = qw(telnet login ech-request);
or
$FWR->[7]->{"services"} = [qw(telnet login ech-request)];
(The [] makes a reference to an array directly.)
If you have an array @service_stuff already made, you can of
course just say
$FWR->[7]->{"services"} = \@service_stuff; #the \ makes a ref...
Again, the syntax is identical to
$hashname{"services"} = $arrayref;
> and (hash case)
>
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"type"}->"accept"
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"color"}->"Dark green"
> $FireWall_Rule->[7]->{"action"}->{"accept"}->{"icon-name"}->"icon-accept"
>
> etc. All in the _same_ $FireWall_Rule structure.
Very similar to arrays; either direct assignment (last "->" become
"=" as above), or by list initialization of a hash:
%{$FWR->[7]->{"action"}->{"accept"}} = (type => "accept",
color => "Dark green",
icon_name => "icon-accept");
or same thing with (anonymous) reference:
$FWR->[7]->{"action"}->{"accept"} = {type => "accept",
color => "Dark green",
icon_name => "icon-accept"};
(Note the curlies, and I changed "icon-name" to icon_name so I wouldn't
have to quote it.)
If you have a hash like %accept_stuff already made, you can do
$FWR->[7]->{"action"}->{"accept"} = \%accept_stuff;
This syntax is all indentical (in some form :)) to
$hashname{"accept"} = $other_hashref;
(I assume you meant to have the "action" key be "one level deeper"
than the others, i.e. pointing to a hash ref which itself contains
a key "accept" pointing to another hash...)
> Srinivasan's "Advanced Perl Programming" lies open on my desk as I
> write this. I have seen no mention of such a complex structure in
> this work, nor in the "Perl Cookbook".
Hmm... maybe reread Chapter 11 of the Cookbook; in particular
take a look at recipe 11.9 again, "Constructing records."
Granted it's not as many levels deep as you are asking here,
but that's the beauty of perl, and the power of its data structures:
just about _anywhere_ you can put an lvalue (e.g. the contents of a scalar,
or a value in an array or hash), you can put a reference to anything
else. You can have an array or a hash, some of the values of which
are simple scalars, some array references, some hash references,
even some _code_ references (and those referred-to subroutines could
themselves return references to hashes, or arrays of references, or
whatever the heck you want...), or best of all, references to
_references_ to other things.
Some people seem to hate this because 1) there aren't very
complicated builtin structures, you have to cook everything up
yourself from scalars, arrays, and hashes; and 2) they don't
like the syntax, "too many @&$->{}[]()!!! whassit mean!!!"
I love it though, because any weird thing I can think up, I
1) have the tools to build it with and 2) can figure out how to
describe it to perl. (When I first started learning reference
syntax, I was shocked and frightened at how consistently perl
would "do what I wanted" when I didn't myself yet understand
the syntax of what I was typing. Course, by then I had been
using perl for half a year, and was already adjusted to the
fact that perl is much smarter than I am.)
> Is such a thing practical?
Do you mean "able to be coded"? Sure! :) "Comment early, and
comment often" will prevent complaints of nonreadability.
Do you mean, "worth doing given the problem I'm trying to solve?"
I don't know, but I hope so...
> Can some kind soul point me to any
> examples of this sort of thing, or any other documentation besides
> Srinivasan ? Are there any "gotchas" I should be aware of ?
Well, I said just above that a hash value can be a reference...
what about a key? Problem is, a hash key gets stringified, which
destroys its reference information. So if you said $hash{$myref},
then keys(%hash) won't give you back references, just the strings
they were made into. Sometimes that's good enough, when you
just need a bunch of unique keys to pass around without worrying
about the data they pointed to (you've got that stored somewhere
else, say), but if you _did_ need that data, you'd need to do
something else.
Not "gotchas," but other points: you can usually omit the ""s
around your _keys_, because of this stringification; and you
can omit ->'s between _indexes and keys_ (i.e. subscripts).
So the last example above could also be written
$FWR->[7]{action}{accept} = \%accept_stuff;
See perlref for more examples.
Hope this was helpful,
Darrin
------------------------------
Date: Thu, 5 Nov 1998 18:42:23 GMT
From: Randy Hudson <rgh@inmet.com>
Subject: Re: Not to start a language war but..
Message-Id: <3641F18F.6F8F5362@inmet.com>
Martijn Faassen wrote:
> I haven't used Netscape until recently, but it seems to be possible to
> do
> a right click in windows, and then it has an option 'ignore thread' (key
> K). Looks like it has killfiles now (in 4.5.).
Thanks for pointing this out. It's in my version of Navigator also (4.0.4).
-- Randy Hudson rgh@inmet.com
------------------------------
Date: Thu, 05 Nov 1998 13:40:34 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Perl at Webjump - lonely perler!
Message-Id: <3641F122.B4FB595B@min.net>
The Tinman wrote:
>
> I have a perl script that looks up a keyword in a file and returns and
> relevant answers. Easy right? Thats what I thought. I've posted the script
> below. It works in MacPerl but I cannot get it to work on Webjump's NT
> system. If anyone has the time (and has maybe used Webjump) I would
> appreciate someone's help in solving this mystery.
Any particular reason you're not using CGI.pm? Masochistic, perhaps?
Have you tested this program with -w? Maybe you should try to use
strict -- it teaches good programming habits which can avoid many bugs.
> print "Content-type: text/html\n\n";
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}." ".$value; }
> else { $INPUT{$name} = $value; }
> }
Ack. You really ought to consider using CGI.pm.
> open (STORIES,"$data_file") || die "can't open data file";
> @stories = <STORIES>;
> close (STORIES);
You read the entire stories file into memory?
Not for any good reason that I can see.
> foreach $line (@stories) {
> ($cats,$story) = split(/\|/, $line);
You ought to be using the third argument of split, in this case 2.
> if ($cats =~/$search/) {
Are you expecting $search to be a Perl regular expression?
If not, you want to quote the meta chars, like so:
if ( $cats =~ /\Q$search\E/ ) {
> push (@matches,$line);
> }
> }
Since you split the line again later, when making the table, you may
as well save yourself a little effort, and push a cats/story tuple
onto @matches, instead:
push @matches, [ $cats, $story ];
> print ("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 3.2//EN\">\n");
> print ("<HTML>\n");
> print ("<HEAD>\n");
> print ("\n");
> print ("<TITLE>Jack Measham's Funny Stories for Fine-tuned Sermons</TITLE>\n");
> print ("</HEAD>\n");
> print ("<BODY bgcolor=\"#FFE000\" background=\"bg.gif\">\n");
I highly recomment using CGI.pm. But if you really want to print your
own HTML, you would get a readability and speed improvement like this:
print qq{
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Jack Measham's Funny Stories for Fine-tuned Sermons</TITLE>
</HEAD>
<BODY bgcolor="#FFE000" background="bg.gif">
};
bgcolor AND background, eh? What's the point?
> print ("<TABLE width=400>\n");
> foreach $match (@matches) {
> ($cats,$story) = split(/\|/, $match);
If you do as I suggested above, you avoid this split, and instead do:
($cats, $story) = @$match;
> chop ($story);
Use chomp instead of chop. It's safer; in fact this might be the
source of your stated problem.
It's also more "normal" to do it right when you're reading the lines,
rather than so much later like this.
Hope this has given you something to chew on, and maybe helps you
find your bugs.
John Porter
------------------------------
Date: Thu, 05 Nov 1998 13:25:25 -0500
From: John Porter <jdporter@min.net>
Subject: Re: perl questions PLEASE HELP ASAP!
Message-Id: <3641ED95.807B08BA@min.net>
jcl wrote:
>
> Hey everyone,
> I do not like to go to newsgroups for my programming problems, but
> this has to be done my tomorow afternoon, and i don't know what else
> to do.
Whereever did you get the idea that a newsgroup is the place to go
if you need help ASAP? Disappointment awaits...
John Porter
------------------------------
Date: 05 Nov 1998 10:55:01 -0600
From: Jim Woodgate <jdw@dev.tivoli.com>
Subject: Re: perl&cgi question
Message-Id: <obvhkuoza2.fsf@alder.dev.tivoli.com>
Kjetil Svendsberget <kjetil@balder.no> writes:
> So explain this: At first the script insisted on dowloading on all
> browsers
> on that perticular machine. (all other machines displays it)
> I then removed the .pl assosiacations within the windows-explorer
> (view->options
> ->file types). Now it suddenly works in Netscape, but IE still insist on
> downloading it.
I guess you missed my message. You are making an assumption that when
it asks you to save .../file.pl it is downloading your perl script. I
would guess that it is not. Instead what you will find is some kind
of error or message.
If it really is downloading the perl script it is a *huge* server
problem, your server should never do that.
> Im still lost here why it doesnt work on that single machine.
my guess is that you are not setting the header properly, many of the
browsers are taking the header and just displaying what comes next.
Your misconfigured browser doesn't understand the header type, so it
asks if you'd like to save the output. As a default it is using the
name of the script as the file to save this information in.
You can also use the LWP module or just telnet directly to the web
server to see what header is returned from the server...
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: Thu, 5 Nov 1998 13:56:24 -0500
From: tc lewis <tim@iuinc.com>
Subject: perl/split() question.
Message-Id: <Pine.LNX.3.96.981105135550.25537a-100000@wopr.iuinc.com>
any ideas on why:
$charnum = scalar(split(//, $dname[$#dname]));
gives me the following warning:
Use of implicit split to @_ is deprecated at ./dnsutil.pl line 439.
?
it's just a warning (perl -w), not fatal, but blah. it's annoying. =)
any ideas? if more info is needed, let me know.
thanks.
-tcl.
tim@iuinc.com
------------------------------
Date: Thu, 05 Nov 1998 18:35:58 +0100
From: Nuno Carneiro de Moura <ncmoura@net.mailcom.pt>
Subject: Problem compiling perl 5.004_04 with gcc 2.8.1
Message-Id: <3641E1FD.CDE39AD8@net.mailcom.pt>
Hi all,
I am having problems compiling perl 5.004_04 (with dynamic loading)
with gcc 2.8.1 on a HP-UX 10.20.
I'm getting Segmentation Faults when attempting to use AutoSplit during
the make process.
......
Extracting pod2man (with variable substitutions)
./miniperl -Ilib pod/pod2text.PL
Extracting pod2text (with variable substitutions)
AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/ParseWords)
sh: 25952 Memory fault(coredump)
*** Error exit code 139
Any help ?
Anyone with the same problem?
Thank you very much for the help .
Nuno Moura
SIBS.
------------
My complete output:
soft@s1(/home/soft/perl5.004_04)$ make
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a perl.o` perl.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a malloc.o` malloc.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a gv.o` gv.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a toke.o` toke.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -DARG_ZERO_IS_SCRIPT -O
`sh cflags libperl.a perly.o` perly.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a op.o` op.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a regcomp.o` regcomp.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a dump.o` dump.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a util.o` util.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a mg.o` mg.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a hv.o` hv.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a av.o` av.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a run.o` run.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a pp_hot.o` pp_hot.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a sv.o` sv.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a pp.o` pp.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a scope.o` scope.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a pp_ctl.o` pp_ctl.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a pp_sys.o` pp_sys.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a doop.o` doop.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a doio.o` doio.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a regexec.o` regexec.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a taint.o` taint.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a deb.o` deb.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a universal.o` universal.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a globals.o` globals.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
`sh cflags libperl.a perlio.o` perlio.c
CCCMD = gcc -DPERL_CORE -c -D_HPUX_SOURCE
-I/usr/local/include -O
rm -f libperl.a
ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o
regcomp.o dump.o util.o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o
pp_ctl.o pp_sys.o doop.o doio.o regexec.o taint.o deb.o universal.o
globals.o perlio.o
gcc -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lnet
-lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt
./miniperl configpm tmp
sh mv-if-diff tmp lib/Config.pm
./miniperl -Ilib pod/pod2html.PL
Extracting pod2html (with variable substitutions)
./miniperl -Ilib pod/pod2latex.PL
Extracting pod2latex (with variable substitutions)
./miniperl -Ilib pod/pod2man.PL
Extracting pod2man (with variable substitutions)
./miniperl -Ilib pod/pod2text.PL
Extracting pod2text (with variable substitutions)
AutoSplitting perl library
AutoSplitting Text::ParseWords (lib/auto/Text/ParseWords)
sh: 25952 Memory fault(coredump)
*** Error exit code 139
Stop.
------------------------------
Date: Thu, 5 Nov 1998 21:28:16 +0300
From: "Michael Yevdokimov" <flanker@sonnet.ru>
Subject: Processing form
Message-Id: <71sqen$4t0$1@bison.rosnet.ru>
Hi
How to extract information from HTML fields into different varables?
I have 'email', 'subject', 'message' fields in HTML form and I'd like to
save info from 'email' into email var, 'message' into msg var, and 'subject'
into subj.
Please help me.
Thanks forward.
Michael
------------------------------
Date: Thu, 05 Nov 1998 18:27:20 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Processing form
Message-Id: <Pine.GSO.4.02A.9811051026310.3759-100000@user2.teleport.com>
On Thu, 5 Nov 1998, Michael Yevdokimov wrote:
> How to extract information from HTML fields into different varables?
It sounds as if you're writing a CGI program. Perhaps the CGI module and
its documentation would be of help to you. If not, the docs, FAQs, and
newsgroups about CGI programming should be useful. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 05 Nov 1998 10:27:58 -0800
From: Kevin Mattson <kmattson@qualcomm.com>
Subject: Re: Recovering from aborted script
Message-Id: <3641EE2E.598A@qualcomm.com>
Jonathan Stowe wrote:
>
> On Mon, 26 Oct 1998 11:43:38 -0800 Kevin Mattson <kmattson@qualcomm.com> wrote:
> > How can I detect when a user has hit CNTRL-C or CNTRL-Break while a Perl
> > script is running? I'd like to do some additional clean-up before the
> > script exits.
> >
> > I'm using ActiveState's ActivePerl for Win32 (Build 502).
>
> You need to trap the appropriate signal which in this case is SIGINT -
>
> #!/usr/bin/perl
>
> BEGIN {
> $SIG{INT} = sub { print "bye now" ; exit};
> }
>
> while()
> {
> }
>
> Works as expected on my system. You would probably want to reset the handler
> once you have trapped your first INT lest an impatient user should hit Ctrl-C
> more than once - you should also check out the Caveats on this subject in
> the Perl documentation.
>
> /J\
>
> --
> Jonathan Stowe <jns@btinternet.com>
> Some of your questions answered:
> <URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Thanks for your help, but I tried your above code and SIGINT just
doesn't seem to work on my NT system. Has anyone else been able to use
SIGINT with ActiveState's Build 502 on NT? I also liked your tip about
resetting the handler, since users rarely hit cntrl-c only once (myself
included).
Thanks,
Kevin Mattson
------------------------------
Date: Thu, 05 Nov 1998 18:27:16 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: reg. expr question.
Message-Id: <71sqm3$tbt$1@nnrp1.dejanews.com>
In article <71scoc$p3k$1@info.uah.edu>,
Greg Bacon <gbacon@cs.uah.edu> wrote:
> In article <3641AF5A.90716D05@balder.no>,
> Kjetil Svendsberget <kjetil@balder.no> writes:
> : i have a string which looks like one these:
> : a. $dest_dir = 'f:'
> : b. $dest_dir = 'f:\'
> : c. $dest_dir = 'f:\a
> : d. $dest_dir = 'f:\a\
> : e. $dest_dir = 'f:\a\b\c\d';
> : f. $dest_dir = 'f:\a\b\c\d\';
> :
> : what i want to get hold of is this:
> : a: gives nothing
> : b: gives nothing
> : c: gives 'a'
> : d: gives 'a'
> : e: gives 'd'
> : f: gives 'd'
>
> #! /usr/bin/perl -w
>
> for (qw( f: f:\ f:\a f:\a\ f:\a\b\c\d f:\a\b\c\d\ )) {
> next unless /^f:\\ # must have leading f:\
> [\w\\]* # skip all backslashes and alphanum
> (\w+) # save the last run of alphanums
> \\* # followed by any number of backslashes
> $/x;
>
> print "$_: `$1'\n";
> }
This won't do what (I think) he wants in the real world ... assuming
he uses directories that have names longer than one character.
f:\a\doggy
f:\a\doggy\
will both give 'y', when 'doggy' is probably what's wanted.
In this case, use something like /^f:.*\\([^\\]+)\\?$/ for the
regex.
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 5 Nov 1998 13:52:16 -0500
From: clay@panix.com (clay irving)
Subject: Re: reg. expr question.
Message-Id: <71ss50$786@panix.com>
In <3641AF5A.90716D05@balder.no> Kjetil Svendsberget <kjetil@balder.no> writes:
>i have a string which looks like one these:
>a. $dest_dir = 'f:'
>b. $dest_dir = 'f:\'
>c. $dest_dir = 'f:\a
>d. $dest_dir = 'f:\a\
>e. $dest_dir = 'f:\a\b\c\d';
>f. $dest_dir = 'f:\a\b\c\d\';
>what i want to get hold of is this:
>a: gives nothing
>b: gives nothing
>c: gives 'a'
>d: gives 'a'
>e: gives 'd'
>f: gives 'd'
>any suggestions?
Yes. Use File::Basename -- It is included in the base Perl distribution.
NAME
fileparse - split a pathname into pieces
basename - extract just the filename from a path
dirname - extract just the directory from a path
SYNOPSIS
use File::Basename;
($name,$path,$suffix) = fileparse($fullname,@suffixlist)
fileparse_set_fstype($os_string);
$basename = basename($fullname,@suffixlist);
$dirname = dirname($fullname);
($name,$path,$suffix) = fileparse("lib/File/Basename.pm","\.pm");
fileparse_set_fstype("VMS");
$basename = basename("lib/File/Basename.pm",".pm");
$dirname = dirname("lib/File/Basename.pm");
--
Clay Irving
clay@panix.com
------------------------------
Date: 5 Nov 1998 11:41:05 -0600
From: rhaig@news.hackboy.com
Subject: Re: seperating paragraphs (kind of like $/)
Message-Id: <71snvh$are$1@cartman.hackboy.com>
In article <Pine.GSO.3.96.981104131913.20872B-100000@pdxue150.cadence.com>,
Colin Kuskie <ckuskie@cadence.com> wrote:
>
><Also emailed to rhaig>
>
>On 4 Nov 1998 rhaig@news.hackboy.com wrote:
>
>> ok, here is the format of the input I'll be dealing with:
>> ================
>> user1:
>> attr1=val1
>> attr2=val2
>> attr3=val3
>> user2:
>> attr1=val1
>> attr2=val2
>> attr3=val3
>> ================
>>
>> what I really want is 2 records with the user at the top of each set
>> of attributes (yes, I'm dealing with AIX if you haven't guessed it by now)
>
>I'm not sure that playing with $/ is going to help you much. I think
>you have a few options:
>
>1)If each user record is guaranteed to have the same number of lines
>then just read that many lines:
that would make life simple. I don't know how many lines each user will have
>2) If the number of lines is variable then you could try:
>
> undef $/;
> $_ = <>;
> s/\nuser/\n\nuser/sg; ##Insert a token between the records
> @data = split /\n\n/, $_;##Split on the token.
that would work nicely if users were all user\d.
I'll vary this however & try
undef $/;
$_ = <>;
$token="something I'll be able to split on";
#probably '::' or something that
# won't be in the input
s/\n(\w+:)/\n$token$1/sg;
>
>2a) Or, slightly differently:
>
> undef $/;
> $_ = <>;
> ($empty_record, %hash) = split /(user\d+:)/;
> ##Using parens in a split causes split to return the delimiters, too!
> ##You now have the user records available in a hash!
> ##Use "keys" to iterate over the different key/value pairs.
now this, combined with my mods listed above could be really cool.
I'll have to investigate this.
thanks
I'll owe you a beer.
--
Rob
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4160
**************************************