[25928] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 8148 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 4 14:05:32 2005

Date: Sat, 4 Jun 2005 11:05:04 -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           Sat, 4 Jun 2005     Volume: 10 Number: 8148

Today's topics:
        book "perl medic": any good? (David Combs)
        Converting a big perl script which is called over and o <dv@mailtag.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 <dv@mailtag.com>
    Re: Generating formetted documents in Perl <sbryce@scottbryce.com>
    Re: Passing a $1 within a scalar to a s/// doesn't work <tadmc@augustmail.com>
    Re: Passing a $1 within a scalar to a s/// doesn't work <nobull@mail.com>
    Re: Shared perl reposity <nobull@mail.com>
    Re: Shared perl reposity <No_4@dsl.pipex.com>
        VB6 and Perl on 2000/XP: Req recommendation for interpr <noneedto@email.me>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 4 Jun 2005 13:39:39 -0400
From: dkcombs@panix.com (David Combs)
Subject: book "perl medic": any good?
Message-Id: <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?

Thanks!

David




------------------------------

Date: Sat, 4 Jun 2005 13:33:25 +0200
From: "OdedDV" <dv@mailtag.com>
Subject: Converting a big perl script which is called over and over to a module ?
Message-Id: <42a18356$1@news.bezeqint.net>

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.

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.

Can someone please share with me some ideas / point me to relevant 
documentation for the simplest way for me to achieve what I need ?
Maybe there's another solution (not using a module) ?

Thanks in advance,
Oded 




------------------------------

Date: Sat, 4 Jun 2005 09:30:44 -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: <slrnda3eok.8en.tadmc@magna.augustmail.com>

OdedDV <dv@mailtag.com> wrote:

> 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.
> 
> 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.


How will the module launch the new instance?

Using system()?

If so, then making it into a module does not solve your problem.

There will be a compile phase for each instance anyway.


> The issue I'm facing is regarding the global variables I have in the script. 


I think the issue you're facing is an incomplete mental model of how
processes work, leading to an "XY problem".

If I understand your problem correctly, then module vs. monolithic
does not address your problem.

I think you want fork/exec instead.


> Naturally every instance should have its own copy of the parameters.  


And if you launch it with system, whether in main or in a module,
they _will_ get their own (command line) parameters.


> Can someone please share with me some ideas / point me to relevant 
> documentation for the simplest way for me to achieve what I need ?
> Maybe there's another solution (not using a module) ?


   perldoc -q background

       How do I start a process in the background?

   perldoc -f fork
   perldoc -f exec


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 4 Jun 2005 19:59:12 +0200
From: "OdedDV" <dv@mailtag.com>
Subject: Re: Converting a big perl script which is called over and over to a module ?
Message-Id: <42a1ddc2@news.bezeqint.net>


"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.
Thus I'm calling code which was already "compiled/interpreted".
Am I saying something stupid ?  Maybe it's not possible ?!

Is it possible to have some instances of the same function at the same time 
?
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.

Can this be done ?

Thanks,
Oded 




------------------------------

Date: Fri, 03 Jun 2005 19:34:54 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Generating formetted documents in Perl
Message-Id: <ErudncGYPt2gmDzfRVn-pg@comcast.com>

Russel Dalenberg wrote:
> I'm trying to write a Perl program that will output a simple catalog.  
> I'd like to produce something nicer than raw text output.

It sounds like PDF would be the way to go. You can do what you want to 
do in perl, but you will either need a basic understanding of the PDF 
spec, or PDF creation software. Ask your question in comp.text.pdf and 
see what answers you get there.

RTF will not necessarily give you the same look across platforms, since 
RTF relies on fonts available on the system. PDF has enough standard 
fonts to meet your needs.


------------------------------

Date: Fri, 3 Jun 2005 17:27:38 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Passing a $1 within a scalar to a s/// doesn't work. Why?
Message-Id: <slrnda1maq.6hq.tadmc@magna.augustmail.com>

Jim Gibson <jgibson@mail.arc.nasa.gov> wrote:

> I am not quite sure why '$d =~ /$oldpart/$newpart/e;' doesn't work, 


Because the replacement part is now code rather than a string.

If you instead said

   $foo = $newpart;

you would expect a literal '$1' in $foo's value, as there is only
one round of evaluation and that is used to fetch the value from $newpart.

Same thing for the code above.


> but
> wrapping the replacement text in double quotes and forcing another
> round of evaluation works:


That would be like

   $foo = eval $newpart;

were you _would_ expect variables in $newpart's value to be eval()uated.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 04 Jun 2005 09:26:07 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Passing a $1 within a scalar to a s/// doesn't work. Why?
Message-Id: <d7roiv$1fe$1@redhat2.bham.ac.uk>



Rob Campbell wrote:

[ My favourite question ]

See my lightning talk on about this question from YAPC::Europe::2004.

http://birmingham.pm.org/talks/faq/Hello.html



------------------------------

Date: Sat, 04 Jun 2005 09:36:54 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Shared perl reposity
Message-Id: <d7rp76$6sa$1@redhat2.bham.ac.uk>

Hemis wrote:

> Brian McCauley wrote:
> 
>> Hessu wrote:
>>
>>> 2) Is it practically possible to install perl in TOOLDIR so that 
>>> would be available so that users doesn't have to install perl locally 
>>> or they can keep their own local perl version?
>
>> There should be no problem on most operating systems so long as the 
>> contents TOOLDIR is accessed using the same path on all clients (i.e. 
>> they map it so the same local drive or directory).
> 
> Actually, mapping the dir to agreed drive ("Everybody must use T: for 
> tools-yeah it's windows!") is what we do.

Note: you must run the installation program to install Perl onto T: so 
that all the paths in Config.pm will contain T:



------------------------------

Date: Sat, 04 Jun 2005 18:50:21 +0100
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Shared perl reposity
Message-Id: <PtKdnRbSnqJAdDzfRVnyuQ@pipex.net>

Hessu wrote:
 >
> 1) Is it practically possible to install perl modules in TOOLDIR so they 
> would be available to users without continuing local module updates?
> 
> 2) Is it practically possible to install perl in TOOLDIR so that would 
> be available so that users doesn't have to install perl locally or they 
> can keep their own local perl version?
> 
> 3) Would there be any other scripting or tool language with which this 
> would be easy or even possible?

    What about:

4) Provide everyone with the same version of Perl from a network-mounted 
filesystem and get that to know about TOOLDIR.


-- 
              Just because I've written it doesn't mean that
                   either you or I have to believe it.


------------------------------

Date: Sat, 04 Jun 2005 08:24:47 -0400
From: Tom Bates <noneedto@email.me>
Subject: VB6 and Perl on 2000/XP: Req recommendation for interprocess communication
Message-Id: <6o63a1he1p0avj9jakr1dmpogrojcq1644@4ax.com>

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


------------------------------

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 8148
***************************************


home help back first fref pref prev next nref lref last post