[8084] in Perl-Users-Digest
Perl-Users Digest, Issue: 1704 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 22 14:07:27 1998
Date: Thu, 22 Jan 98 11:01:56 -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, 22 Jan 1998 Volume: 8 Number: 1704
Today's topics:
Re: Perl to EXE <Jacqui.Caren@ig.co.uk>
Re: Perl-5 for NT invoking another script <rootbeer@teleport.com>
perlembed in setuid programs <*@qz.to>
Problem running perl script <ryoung@asucla.ucla.edu>
Re: Problem running perl script (Jonathan Stowe)
Re: Programmers Wanted <Jacqui.Caren@ig.co.uk>
Re: Reg Expression, can it be improved? poster3001@hotmail.com
return code 59136 <dcordero@giss.nasa.gov>
Reverse of ReadParse (J T)
Re: Running Perl as a Service <rootbeer@teleport.com>
Re: source into binary code <jdporter@min.net>
Re: source into binary code <jdporter@min.net>
Re: space searching? <*@qz.to>
Re: space searching? (Steven M. O'Neill)
Re: Switch statement in Perl-5??? <jdporter@min.net>
Re: Why warn? (WAS: Re: Critique My Code! (Please)) <jdporter@min.net>
Win32 Perl date time ??? <geoffrey.conner@gsc.gte.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Jan 1998 13:30:42 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Perl to EXE
Message-Id: <En6tJ7.9KL@ig.co.uk>
In article <naDt.86$Dy5.1315720@news3.voicenet.com>,
<nospam@domain.com> wrote:
>Tom Christiansen (tchrist@mox.perl.com) wrote:
>
>: In comp.lang.perl.misc,
>: :WWW: http://www.demobuilder.com
>: :This is where you can find it.
>
>: Yes, but it doesn't do what you think it does. What good
>: is a tar file with the a.out and script bundled together,
>: or at least the moral equivalent of the same?
>
>
>It's good because you can run a Perl script
>without first installing the Perl distribution.
Untrue - try using a couple of requires and use statements and
see what happens. The perl compiler unlike this tool at least
attempts to handle the problems associated with such sublects.
>In some cases this might be worth doing.
Possibly remember though that most people wanting to generate
an exe are trying to hide thier perl source - try running
strings of the exe and you will see the problem...
>Maybe we don't care about speed of execution --
>maybe we just have a short script that we need to run
>on an arbitrary machine, which does not have Perl.
>In this case, a faux "compiler" might be handy.
True.
>I'm assuming this "compiler" actually works... I haven't tried it. ;)
>But it's a reasonable idea.
As long as you understand that it is NOT a compiler. It is
simply a rather basic packaging mechansim in the same manner that
sfx files are really zip files with a header program.
No compilation, encryption or tru packaging is done.
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Thu, 22 Jan 1998 10:40:55 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Daivd Mohorn <david.mohorn@norfolkva.ncr.com>
Subject: Re: Perl-5 for NT invoking another script
Message-Id: <Pine.GSO.3.96.980122104030.20494e-100000@user2.teleport.com>
On Tue, 20 Jan 1998, Daivd Mohorn wrote:
> How can I have a Perl script invoke another perl script under Windows
> 95/NT?
Check the docs for qx``, system, and exec. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 22 Jan 1998 17:21:41 GMT
From: Eli the Bearded <*@qz.to>
Subject: perlembed in setuid programs
Message-Id: <qz$9801221149@qz.little-neck.ny.us>
Neither the perlembed nor perlsec man pages discuss this. Can it be done?
I get "No -e in setuid scripts" error messages when I try it and I find
this worrying. Changing the arguments to perl_parse() to have a "-Ue"
flag instead of just "-e" does not suppress this message.
So what's the long and short of it?
Elijah
------
starting to suspect other problems with that program as he looks at this
------------------------------
Date: Thu, 22 Jan 1998 09:55:55 -0800
From: "ryoung" <ryoung@asucla.ucla.edu>
Subject: Problem running perl script
Message-Id: <6a81nc$q1u$1@uni.library.ucla.edu>
Hello,
I'm having the strange problem of my scripts not being executed when
they're being called, but rather displayed. That is, the contents of the
.pl file are displayed in the browser rather than being executed through the
perl interpreter. Has anyone seen this and know what causes this?
Thanks,
Richard
------------------------------
Date: 22 Jan 1998 18:36:35 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Problem running perl script
Message-Id: <6a83jj$7j7$2@uranium.btinternet.com>
In article <6a81nc$q1u$1@uni.library.ucla.edu>, ryoung@asucla.ucla.edu
says...
>
>Hello,
>
>I'm having the strange problem of my scripts not being executed when
>they're being called, but rather displayed. That is, the contents of the
>.pl file are displayed in the browser rather than being executed through
the
>perl interpreter. Has anyone seen this and know what causes this?
>
This is not really a perl thing but one or more of
A) File is not in a directory that the web server recognizes as
containing executable files.
B) The server does not recognize .pl as an executable extension type
C) It is wednesday and you are using MSIE 4.00 ;-}
Whichever it may be you will need to consult an appropriate source of
information for your server and adjust the configuaration or pester someone
who can... (well not too much it could just as well be me).
Jonathan
------------------------------
Date: Thu, 22 Jan 1998 14:57:11 GMT
From: Jacqui Caren <Jacqui.Caren@ig.co.uk>
Subject: Re: Programmers Wanted
Message-Id: <En6xJC.A2J@ig.co.uk>
In article <34c2dca8.7511683@news.eur.sprynet.com>,
Ari Burton, President of IMARI STUDIOS <www.imaristudios.com> wrote:
>JUNIOR PROGRAMMERS WANTED! Are you starting out as a new programmer?
>Do you want to get your feet wet working on real-world applications?
>
>We are looking for new programmers of...
>
>http://www.imaristudios.com
ari@imaristudios.com
e.g. Do you want your site written by unpaid newbies?
I assume this is another company to avoid like the plague.
Jacqui
--
Jacqui Caren Email: Jacqui.Caren@ig.co.uk
Paul Ingram Group Fax: +44 1483 419 419
140A High Street Phone: +44 1483 424 424
Godalming GU7 1AB United Kingdom
------------------------------
Date: Thu, 22 Jan 1998 12:37:09 -0600
From: poster3001@hotmail.com
Subject: Re: Reg Expression, can it be improved?
Message-Id: <885493633.964624396@dejanews.com>
[ My last post seems to have gotten garbled a bit, so I'll try again.]
In article <885395443.1027342350@dejanews.com>,
rlee@spcbrass.com wrote:
>
> Okay, here we go...
>
> The routine below will change all lines to lowercase EXCEPT words
> enclosed in double quotes.
>
> The below code works and I'm posting it here to show off (rofl) NOT! I
> would like a second option. (I really want a perl one-liner to do the
> same thing and get rid of the match variables).
>
> Thanks
>
> Bert
>
> #!/usr/bin/perl -wT
>
> my $rec = "";
> my $a;
>
> $_ = "This is a TEST \"Sammy 1st Birthday\" and \"SUZZY\" ABCdef019Ab";
>
> [snip]
# This works but gives "uninitialized" warnings with -w:
s/([^"]*)("[^"]*")?/\L$1\E$2/g;
# This works without warnings:
s/([^"]*)("[^"]*")?/(defined($1)?"\L${1}":"").(defined($2)?$2:"")/eg;
# This works without warnings, with embedded escaped '\"':
s/((?:\\"|[^"])*)("(?:\\"|[^"])*")?/(defined($1)?"\L${1}":"").(defined($2)?$2:""
)/egx;
print $_, "\n";
>
> exit(0);
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Thu, 22 Jan 1998 12:29:30 -0500
From: "Douglas L Cordero, PhD" <dcordero@giss.nasa.gov>
Subject: return code 59136
Message-Id: <34C781FA.41C6@giss.nasa.gov>
Hi all:
I am running a fortran executable that I know returns:
STOP 999
When I execute the thing ($prog) with PERL:
my $rc = system("$prog < $args");
print "RC=$rc\n";
I get RC=59136.
Can someone tell me what this 59136 means?
Is it somehow mapped to 999?
Thx!
Doug C
------------------------------
Date: 22 Jan 1998 18:35:05 GMT
From: jtsai@saturn.superlink.net (J T)
Subject: Reverse of ReadParse
Message-Id: <6a83gp$62m$1@earth.superlink.net>
Gosh this is embarassing (diminishing regexp skills)...I am
simply trying to do the reverse of the hex-encoding in cgi-lib.pl's
ReadParse. For example:
Have "abc!123 +"
Then I should get back:
abc%21123%20@2b
Now, I have no problem doing this if I want to write some sort
of atrocity that breaks the string down character-by-character and unpacks
each non-alphanumeric character, then concatenates it into another string.
But I _know_ this can be done in an one-liner...my failed attempt:
$foo = "abc!123 +";
$foo =~ s/[^a-zA-Z0-9]/'%'.unpack("H2",$1)/ge;
...I know it's ^^ this part
that's not working because I get back:
"abc%123%%"...
...but what am I doing wrong!?
Thanks in advance for any help, and sorry for having to ask
this should've-been-trivial question.
------------------------------
Date: Thu, 22 Jan 1998 09:25:25 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Nick Palmer <NPalmer@photographics.co.uk>
Subject: Re: Running Perl as a Service
Message-Id: <Pine.GSO.3.96.980122092435.20494V-100000@user2.teleport.com>
On 20 Jan 1998, Nick Palmer wrote:
> The problem I am having is that I need to know what signal(s) are sent
> to my script when the service is stopped, either by the OS, or manually
> from the services applet in control panel.
That info should be in the docs for your system. If it's not, complain to
the vendor, then ask in a newsgroup about your system. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 22 Jan 1998 12:01:52 -0500
From: John Porter <jdporter@min.net>
Subject: Re: source into binary code
Message-Id: <34C77B80.574F@min.net>
Richard Caley wrote:
>
> Things I do commercially get supplied with full source because two
> years from now I might have gone to live up the Orinoco, and the
> people who payed me for a product shouldn't be left up shit creek.
Orinoco? Shit creek? You like those river metaphors ;-)
------------------------------
Date: Thu, 22 Jan 1998 12:02:20 -0500
From: John Porter <jdporter@min.net>
Subject: Re: source into binary code
Message-Id: <34C77B9C.278C@min.net>
John Stanley wrote:
>
> In article <eyhd8hodpv9.fsf@liddell.cstr.ed.ac.uk>,
> Richard Caley <rjc@liddell.cstr.ed.ac.uk> wrote:
> >Keeping the source secret certainly doesn't prevent piracy. If it did
> >Microcruft would be immune from piracy rather than being the major
> >victim.
>
> Please consider the group that you are reading this in when you make
> such statements.
What's your point? Is criticizing M$ taboo in c.l.p.m?
> Yes, keeping the source secret when the source is perl
> really does help prevent piracy. It can't prevent it if one of your
> contractually obligated to secrecy purchasers decides to violate that
> obligation, but it will stop people from copying and running your code
> because they can't just ftp it from everywhere.
A file is a file. People can illegally copy, distribute, make available
a source code file equally as easily as an executable binary. If
anything,
source is less prone to piracy because it must undergo some kind of
transformation before it can be run (compile, link, interpret,
whatever).
M$ could easily choose to include the source code to their applications
on
the CD-ROM. If they did, it would include the same kind of use
restrictions
they currently place on the binaries: "Give this stuff to anyone else,
and,
we swear to God, you won't know what hit you."
>
> >Basicly things where I don't have the source get put towards the `toy'
> >end of the scale. I may use them for work, but before I do I make sure
> >I can do without them at short notice when they blow up.
>
> Tell that to corporate IS managers who base their IS services on MS
> products.
I do. And it hurts everyone in the corporations when they don't listen.
> >Things I do commercially get supplied with full source because two
> >years from now I might have gone to live up the Orinoco, and the
> >people who payed me for a product shouldn't be left up shit creek.
>
> That is your choice. Who has said that you can't make such a choice?
More to the point, it is a good choice -- at least for programmers who
are more concerned about delivering high-quality product and 'real
value' to customers who pay for it and expect it. Unfortunately, not
all software companies operate by this ethic.
John Porter
------------------------------
Date: 22 Jan 1998 17:38:05 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: space searching?
Message-Id: <qz$9801221227@qz.little-neck.ny.us>
Randal Schwartz <merlyn@stonehenge.com> wrote:
> >>>>> "Chipmunk" == Chipmunk <rjk@coos.dartmouth.edu> writes:
> Chipmunk> /\s\w+\@bcl\.com/
> But even then, both of them are *wrong*. \w+ is not the proper regex
> for the left side of the @. It's much worse than that, since nearly
> *any* character is allowed on the left side of the @, provided you
> have the proper escaping. But a good replacement is just ".+", which
> means you might as well not even look at all. :)
Correct. <sarcasm> Who would ever have an email address with numbers in
it or periods or hypens and pluses or even something as absurd as
"*@qz.to"? </sarcasm>
Elijah
------
finds he gets very little spam to that address
------------------------------
Date: 22 Jan 1998 12:52:15 -0500
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: space searching?
Message-Id: <6a810f$1fk@panix2.panix.com>
Eli the Bearded <*@qz.to> wrote:
>Correct. <sarcasm> Who would ever have an email address with numbers in
>it or periods or hypens and pluses or even something as absurd as
>"*@qz.to"? </sarcasm>
* (how does one address you anyway?):
Please be aware thah using html tags in usenet posts is poor form if not
out and out poor taste. And besides, the <sarcasm> tag isn't even
supported by lynx.
:s
--
and you spelled "hyphens" wrong
--
steveo@panix.com
------------------------------
Date: Thu, 22 Jan 1998 12:42:27 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Switch statement in Perl-5???
Message-Id: <34C78503.7A40@min.net>
David Mohorn wrote:
>
> What? Perl-5 doesn't have a switch statement like C?
> How can I do a menu?
"Oh My God! No switch statement! What kind of cheap-ass
language is this?!?"
In addition to perlfaq7, which addresses this issue in detail,
there is also what the Camel has to say, in section
"Bare Blocks and Case Structures", on/about page 103.
"There is no official switch statement in Perl, because
there are already several ways to write the equivalent."
hth,
John Porter
------------------------------
Date: Thu, 22 Jan 1998 12:56:55 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Why warn? (WAS: Re: Critique My Code! (Please))
Message-Id: <34C78867.480D@min.net>
Martien Verbruggen wrote:
>
> In article <885397068.1110573072@dejanews.com>,
> dg50@chrysler.com writes:
>
> > So then, if warn also raises __WARN__, then its use involves more
> > overhead then plain old print STDERR - assuming one is not interested in
> > a __WARN__ handler of some sort.
>
> Yep. Just like using a module, or OO concepts in programming incur
> more overhead. But the tradeoff is that you end up with code which is
> easier to maintain, reuse and port. I personally never really worry
> too much about the overhead of this sort of thing. Getting rid of this
> type of overhead might speed up your code by about 0.3 nanoseconds.
> Not worth mentioning :)
Of course, this only applies to warn, not to die.
die $msg;
is extremely unequivalent to
{ print STDERR $msg; exit 2; };
Even if you don't have an explicit $SIG{__DIE__} handler,
your dying code could have been invoked somewhere under an eval.
------------------------------
Date: Thu, 22 Jan 1998 16:59:07 GMT
From: Geoffrey Conner <geoffrey.conner@gsc.gte.com>
Subject: Win32 Perl date time ???
Message-Id: <34C77ADB.39A0@gsc.gte.com>
Anybody? -
I am using build 314 of Active wares Perl port to Win 32. I want to
timestamp an entry to a log file as the entry is created. I have a code
snippet of using localtime to get the date information. I am new to
perl so am not exactly sure how to include the proper module to access
this function, if it is something that is standard in the Active ware
port, or is it a separate module that I must down load from another
source. Any help, guidance would be greatly appreciated. Thanks in
advance .
Code Snippet:
$cgilib_dir = "C:/cgi-shl/"; # location of cgi-lib.pl
$time_dir = "C:/learn_perlnt/lib/Time/";
##### don't change anything beneath here. unless of course you want to.
#####
push (@INC, $cgilib_dir); # so perl can locate the cgi-lib.pl file
push (@INC, $time_dir);
require ("cgi-lib.pl"); # everything with an & uses this library.
use Time::localtime;
$year = localtime->year() ;
$month = localtime->mon();
$day=localtime->mday();
$hour=localtime->hour();
$min=localtime->min();
$sec=localtime->sec();
printf ("Date is %2d/%2d/%2d\n",$day,$month,$year);
printf ("Time is %02d:%02d:%02d\n",$hour,$min,$sec);
when I run this using perl -w I get the following:
Can't locate Time/localtime.pm in @INC .....
In the perl/lib/time there is a local.pm and in perl/ there is a
timelocal.pl so I am not sure which of the 2 if any is correct since I
can not find a localtime.pm.
Regards,
Geoff Conner
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1704
**************************************