[26205] in Perl-Users-Digest
Perl-Users Digest, Issue: 8391 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 6 00:05:41 2005
Date: Mon, 5 Sep 2005 21:05:08 -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 Mon, 5 Sep 2005 Volume: 10 Number: 8391
Today's topics:
Re: Can I Get The PID Of The Program That Launched My P <joe@inwap.com>
Re: Hacking a script (makemenu.pl) <joe@inwap.com>
Re: maintainable code? <matthew.garrish@sympatico.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 05 Sep 2005 17:46:32 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Can I Get The PID Of The Program That Launched My Program?
Message-Id: <wtadnZ2dnZ2zPyntnZ2dnXF7gd6dnZ2dRVn-yp2dnZ0@comcast.com>
Hal Vaughan wrote:
> I tested it. When I start the program from a console window, it gives me
> the PID of the console. When I start program B from program A with
> backticks, it gives me the PID of program A.
Sounds like you didn't properly test the two types of backquote
environments.
linux% perl -le '$_=`./test.pl`; chomp; print "[$_] $$"'
[18382 invoked by 18381] 18381
linux% perl -le '$_=`./test.pl </dev/null`; chomp; print "[$_] $$"'
[18385 invoked by 18384] 18383
No shell metacharacters: getppid() = immediate parent.
With shell metacharacters: getppid() = pid of /bin/sh, not perl!
-Joe
------------------------------
Date: Mon, 05 Sep 2005 17:27:19 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Hacking a script (makemenu.pl)
Message-Id: <VsednZ2dnZ2cKryznZ2dnfZ_gd6dnZ2dRVn-052dnZ0@comcast.com>
Frank Louden wrote:
> Thanks Willie and Jim. This version of perl allows globbing so I expected it
> to work just fine with the <> operator. But, there are so many differences
> between MSWindoze and Unix/Linux systems I thought the developers of this
> distribution of perl would accomodate Win32's crippled OS.
Which perl are you using?
C:\Documents and Settings\jms>dir/w *.pl
bcm-route.pl editorlog.pl ls-temp.pl prog1.pl temp.pl
C:\Documents and Settings\jms>perl -le "print qq{@ARGV}" *.pl
*.pl
C:\Documents and Settings\jms>perl -v
This is perl, v5.8.7 built for MSWin32-x86-multi-thread
Binary build 813 [148120] provided by ActiveState
That version of perl works just fine with the <> operator.
It's @ARGV that is different.
-Joe
------------------------------
Date: Mon, 5 Sep 2005 22:30:21 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: maintainable code?
Message-Id: <Za7Te.3860$I02.347648@news20.bellglobal.com>
"ngoc" <ngoc@yahoo.com> wrote in message
news:431c62b0$1@news.broadpark.no...
>
>> I can tell
>> you from experience that someone who asks for help (and learns from it)
>> will be better respected in the long run than someone who hacks code
>> together and then refuses to acknowledge their faults. If you have a lead
>> or manager you can ask advice of, take your code to them and find out
>> what recommendations they have. The approach can be something as simple
>> as "I wrote this code procedurally, but I was wondering if it should be
>> modularized?" And then once you have the person engaged ask how they
>> would approach the problem of breaking it up.
>>
> I am the only programmer in the team. I will try to ask around in the
> company who know perl.
>
How you code on your own time and how you code at work can often be quite
different. You should always follow whatever style your company employs, but
if there is no explicit style and you're just looking to improve your coding
then you certainly have more leeway. Whatever the case, Object Oriented Perl
by Damian Conway is an excellent book if you're already comfortable with
Perl.
One simple step you might want to consider to improve your code is to do
away with the (ab)use of global variables. Globals do have a place, but they
can also make code a mess to read when they're used in place of good design.
See if you can't do away with the global aspect by passing values into and
returning values from your subroutines. See this recent thread as a start:
http://tinyurl.com/73wyf
And then read over perlsub as mentioned by Gunnar in it.
Matt
------------------------------
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 8391
***************************************