[25929] in Perl-Users-Digest
Perl-Users Digest, Issue: 8149 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 5 09:05:17 2005
Date: Sun, 5 Jun 2005 06:05:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 5 Jun 2005 Volume: 10 Number: 8149
Today's topics:
Re: book "perl medic": any good? <1usa@llenroc.ude.invalid>
Re: book "perl medic": any good? <sigzero@gmail.com>
Re: Converting a big perl script which is called over a <tadmc@augustmail.com>
Re: Converting a big perl script which is called over a xhoster@gmail.com
Re: Converting a big perl script which is called over a xhoster@gmail.com
Re: counting word occurances <abigail@abigail.nl>
Re: Editors that use embedded Perl as their macro langu burlo.stumproot@gmail.com
Re: numbers and strings and regex? <see.sig@rochester.rr.com>
Parrot 0.2.1 "APW" Released! <slrn@toetsch.at>
Re: Test <jazeker_b_nospamlalala@yahoo.co.uk>
Re: VB6 and Perl on 2000/XP: Req recommendation for int <yyusenet@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 04 Jun 2005 18:08:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: book "perl medic": any good?
Message-Id: <Xns966B8F966C0C4asu1cornelledu@127.0.0.1>
dkcombs@panix.com (David Combs) wrote in news:d7sp0r$snv$1
@panix3.panix.com:
> Saw a reference to a new-to-me book "Perl Medic". Anyone seen it?
> Anyone have it?
>
> What opinion?
I haven't read it, but the author posts here regularly.
Book web site: <URL: http://www.perlmedic.com/>
Content:
<URL http://print.google.com/print?q=perl+medic&btnG=Search+Print>
Reviews:
<URL: http://books.slashdot.org/article.pl?sid=05/05/02/214235>
<URL: http://use.perl.org/~Robrt/journal/18232>
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sat, 04 Jun 2005 20:08:36 GMT
From: Robert <sigzero@gmail.com>
Subject: Re: book "perl medic": any good?
Message-Id: <BEC78284.1451B%sigzero@gmail.com>
On 6/4/05 1:39 PM, in article d7sp0r$snv$1@panix3.panix.com, "David Combs"
<dkcombs@panix.com> wrote:
> Saw a reference to a new-to-me book "Perl Medic". Anyone seen it?
> Anyone have it?
>
> What opinion?
>
> Thanks!
>
> David
>
>
I have it and I think it is a really good book. It has a place on my desk.
Robert
------------------------------
Date: Sat, 4 Jun 2005 17:11:33 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <slrnda49ol.apq.tadmc@magna.augustmail.com>
OdedDV <dv@mailtag.com> wrote:
> Maybe I do need to fork/exec,
Right.
> but then again, I want to make sure I don't
> ask Perl to recompile/
Since you added that, I'm quite sure that you don't yet have an
accurate mental model of how processes work.
fork() makes a clone of the current process, with the instruction
counter at the same place in each process.
The cloning includes the memory image to be run, so the compilation
has already been done and is not repeated.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 05 Jun 2005 01:32:18 GMT
From: xhoster@gmail.com
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <20050604213218.950$Wf@newsreader.com>
"OdedDV" <dv@mailtag.com> wrote:
> Hello all,
>
> I have a rather long Perl script (which is Tk based). The script needs
> to run another instance per user request. It is currently done using
> `system myscript param1 param2 param3 &`. This works great in terms of
> functionality, but the issue is that myscript gets "compiled/interpreted"
> over and over whenever a new instance is required. This is a waste of
> time, especially on some of our slow Solaris machines.
Get faster machines.
> I wanted to convert myscript to a module, such that I can write another
> short script which will use this module to launch the first instance.
> It means that the module itself would have a function which launches
> another instance.
>
> The issue I'm facing is regarding the global variables I have in the
> script. Naturally every instance should have its own copy of the
> parameters. It means I can no longer have these as global parameters in
> the module, as this implies that they are shared across all instances
> created. Trying to move them to the "main" function I export from the
> module is no good, as I have dozens of other functions in this module
> which need to access those used-to-be "global" parameters.
Then you have to pass those variables to those dozens of functions.
Or pack all those different variables into one hash and pass that
to the functions.
> Can someone please share with me some ideas / point me to relevant
> documentation for the simplest way for me to achieve what I need ?
In my experience in doing this, all that I can say is "Sucks to be you."
I know of no easy way to pull off this conversion. You might be able to
hack something up by "local"izing all the package variables everytime you
start the main function. But I'd probably just roll up my sleeves and get
to work turning everything into lexicals (with a good search and replace
function, it isn't all *that* much work), rather than messing around with
local. But first I'd try to convince the guys with the purse-strings that
it would be cheaper to buy new machines to run the old, bad code than it
would be to re-do the code. (And then in the future us lexicals from the
start.)
> Maybe there's another solution (not using a module) ?
If you find one, please let me know.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 05 Jun 2005 01:49:55 GMT
From: xhoster@gmail.com
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <20050604214955.766$Gd@newsreader.com>
"OdedDV" <dv@mailtag.com> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrnda3eok.8en.tadmc@magna.augustmail.com...
> > How will the module launch the new instance?
> >
> > Using system()?
>
> Nope, sorry if I wasn't clear enough. The idea is to convert the system
> call to a function call.
I thought that was clear in the original, but then I noticed that in the
original you ended your "system" command with a "&". If you just change it
into a plain function call, then it will by synchronous, unlike "system"
with "&". Is that OK with you?
> Thus I'm calling code which was already "compiled/interpreted".
> Am I saying something stupid ? Maybe it's not possible ?!
Now that I think about it, I think that it is possible.
> Is it possible to have some instances of the same function at the same
> time ?
Don't know what that means.
> Maybe I do need to fork/exec, but then again, I want to make sure I don't
> ask Perl to recompile/reinterpret the code.
A fork doesn't ask Perl to recompile the code
So what you want to do is have the parent process include the module, so
the module gets compiled only once, at parent start up. The parent process
has itself compiled, and also has the "bad" module compiled (bad because it
uses globals in an unsafe way). But as long as the parent never does
anything with that module other than compile it, then the all the globals
in that module are "clean" in the parent process.
Now, some functionality in the module needs to be used. The parent process
forks, and then the child process invokes code from the module. The child
dirties up it's copy of the unsafe globals, but as long as the child never
creates children itself, this isn't a problem. The parent process's
version of the bad module is still clean, so the next time the parent forks
that child also gets a clean version.
Still, I'd work on cleaning up the bad module.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 04 Jun 2005 21:57:05 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: counting word occurances
Message-Id: <slrnda48th.ch.abigail@alexandra.abigail.nl>
Rodrick Brown (rodrick.brown@gmail.com) wrote on MMMMCCXCIV September
MCMXCIII in <URL:news:c7Qne.4832$jU5.1473111@twister.nyc.rr.com>:
[] Hello,
[]
[] Just learning Perl so bare with me.
[]
[] I have the following output file:
[]
[] pear
[] apple
[] apple
[] orange
[] mango
[] mango
[] pear
[] cherry
[] apple
[]
[] ill would like the count the ammount of occurances for each fruit.
No need for perl here. Just some standard shell tools will do a fine job:
grep -v '^ ' input_file | sort | uniq -c
Abigail
--
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";
------------------------------
Date: Sat, 04 Jun 2005 22:19:07 GMT
From: burlo.stumproot@gmail.com
Subject: Re: Editors that use embedded Perl as their macro language?
Message-Id: <u3brx22at.fsf@gmail.com>
"Dean Hannotte" <dhannotte@nyc.rr.com> writes:
> I have been using Mansfield Software's KEDIT, which was based on IBM's
> XEDIT, every day for 25 years. I love it, but the macro language is a
> lifeless subset of Rexx. Does anyone know if any serious text editors use
> embedded Perl as their macro language? That would be insanely great.
>
> Dean Hannotte
> http://www.hannotte.net
Emacs, kind of...
Read "Customizing Emacs with Perl"
at http://www.perl.com/pub/a/2005/03/31/lightning2.html
------------------------------
Date: Sun, 05 Jun 2005 00:51:28 GMT
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: numbers and strings and regex?
Message-Id: <k0soe.980$HT1.442@twister.nyroc.rr.com>
Geoff Cox wrote:
> On 30 May 2005 20:51:43 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
...
> Brian suggested approach below which works fine but am not clear whta
> the $exnum = 0+$1; does?
>
> Geoff
>
> if ($name =~ /\.*?\d{2}-(\d{2})\.jmx$/i) {
>
> # print ("\$1 = $1 \n");
>
> my $exnum = 0+$1;
$1 is a string, the result of a successful pattern match (kudos
for checking!). 0+$1 forces a conversion from the string to a
number. Perl will convert as much of $1 as it can make sense as
a number. So if $1 were '42xxx' (and yes, I realize that given
the regexp above, it couldn't be that), then $exnum would be 42,
for example.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Sat, 04 Jun 2005 12:48:31 +0200
From: Leopold Toetsch <slrn@toetsch.at>
Subject: Parrot 0.2.1 "APW" Released!
Message-Id: <slrnda31ni.f93.slrn@toetsch.at>
Parrot 0.2.1 "APW" Released!
On behalf of the Parrot team I'm proud to announce another monthly
release of Parrot and I'd like to thank all involved people as well as
our sponsors for supporting us.
The release name stands for "Austrian Perl Workshop", which will take
place on 9th and 10th of June in Vienna. It will have a french
connection that is a live video stream to the French Perl Workshop
happening at the same time.
What is Parrot?
Parrot is a virtual machine aimed at running Perl6 and other dynamic
languages.
Parrot 0.2.1 changes and news
- better HLL support (short names for object attributes, and
.HLL and n_operators pragmas)
- string encoding and charset can now be set independently
- experimental mmap IO layer for slurping files
- distinct debug and trace flag settings
- glob support in PGE
- new character classification opcodes and interfaces
After some pause you can grab it from
<http://www.cpan.org/authors/id/L/LT/LTOETSCH/parrot-0.2.1.tar.gz>.
As parrot is still in steady development we recommend that you
just get the latest and best from SVN by following the directions at
<http://www.parrotcode.org/source.html>
Turn your web browser towards <http://www.parrotcode.org/> for more
information about Parrot, get involved, and:
Have fun!
leo
------------------------------
Date: Sun, 05 Jun 2005 01:14:11 GMT
From: Jazeker <jazeker_b_nospamlalala@yahoo.co.uk>
Subject: Re: Test
Message-Id: <Dlsoe.111002$Mm2.6383742@phobos.telenet-ops.be>
Tad McClellan wrote:
> Ascoteric <ascoteric@hotmail.com> wrote:
>
>
>>Subject: Test
>
>
>
> What were you testing?
>
> To see if you could get yourself killfiled before asking even
> a single question?
>
> If so, then the test has passed!
>
>
> So long.
I know that sort of people. They will not even complain here about your
killfile. They'll stampede in help forum of a site that sells Perl web
scripts about 'nobody answering my questions' ten seconds after they
posted some obsucere Usenet reply to a forum about a specific Perl script.
--
print <<EOF;
Just a noobish Perl hacker
EOF
------------------------------
Date: Sat, 04 Jun 2005 19:41:48 -0600
From: YYusenet <yyusenet@yahoo.com>
Subject: Re: VB6 and Perl on 2000/XP: Req recommendation for interprocess communication
Message-Id: <d7tl8q$gf6$1@news.xmission.com>
Tom Bates wrote:
> I'm working on a VB6 program that will kick off a command process
> (using COMSPEC) that will run a perl script, which in turn may execute
> nested perl scripts. (I think it sounds worse than it is.) I have
> tested a prototype which appears to work, using CreateProcess (this
> way, I can stop the process if I need to).
>
> I would like the VB program to be able to continually monitor and
> receive status from the running perl script(s) so I can update a
> status bar, and perhaps display progress information in a textbox. To
> me, watching the text whiz by in a console window looks kinda 80's...
> :-)
>
> Can someone suggest an optimal approach for this?
>
> Thanks
> Tom
>
> NOTE - cross-posted to VB and Perl discussion groups
There is a very easy way... Just have the Perl script return back the
percentage that it is complete and then have the VB part capture the
STDOUT and then wait for the new percentage.
--
k g a b e r t (at) x m i s s i o n (dot) c o m
*Support Mozilla Firefox*!
http://www.spreadfirefox.com/?q=user/register&r=71209
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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.
#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 V10 Issue 8149
***************************************