[11972] in Perl-Users-Digest
Perl-Users Digest, Issue: 5572 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 5 15:07:15 1999
Date: Wed, 5 May 99 12:00:21 -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 Wed, 5 May 1999 Volume: 8 Number: 5572
Today's topics:
Re: "learning perl" does not seem to be written well (Ben Coleman)
Re: "learning perl" does not seem to be written well (Chris Nandor)
Re: "Safe" recursive delete? (I R A Aggie)
Re: Dumb Question <cassell@mail.cor.epa.gov>
Re: Generating method call from a string (Andrew Allen)
Re: Generating method call from a string (Greg Bacon)
Re: installing APi507e.exe on Win 95 (Brian Jepson)
Is evaluation of printf operands left-to-right? <Wm.Blasius@ks.sel.alcatel.de>
Re: Is there a way how to turn a PERL program into ane <cassell@mail.cor.epa.gov>
killing processes invoked by Threads via system() or ex <otis@my-dejanews.com>
OReilly bullshit.... Camel logo trademark <mkruse@rens.com>
Re: OReilly bullshit.... Camel logo trademark <tchrist@mox.perl.com>
Re: OReilly bullshit.... Camel logo trademark <design@raincloud-studios.com>
Re: OReilly bullshit.... Camel logo trademark <mkruse@rens.com>
Re: OReilly bullshit.... Camel logo trademark (brian d foy)
Re: OReilly bullshit.... Camel logo trademark (Greg Bacon)
Re: OReilly bullshit.... Camel logo trademark <dgris@moiraine.dimensional.com>
Re: OReilly bullshit.... Camel logo trademark (Chris Nandor)
Re: OReilly bullshit.... Camel logo trademark <design@raincloud-studios.com>
Re: Pattern Matching and parsing <aqumsieh@matrox.com>
Perl on NT workstation with PWS <jphillips@va.campuscwix.net>
Please Help <scoleri@rad.upenn.edu>
Re: Please Help <design@raincloud-studios.com>
Re: Please Help <scoleri@rad.upenn.edu>
Re: Please Help <design@raincloud-studios.com>
Re: Please Help <scoleri@rad.upenn.edu>
Re: Read vs. <STDIN> (Larry Rosler)
Re: Read vs. <STDIN> <tchrist@mox.perl.com>
SOLVED - I'm new - Please help - Sorting Question <news@i-tradeonline.com>
SSI perl hit counter <mikej@1185design.com>
What is the opposite of bind() ? (Kenny McCormack)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 05 May 1999 18:24:31 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <37308cb6.5143315@news.mindspring.com>
On 5 May 1999 02:03:42 -0400, dha@panix.com (David H. Adler) wrote:
>>David {who started college as an English major...}
>
>Ha! I've got you both beat. I've got a degree in Philosophy! Ha!
Hmmm. Where does a degree in Bible fit in there? (albeit I did have a
C.S. minor).
Ben
--
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA
------------------------------
Date: Wed, 05 May 1999 18:36:24 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <pudge-0505991436260001@192.168.0.77>
In article <37308cb6.5143315@news.mindspring.com>, tnguru@termnetinc.com
(Ben Coleman) wrote:
# On 5 May 1999 02:03:42 -0400, dha@panix.com (David H. Adler) wrote:
#
# >>David {who started college as an English major...}
# >
# >Ha! I've got you both beat. I've got a degree in Philosophy! Ha!
#
# Hmmm. Where does a degree in Bible fit in there? (albeit I did have a
# C.S. minor).
Minor in Biblical Studies and Major in Journalism. :p
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 5 May 1999 18:40:31 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: "Safe" recursive delete?
Message-Id: <slrn7j149s.5la.fl_aggie@stat.fsu.edu>
On Wed, 05 May 1999 16:56:17 GMT, Scratchie <upsetter@ziplink.net>, in
<RK_X2.696$9L5.252657@news.shore.net> wrote:
+ Is there a way to safely do a recursive delete while using the -T switch?
+ Perl won't let me do a
+ system("rm -r $mydir")
+ even if I've untainted $mydir first.
Of course not -- system is invoking a shell, and is dependent upon the
$ENV{'PATH'} variable (tho you may have sanitized that). This is discussed
in perlsec, which you seem to have at least glanced at. You could do:
system '/bin/rm', '-r', $mydir;
Tested...works, apparently. For all cases where $mydir='a';, anyway...
James
------------------------------
Date: Wed, 05 May 1999 10:19:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Dumb Question
Message-Id: <37307DB9.75CDC761@mail.cor.epa.gov>
Jody Fedor wrote:
>
> Another Dumb Question...
> I have Active State Perl on my Win 95 machine... How do i get the
> perlre manpages?
Since you have ActiveState, you should have on-line HTML pages. And
the install should have put a link to them in your Start menu
somewhere. Unless you told the install not to put the HTML pages in.
The HTML docs have the complete perlre manpage, as well as a host of
other nice stuff.. like the pages for all the modules you have
installed.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: 5 May 1999 17:32:23 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: Generating method call from a string
Message-Id: <7gpvb7$fk4$1@fcnews.fc.hp.com>
simon@whitestar99.demon.co.uk wrote:
: Hi,
: I have done similar to this in the past but never when classes were involved
: and now I am playing with classes I am having trouble implementing the
: following.
: I have a class which is v.basic and is pretty much a copy of one from the
: perltoot man page with the AUTOLOAD function.
: If I have a field, say 'type' which with the AUTOLOAD function is accessed:
: $item->type (get)
: $item->type($value) (set)
: What I want to do is set a variable to 'type' and then call the method using
: the variable, i.e.
: my $variable = 'type';
: my $method = "$item->$variable";
Hmmm... seems like accessor methods in all their OO beauty are biting
you in the hindquarters. Why don't you write a $obj->getfield('type')
method? (and a setfield to go along with it?)
sub getfield {return $_[0]->{$_[1]};}
sub setfield {$_[0]->{$_[1]}=$_[2];}
(checking for permitted fields is an exercise left for the
reader. While you're at it, rewrite AUTOLOAD to use these routines :)
If 'can' worked with AUTOLOAD (which would be terminally weird), you
could do this:
$method=$item->can('type');
&$method;
but it doesn't, so you can't. Of course, you could just:
$method=sub{local $AUTOLOAD=ref($item)."::type"; $item->AUTOLOAD();}
&$method;
but I don't think _that's_ what you had in mind ;) Are you positive
you don't want to break down and just do
$item->{'type'}="bob";
(just kidding!)
OO tip of the day: if you're needing function pointers, you're no
longer doing object-oriented programming ;)
Andrew
------------------------------
Date: 5 May 1999 17:53:10 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Generating method call from a string
Message-Id: <7gq0i6$7vk$1@info2.uah.edu>
In article <7gprrs$pcj$1@nnrp1.dejanews.com>,
simon@whitestar99.demon.co.uk writes:
: What I want to do is set a variable to 'type' and then call the method using
: the variable, i.e.
:
: my $variable = 'type';
: my $method = "$item->$variable";
:
: my $result = $$method;
:
: Obviously the above is wrong but I am having trouble trying to work out the
: correct syntax.
You need to let the compiler know that you're trying to call a method:
my $method = 'type';
my $value = 'foo';
$obj->$method($value);
$value = $obj->$method(); # parens not optional here!
Greg
--
Cop: McManus told us another story altogether.
Fenster: Is that the one about the hooker with dysentery?
------------------------------
Date: Wed, 05 May 1999 17:26:33 GMT
From: bjepson@home.com (Brian Jepson)
Subject: Re: installing APi507e.exe on Win 95
Message-Id: <slrn7j13a1.rd.bjepson@cx384756-a.sking1.ri.home.com>
In article <37303A65.A5A34A87@lag.ensieg.inpg.fr>, Matija Exel wrote:
[...]
>-- PROBLEM: just after "Configuring Active Perl. This may take a minute."
>and then while
> "Configuring Perl..." an error window for _INS0432 pups up and
> the Debug information is:
>
>_INS0432 a causi une difaillance de page dans le module PERLEZ.DLL `
>0137:00c11085....
>(_INS0432 caused a page fault within the module PERLEZ.DLL at...)
>
[...]
I had this problem on a couple of machines. I think it was caused by the
fact that I uninstalled Perl, did not reboot, and then installed Perl.
I think there is something in the release notes about this. I believe
that it is caused by the original (from the version I uninstalled) Perl
DLL remaining resident during the installation of the new version of
Perl. After I got into the habit of rebooting between uninstalling and
reinstalling Perl, I never had this problem again.
--
Brian Jepson * (bjepson@home.com) * http://users.ids.net/~bjepson
------------------------------
Date: Wed, 05 May 1999 18:33:29 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
Subject: Is evaluation of printf operands left-to-right?
Message-Id: <373072D9.41C67EA6@ks.sel.alcatel.de>
Hello,
I have discovered something strange, and I can't explain it so I hope
someone can shed some insight into this. Consider:
my @rray = ( 'one', 'two', 'three' );
printf "stacksize %d, the first was: %s\n", $#rray, pop @rray;
now consider the result:
stacksize 1, the first was: three
stacksize 0, the first was: two
stacksize -1, the first was: one
stacksize -1, the first was:
the scalar is apparently evaluated after the pop. Is this the
expected behaviour? It certainly surprised me. The workaround
is obvious, but my curiosity is aroused.
Wm Blasiu
Stuttgart
...now I'm <wm.blasius@ks.sel.alcatel.de> - no matter what my mail
server says!
------------------------------
Date: Wed, 05 May 1999 10:43:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Is there a way how to turn a PERL program into ane EXE file?
Message-Id: <3730834B.C882BA6A@mail.cor.epa.gov>
blazek@sisblansko.cz wrote:
>
> As far as I know there are two products for turning a Perl script into an exe
> file
> 1. PDK from Active state that runs on NT only. So, it is not for me
> as I have Windows 95 and I did not try it.
> 2. Perl2exe that I tried but the exe file I received is not functioning. I
> asked the support for help this Monday and they did try to help me
> but it did not work either.
> Is there any other , working, product?
> Thank you for help
Why do you want to do this?
That's a serious question. Read the FAQ, and you'll see that great
Perl minds have already thought about this issue. For most things
you might think of, the answer is really "you don't want to do that."
Security? Don't go there.
Greed? Don't go there.
Speed? Don't go there either - TMTOWTDI, but this is not the way.
Portability? Ditto....
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Wed, 05 May 1999 17:31:12 GMT
From: Otis Gospodnetic <otis@my-dejanews.com>
Subject: killing processes invoked by Threads via system() or exec() - how?
Message-Id: <7gpv90$sqn$1@nnrp1.dejanews.com>
Hello,
As the Subject line indicates, I would appreciate some help with killing
processes invoked via system() or exec() from withing a thread in a perl
program.
Scenario: main thread starts X threads (work crew) and each of them invokes
something via system() and that something can take a long time and may have
to be interrupted and stopped cleanly.
Solution in Theory: Since killing/stopping threads is not possible in Perl, I
simply store the PID of each proces invoked by system() in some file, and if
the main process gets a signal such as TERM (from kill, for example) it gets
those stored PIDs and kills each of them one by one. The idea is that if the
process invoked by system() from within a perl thread terminates, the thread
that invoke it will terminate as well.
Problem in Reality:
What appears to be happening when threads call something via system() is that:
1. If I do: kill <main process PID>
I see that the signal was caught, and apparently all processes invoked by
system() were killed (I kill each of them in the sub that handles the signal
in the main program and report the # of processes killed). However, a ps
-auxw|grep perl shows me that those processes invoked by system() have not
really been killed and that they are really still running. So, even though I
supposedly killed those processes I see that the threads that started them
don't die (of course, since their system() calls are still apparently
running)
Is this the normal/documented behaviour? Can't my program kill processes that
my program's threads started via system()?
2. If I manually do: kill <PID of process started by system() from a thread>
The process just doesn't want to die, even though the program is also
handling signals. If invoked normally (not from within a threaded program via
system(), but rater from the prompt), and subsequently killed, it dies
properly.
Does anyone know anything about this weird behaviour?
Is this the normal/documented behaviour?
Should I post/mail my problem elsewhere?
Any help would be much much MUCH appreciated :)
Thank you,
Otis
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 5 May 1999 12:04:03 -0700
From: "Matt Kruse" <mkruse@rens.com>
Subject: OReilly bullshit.... Camel logo trademark
Message-Id: <7gptqc$hoo$1@ffx2nh3.news.uu.net>
I received this email today, with regard to
http://mkruse.netexpress.net/perl/
It's unfortunate that O'Reilly feels the need to control the web to this
extent.
For all of you who might have a camel on your Perl page, watch out.
Big Brother is watching...
I'm extremely disappointed in O'Reilly.
>Date: Wed, 05 May 1999 09:52:31 -0700
>From: Mark Jacobsen <markj@oreilly.com>
>To: mkruse@netexpress.net
>Subject: Perl in association with camel trademark
>
>Matt,
>
>I'm the general counsel of O'Reilly & Associates.
>
>We own the trademark of the word "Perl" in association with the camel.
>Your use of this trademark on your web site may cause confusion as to the
>sponsorship of your site.
>
>Please immediately remove this trademark from your web site.
>
>If you have any questions, don't hesitate to contact me by email or by
>phone at 707-829-0515 (x274).
>
>thanks,
>
>Mark
>------------------------------------
>Mark P. Jacobsen
>VP, Business Development
>707-829-0515 x274
>markj@oreilly.com
--
Matt Kruse
mkruse@rens.com
------------------------------
Date: 5 May 1999 11:31:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <37308062@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, <mkruse@netexpress.net> writes:
:I received this email today, with regard to
:http://mkruse.netexpress.net/perl/
:
:It's unfortunate that O'Reilly feels the need to control the web to this
:extent.
That's not what's going on. If you had a Camel logo advertising
your home-grown cigarettes, don't you think that the tobacco
lords would hunt you down? They have to, or lose their rights
to keep their distinctive trademark. ORA put the camel on the book.
That association is theirs alone.
--tom
--
All language designers are arrogant. Goes with the territory... :-)
--Larry Wall in <1991Jul13.010945.19157@netlabs.com>
------------------------------
Date: Wed, 05 May 1999 17:32:06 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <qg%X2.1727$iu1.1587@news.rdc1.tn.home.com>
>It's unfortunate that O'Reilly feels the need to control the web to
this
>extent.
You have it backwards. They are controlling their branding efforts which
is completely justifiable. Controlling the web would involve buying up
ISPs, communication companies and using proprietary technology (Does any
of this reMind you of Somebody?)
Controlling branding is a strategy to help a company maintain their
identity so that people can know they are receiving information from a
definitive source.
Otherwise complete amateurs (using the Camel logo on their website)
could post opinions and examples of Perl code on their sites. Overall,
this only leads to confusion for newer coders (read consumers also) and
undermines the validity of O'Reilly as a source and Perl as an effective
tool since O'Reilly offers what is probably the most definitive guides
to the language.
CT
------------------------------
Date: Wed, 5 May 1999 12:39:51 -0700
From: "Matt Kruse" <mkruse@rens.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <7gpvtq$jbs$1@ffx2nh3.news.uu.net>
[courtesy cc of this posting sent to cited author via email]
>That's not what's going on. If you had a Camel logo advertising
>your home-grown cigarettes, don't you think that the tobacco
>lords would hunt you down? They have to, or lose their rights
>to keep their distinctive trademark. ORA put the camel on the book.
>That association is theirs alone.
>--tom
Whether they like it or not, the camel is now a generally-accepted
symbol for Perl. It's spread around many thousands of sites on the web.
The camel on my site looks NOTHING like their camel, either. And I would
be more than happy to put a note on the site saying that I'm not
associated with ORA in any way. I'm sure everyone knows that already
anyway.
If I wrote a perl book and put a camel on it, I would understand. That
would be different, because the confusion would be clear.
Here, there is no confusion.
I realize companies need to make efforts to stop unauthorized trademark
useage, but IMO, they are taking it too far in finding any and every perl
site that may have some representation of a camel.
What O'Reilly should do is allow the camel to become a public symbol for
Perl, but maintain the trademark for books about Perl. Seems logical to
me.
If they force me to remove my Camel windows icons, it's only a loss for
other people. Thousands of people have downloaded them and found them
useful. And I think it's pretty safe to say that none of them confused
them with being officialy O'Reilly-sponsored...
------------------------------
Date: Wed, 05 May 1999 14:01:26 -0400
From: brian@pm.org (brian d foy)
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <brian-ya02408000R0505991401260001@news.panix.com>
In article <7gptqc$hoo$1@ffx2nh3.news.uu.net>, <mkruse@netexpress.net> posted:
> I received this email today, with regard to
> http://mkruse.netexpress.net/perl/
>
> It's unfortunate that O'Reilly feels the need to control the web to this
> extent.
it's not O'Reilly controlling the web, it's O'Reilly responding to
the requirements of the federal government to protect their
visually distinctive line of books. if they don't do what they are
doing, they can lose the trademark.
not that i like this, but that's the way it is, and certainly a
lot different than how i use to think about it before i owned
trademarks and had to listen to my attorney go through all of my
legal responsilibities of defending that trademark.
Perl Mongers, of course, has a camel in its logo. We worked out a
nice deal with O'Reilly where we didn't have to pay anything to do
that. of course, there is also a little trademark notice along
with that logo. you still might be able to use the camel if you
want to work with O'Reilly to do whatever you were doing with the
camel.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
White camels cost more than other camels in Kuwait.
------------------------------
Date: 5 May 1999 18:11:33 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <7gq1kl$87s$1@info2.uah.edu>
In article <37308062@cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
: In comp.lang.perl.misc, <mkruse@netexpress.net> writes:
: :I received this email today, with regard to
: :http://mkruse.netexpress.net/perl/
: :
: :It's unfortunate that O'Reilly feels the need to control the web to this
: :extent.
:
: That's not what's going on. If you had a Camel logo advertising
: your home-grown cigarettes, don't you think that the tobacco
: lords would hunt you down?
Your analogy fails in that Matt isn't attempting to use O'Reilly's
mark for books to bolster his book sales. Camel couldn't come after
me for putting camel images on a line of crescent wrenches. It would
be just as ludicrous for O'Reilly to do the same. Apparently, ORA is
asserting trademark on Camel images in association with Perl
publications (using a very generous definition of `publication') and
waiting for someone with sufficient supplies of cojones and denero to
challenge them on it.
Legal-might-makes-right is a disgusting attitude.
: They have to, or lose their rights
: to keep their distinctive trademark. ORA put the camel on the book.
: That association is theirs alone.
What books are on Matt's page? I don't deny that The Association for
Perl *books* is an ORA mark. No one does. ORA is, however,
overextending the bounds of reason. Greed and tyranny never got anyone
anywhere for long.
Greg
--
People avoid and indulge in Lisp and LSD for the same sets of reasons.
------------------------------
Date: 05 May 1999 12:36:25 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <m3btfze53q.fsf@moiraine.dimensional.com>
"Charles R. Thompson" <design@raincloud-studios.com> writes:
<snip>
> undermines the validity of O'Reilly as a source and Perl as an effective
> tool since O'Reilly offers what is probably the most definitive guides
> to the language.
O'Reilly publishes generally high quality technical manuals for perl,
but they don't even come close to providing `the most definitive
guides to the language'. Those are, in order-
0. $PERL_SRC_ROOT/*.[ch] # the _only_ `definitive' source
1. $CPAN/authors/id/*/*.gz # the standard library
2. $PERL_SRC_ROOT/pod/*.pod # the accumulated wisdom of the community
No dead tree media will ever be to compete with those in terms
of accuracy or timeliness. It's inherent to the media, it's
awful hard to patch a piece of paper. :-)
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Wed, 05 May 1999 18:38:52 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <pudge-0505991438540001@192.168.0.77>
In article <7gpvtq$jbs$1@ffx2nh3.news.uu.net>, <mkruse@netexpress.net> wrote:
# What O'Reilly should do is allow the camel to become a public symbol for
# Perl, but maintain the trademark for books about Perl. Seems logical to
# me.
Yes, but you are not a lawyer. Normally, this is a Good Thing.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Wed, 05 May 1999 18:42:37 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: OReilly bullshit.... Camel logo trademark
Message-Id: <xi0Y2.1748$iu1.1403@news.rdc1.tn.home.com>
>O'Reilly publishes generally high quality technical manuals for perl,
>but they don't even come close to providing `the most definitive
>guides to the language'. Those are, in order-
>No dead tree media will ever be to compete with those in terms
>of accuracy or timeliness. It's inherent to the media, it's
>awful hard to patch a piece of paper. :-)
I used the word 'probably'.. should have included `the most definitive
guides to the language *in book form*'. Man... I gotta be more complete.
I keep forgetting I'm the only one in my head.
CT
------------------------------
Date: Wed, 5 May 1999 11:04:54 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: "Greg Waugh" <bigbird@pol.com>
Subject: Re: Pattern Matching and parsing
Message-Id: <x3yogjza76x.fsf@tigre.matrox.com>
[posted and CCed]
"Greg Waugh" <bigbird@pol.com> writes:
> Bob: data data, data data, data data,
> data, data data, data
> Steve: moredata, moredata
> John: differentdata, differetdata, differentdata,
> differentdata, differentdata
[snips]
> Ideally, I'd like it to split by the list of all names ( @names = ("Bob",
> "Steve", "Mark", "John") ) that might or might not appear in the file. The
> order will most likely remain constant. So that the final data structure
> would contain (I use an array as an illustration):
>
> $output[0] eq "Bob: data data, data data, data data, data, data data, data"
> $output[1] eq "Steve: moredata, moredata"
> $output[2] eq "John: differentdata, differetdata, differentdata,
> differentdata, differentdata"
A hash will be better. How about something like (tested):
my ($name, %hash);
while (<F>) {
chomp;
if (/^(\S+):(.*)/) {
$name = $1;
$hash{$name} = $2;
} else {
$hash{$name} .= $_;
}
}
Note that this assumes that no colons ':' appear anywhere in the
data. Also, the ordering isn't preserved, but you can have a look at
perlfaq4:
How can I always keep my hash sorted?
for more suggestions on this.
HTH,
Ala
PS. Don't post to comp.lang.perl ... it was shot in the head some time
ago.
------------------------------
Date: Wed, 5 May 1999 14:22:22 -0400
From: "Jim Phillips" <jphillips@va.campuscwix.net>
Subject: Perl on NT workstation with PWS
Message-Id: <7gq2a1$hr$1@news.campuscwix.net>
I am developing a web site using Perl. I am running NT workstation, Personal
Web Server and ActiveState Perl. I changed PC and have reset my project on
my new computer. The problem I am having is ever Perl program I try to link
to returns a HTTP error 404. I know I have probably not got something right
in the setup because this was working on my old machine. Any ideas? Any help
you could give me would be greatly appreciated.
Jim Phillips
jphillips@tva.campuscwix.net
------------------------------
Date: Wed, 05 May 1999 18:07:00 +0000
From: Steven Scoleri <scoleri@rad.upenn.edu>
Subject: Please Help
Message-Id: <373088C4.D117803E@rad.upenn.edu>
Hi,
I think this is a basic perl question, but I've been stuck for about 3
hours - Please Help.
#This Works
#!/usr/bin/perl
use Image::Magick;
my($q, $x);
$q = Image::Magick->new;
$x = $q->Read('CR.gif');
warn "$x" if "$x";
$x = $q->Scale(geometry=>'20');
warn "$x" if "$x";
$x = $q->Write('CRnew.gif');
warn "$x" if "$x";
#But This does not Work - WHY?
#!/usr/bin/perl
use Image::Magick;
$file="CR.gif";
$newfile="CRnew.gif";
my($q, $x);
$q = Image::Magick->new;
$x = $q->Read($file);
warn "$x" if "$x";
$x = $q->Scale(geometry=>'20');
warn "$x" if "$x";
$x = $q->Write($newfile);
warn "$x" if "$x";
I get an Unable to open file error - What am I doing wrong - Please
help.
Thanks a ton,
--
#################################################
# Steven Scoleri #
# System Manager #
# University of Pennsylvania #
# Radiology #
# http://scoleri.rad.upenn.edu #
# scoleri@rad.upenn.edu #
#################################################
------------------------------
Date: Wed, 05 May 1999 18:15:26 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Please Help
Message-Id: <2V%X2.1739$iu1.1609@news.rdc1.tn.home.com>
>#!/usr/bin/perl
#!/usr/bin/perl -w
use strict;
What does your error log say?
Have you tried giving it the 'real' path along with the filename?
Something like
$file = '/drv1/web/sites/web76544/images/CR.gif';
CT
------------------------------
Date: Wed, 05 May 1999 18:20:21 +0000
From: Steven Scoleri <scoleri@rad.upenn.edu>
Subject: Re: Please Help
Message-Id: <37308BE5.FD5E50A2@rad.upenn.edu>
I'm sorry actually my example is bad it actually does work. The problem
is when i do something like this:
open(QUE,"$queue") || die "Queue is broken: $! \n";
while(<QUE>) {
($name,$sex,$patient_id,$series_id,$image_number,$images_in_acq,$modality,$file)=split(":");
print "$name\n";
print "$file\n";
$little_gif_file="thumb.$file";
my($q, $x);
$q=Image::Magick->new;
$x=$q->Read($file);
warn "$x" if "$x";
$x=$q->Scale(geometry=>'100');
warn "$x" if "$x";
$x=$q->Write($little_gif_file);
warn "$x" if "$x";
}
Thank You - Thank You.
"Charles R. Thompson" wrote:
>
> >#!/usr/bin/perl
>
> #!/usr/bin/perl -w
> use strict;
>
> What does your error log say?
> Have you tried giving it the 'real' path along with the filename?
>
> Something like
>
> $file = '/drv1/web/sites/web76544/images/CR.gif';
>
> CT
--
#################################################
# Steven Scoleri #
# System Manager #
# University of Pennsylvania #
# Radiology #
# http://scoleri.rad.upenn.edu #
# scoleri@rad.upenn.edu #
#################################################
------------------------------
Date: Wed, 05 May 1999 18:38:45 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Please Help
Message-Id: <Ve0Y2.1746$iu1.1627@news.rdc1.tn.home.com>
>I'm sorry actually my example is bad it actually does work. The
problem
>is when i do something like this:
Okay... so what's the error?
CT
------------------------------
Date: Wed, 05 May 1999 18:45:06 +0000
From: Steven Scoleri <scoleri@rad.upenn.edu>
Subject: Re: Please Help
Message-Id: <373091B2.BAA79363@rad.upenn.edu>
The error is No such file or Directory when damn well it there.
"Charles R. Thompson" wrote:
>
> >I'm sorry actually my example is bad it actually does work. The
> problem
> >is when i do something like this:
>
> Okay... so what's the error?
>
> CT
--
#################################################
# Steven Scoleri #
# System Manager #
# University of Pennsylvania #
# Radiology #
# http://scoleri.rad.upenn.edu #
# scoleri@rad.upenn.edu #
#################################################
------------------------------
Date: Wed, 5 May 1999 10:28:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Read vs. <STDIN>
Message-Id: <MPG.119a1fa0e3544d4e9899cf@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x7zp3jxz9b.fsf@home.sysarch.com> on 05 May 1999 12:22:24 -
0400, Uri Guttman <uri@sysarch.com> says...
...
> also sysread is faster as it doesn't use stdio buffering.
For a once-per-program-invocation read of the input data, speed really
doesn't matter.
> and you are not reading from the client but from the server. so if you
> get a read error, it could be useful to log it or even report back to
> the server. it may not be a broken connection but something else like an
> interrupted i/o call.
Good point. The snippet I posted tried only to communicate with the
browser. A message on STDERR would probably be good also.
In the CGI environments I use, I don't have access to the server logs,
so I haven't ever bothered to write to them.
And my POST input reads have never failed. But that's no excuse not to
test the success of the 'read' (or 'sysread' :-) system call, just as we
insist on checking 'open'.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 5 May 1999 11:29:03 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Read vs. <STDIN>
Message-Id: <37307fdf@cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
lr@hpl.hp.com (Larry Rosler) writes:
:And my POST input reads have never failed.
Mine have. Many many times. Usually from people
using odd browsers on primitive consumerist nonsystems.
I don't know why. Iwang was a bad one.
--tom
--
There are many times when you want it to ignore the rest of the string just
like atof() does. Oddly enough, Perl calls atof(). How convenient. :-)
--Larry Wall in <1991Jun24.231628.14446@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Wed, 05 May 1999 10:04:14 -0700
From: Chance Houston <news@i-tradeonline.com>
Subject: SOLVED - I'm new - Please help - Sorting Question
Message-Id: <373079F0.25E271C7@i-tradeonline.com>
Special thanks to . . .
Tad McClellan tadmc@metronet.com
Bob Walton walton@frontiernet.net
Bob Trieger sowmaster@juicepigs.com
Brian Peisley brian@helka.mutagenic.org
----- ORIGINAL MESSAGE -----
My database is a text file that looks like this . . .
major_category|sub_category|site_url|site_title|description|feature|graphic|keywords|clickCount
What is the best way to sort my search results by the last item
(clickCount)?
------ SOLUTION -------
# It's not pretty but it works
# Read in the database - store as an array
open(DATA,"database.txt") || die;
while (<DATA>)
{
@database ["$i"] = $_;
$i++;
}
close (DATA);
# Sort by the number at the end of the field
@idx = ();
for (@database) {
($item) = /\|([^|]*)$/;
push @idx, uc($item);
}
@sorted = @database[ reverse sort { $idx[$a] <=> $idx[$b] } 0 .. $#idx
];
# print the top 10
while ($j < 10) {
print @sorted ["$j"];
$j++;
}
------------------------------
Date: Wed, 05 May 1999 11:38:52 -0700
From: mikej <mikej@1185design.com>
Subject: SSI perl hit counter
Message-Id: <3730903A.C4154CE8@1185design.com>
Ive been trying to get this hit counter perl script to work on my page
but it will not print the hits to my page. I know I can use SSI because
I tried calling one of my other scripts from the same page and it
worked. Here is the source code I have for the perl:
#!/usr/local/bin/perl -w
$font_face = "Arial";
$font_size = "2";
print "Content-type: text/html\n\n";
open (count, 'counter.dat') || print "<font face=\"$font_face\"
size=\"$font_size\">cant open counter file</font>";
$new_num = <count>;
$new_num = $new_num + 1;
close (count);
open (count2, '>counter.dat') || print "<font face=\"$font_face\"
size=\"$font_size\">cant open counter file</font>";
print count2 "$new_num";
close (count2);
print "<font face=\"$font_face\" size=\"$font_size\">$new_num</font>";
#end of the file
I have the counter.dat file with 777 permissions and the counter.pl file
is 755. The page with the ssi call in it is also 777, and it uses this
as the call:
<!--#exec cgi="counter.pl"-->
Everything is in the same directory, I have no idea what could possibly
be wrong with it. When I check the counter.dat file, it still has the
number 0 that I put in it so it doesnt increment it.
Any ideas?
------------------------------
Date: 5 May 1999 12:55:23 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: What is the opposite of bind() ?
Message-Id: <7gq0mb$jq1$1@yin.interaccess.com>
I have a Perl script that is a variation of the server program in the book.
It uses bind() to bind the socket to the port. The problem is that if
I'm debugging it, I run it, control/C it, edit it, run it again, and
get "bind: address already in use".
There should be a system call that unbinds (frees) the address, but I
could not find it (either in the Perl docu or the system [Solaris] docu)
I have written a ^C handler (trapping SIGINT) in the program and tried
having it call shutdown(), but get err msg "Transport end not connected"
I don't think shutdown() is what I am looking for, but cannot find
anything else. In particular, "man bind" is silent on the "How do I
undo this?" topic.
------------------------------
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 5572
**************************************