[8579] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2196 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 27 17:07:34 1998

Date: Fri, 27 Mar 98 14:00:25 -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           Fri, 27 Mar 1998     Volume: 8 Number: 2196

Today's topics:
    Re: 3270 <cmargoli@world.northgrum.com>
    Re: ? search and replace string in Perl ? (brian d foy)
        File IO Question: opening for appending without flock? (Colin Meyer)
        File::Find (Ed Avis)
    Re: File::Find (David B. White)
    Re: File::Find (Andrew M. Langmead)
    Re: find command equivalent in Perl (Ilya Zakharevich)
        forking & execing & killing <moore@spam-gone.lts.sel.alcatel.de>
    Re: Going Rates for PERL Programming??? <birgitt@order.booktraders.com>
    Re: Help unpacking Little-Endian shorts and longs (Jason Gloudon)
    Re: IMAP support? <nonoboy@idiom.com>
    Re: Macperl (Chris Nandor)
    Re: Need help with PERL programming <jpeterson@dtint.com>
    Re: Nested quantifier in regexp problem (Mike Stok)
        Perl print email problem info@gadnet.com
    Re: PROPOSAL: The Perl Dictionary <uri@sysarch.com>
    Re: rant: illiterate Perl programmers <hal@vailsys.com>
        Suppressing "used only once" <hal@vailsys.com>
    Re: Suppressing "used only once" <uri@sysarch.com>
    Re: trivial example reveals a taint problem? (Andrew M. Langmead)
    Re: trivial example reveals a taint problem? (Sitaram Chamarty)
    Re: upgrade breakage? (Jason Gloudon)
    Re: || and 'or' - implications? (Chris Vogel)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Mar 1998 21:16:05 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: 3270
Message-Id: <351C1715.D52@world.northgrum.com>

DetlefEnge wrote:
> 
> Is anybody aware of a module like Net::Telnet that is capable of emulating an
> IBM 3270 terminal?
> 

Not a Perl module, but if you are running in an X Window environment,
x3270 has a -script option which accepts a command language on standard
input and writes responses, including screen contents, to standard
output.  You can run an x3270 session from a Perl program using
IPC::Open2.

-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

Date: Fri, 27 Mar 1998 14:01:44 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: ? search and replace string in Perl ?
Message-Id: <comdog-ya02408000R2703981401440001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6fgrn9$dtn$1@usenet45.supernews.com>, "Peter Perchansky" <fp@pmpcs.com> posted:

>I have a string denoted below where I would like to replace
>
>    value="STATE CODE" with
>
>    selected value="STATE CODE" when provided with the two digit state code.
>
>How would I code this in Perl?  Thank you.
>
>my $dropdown = q(<option value="AB">Alberta</option>
><option value="AK">Alaska</option>


something like

   $dropdown =~ s/(value="$state_code")/selected $1/i;

?  is there some other problem involved?

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>


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

Date: 27 Mar 1998 21:31:06 GMT
From: cmeyer@sim.zipcon.net (Colin Meyer)
Subject: File IO Question: opening for appending without flock?
Message-Id: <891034275.474566@ran.zipcon.net>



I was asked to make some maintenance changes to a cgi script that
logs the values of certain cookies to a file for user tracking.

My first examination of the script revealed that the original author
did not lock the log file after opening for appending.
[ open(OF,">>$fname") || return "$fname error: $!\n"; ]
My intuition and the example in perldoc -f flock say that when
opening a file for appending, one should lock & seek to the end before
actually writing.

I ran some tests to try and verify that not locking will clobber some
data, but was unsuccessful in any clobbering.

Test 1:
Two copies of the following script running in the background:

####################################################################
#!/usr/local/bin/perl

my $file = '/home/cmeyer/work/mediaone/testlog';
# the second copy used "test2\n"
my $line = "test1\n";

for (1..100_000)
{
   open FILE, ">>$file";
   print FILE $line;
   close FILE;
}
####################################################################


> logtest1.pl &
> logtest2.pl &
[wait for processes to finish]
> wc -l testlog
200000 testlog

It seems that no clobbering took place.


Test 2:
This time I tried to more closely simulate the web server process by
running each append as a separate perl process.  Also, I tried writing
more data to the log.

####################################################################
#!/usr/local/bin/perl
# log1.pl
for (1..10_000)
# log2.pl would show logtest2.pl
{ `./logtest1.pl` }
####################################################################

####################################################################
#!/usr/local/bin/perl
# logtest1.pl

my $file = '/home/cmeyer/work/mediaone/testlog';
my $line;

for (1..15)
# logtest2 would show test2:...
{ $line .= "test1:$_:" . "x" x 100 . "\n" }

open FILE, ">>$file";
print FILE $line;
close FILE;
####################################################################
> log1.pl &
> log2.pl &

This test writes much more data to testlog and fires up a new instance
of perl each time the log is appended to, much as the web-server does.

Still, no clobbering.  Also interesting is that each instance of
logtest1.pl or logtest2.pl appended all 15 lines before the other
would append.


Test 3:
uses log1.pl and logtest1.pl as in test2 along with:

####################################################################
#!/usr/local/bin/perl 
# stdin2test.pl
my $file = '/home/cmeyer/work/mediaone/testlog';

open FILE, ">>$file";

while (<STDIN>)
{
        print FILE $_;
}

close FILE;
####################################################################

> log1.pl &
> stdin2test.pl
line one
line two
line three
^d

> wc -l testlog 
 150003 testlog

>From testlog:
test1:15:[100 x's snipped]
line one
line two
line three
test1:1:[100 x's snipped]
test1:2:[100 x's snipped]

It seems that no data was clobbered and the stdin append happened in
between two callings of logtest1.pl.  This behaviour leads me to
believe that either perl or the os is locking this file auto-magically
when I open for appending.

I have tested this on linux 2.0.33, irix 6.2 and sun4-solaris, all
using perl 5.004_04 with the same results.

If none of these tests fail, under what circumstances will data get
clobbered?  

Thanks for clearing up this issue,
-Colin.
Another Perl Journeyman.





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

Date: Fri, 27 Mar 1998 19:22:50 GMT
From: epa@datcon.co.uk (Ed Avis)
Subject: File::Find
Message-Id: <351bc004.168387949@news-direct>

I've been trying to emulate the behaviour of 'find' using a Perl
script.  I'm using Perl for Win32, which doesn't include find2perl as
far as I can tell.

I've tried:

use File::Find;
sub wanted
{
  print "$_\n";
}
find(\&wanted, '/');

but this just prints out leafnames, not the full path.

What am I doing wrong?

--
Ed Avis


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

Date: 27 Mar 1998 19:51:11 GMT
From: dbwhite@btv.vnet.ibm.com (David B. White)
Subject: Re: File::Find
Message-Id: <6fgvvf$14ca$2@mdnews.btv.ibm.com>

In article <351bc004.168387949@news-direct>,
        epa@datcon.co.uk (Ed Avis) writes:
> I've tried:
>   print "$_\n";
> but this just prints out leafnames, not the full path.
> What am I doing wrong?

Does printing $name do what you want?
See http://www.perl.com/CPAN-local/doc/manual/html/lib/File/Find.html
or page 439 of Programming Perl, Second Edition for further enlightment.

--
David B. White
IBM Microelectronics, Circuit Verification & Design Tools
Internal: dbwhite@btv             Internet: dbwhite@vnet.ibm.com
Phone: 802-769-5671     (TieLine: 446)     Fax: 802-769-5722


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

Date: Fri, 27 Mar 1998 21:09:42 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: File::Find
Message-Id: <EqHxG6.KnC@world.std.com>

epa@datcon.co.uk (Ed Avis) writes:

>sub wanted
>{
>  print "$_\n";
>}
>find(\&wanted, '/');

>but this just prints out leafnames, not the full path.

They didn't strip out the documentation out of Find.pm, did they?

The package variable $File::Find::name contains the full path to the
file that is currently being worked on, and $File::Find::dir contains
the directory. You are also chdir()d to the directory the file is in,
So:

$File::Find::name
"$File::Find::dir/$_"
or
use Cwd;
cwd() . "/$_";

The easiest seems to be the first one.
-- 
Andrew Langmead


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

Date: 27 Mar 1998 19:35:50 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: find command equivalent in Perl
Message-Id: <6fgv2m$82b$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to 
<sadri@macsch.com>],
who wrote in article <6fecui$470$1@nnrp1.dejanews.com>:
> Hello Folks;
> 
> I am writing my first Perl Script on WinNT to look inside my temp directory
> and list all files within the directory and subdirectories which are over 5
> days old.


  pfind /temp "!-d" "-M > 5"

Pfind works like find, but takes Perl expressions as arguments (with a
couple of very useful shortcuts).

Availability: CPAN

Ilya


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

Date: Fri, 27 Mar 1998 21:31:15 +0100
From: Simon Moore <moore@spam-gone.lts.sel.alcatel.de>
Subject: forking & execing & killing
Message-Id: <351C0C93.41C67EA6@spam-gone.lts.sel.alcatel.de>

This is a multi-part message in MIME format.

--------------167EB0E72781E494446B9B3D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi there,

I'm trying to write a simple process watchdog routine and there's
something that's bothering me. I want it to be signal driven
so I've set up my perl script to respond to SIGUSR1 & start the
process when I send it the signal. 

To do this I fork a shell then start the process with exec from
within that shell. That seems to work fine. My problem
is that the process I just started doesn't respond to SIGTERM
anymore. 

If I don't fork a shell to do the exec, the process I started
responds to SIGTERM as expected. What's the difference?

I'm using Perl 5.004 on SunOS 4.1.3 if that helps.

I'm including the script I'm using as an attachment. I'd be very
grateful for any pointers you folks out there can give me.

Many thanks


Simon


-- 
"When your system's broke and it's nearly midnight"
"The ISO 9000 Quality System specification document should be leveraged
to
 obtain your optimal problem resolution capability".

--------------167EB0E72781E494446B9B3D
Content-Type: application/x-pl; name="startproc.pl"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="startproc.pl"

IyEgL3Vzci9sb2NhbC9iaW4vcGVybAoKIyRwcm9nbmFtZSA9ICcuL0VDLk5FMSc7CiMkYXJn
cyA9ICcuLi9jb25maWcvRnJhbWV3b3JrLk5FMS5jZmcgLi4vY29uZmlnL0lWTU8uY2ZnIC4u
L2NvbmZpZy9FQy9FQ0FwcGxpYy5ORTEuY2ZnIDEnOwoKJHByb2duYW1lID0gJ34xMzUzd3gv
ZG9tb3JlLnNoJzsKJGFyZ3MgPSAnc29tZSBhcmdzJzsKCnN1YiBoYW5kbGVyCnsKICAgJHNp
ZyA9IHNoaWZ0OwogICBwcmludCAiZ290IFNJRyRzaWdcbiI7CiAgIGV4aXQ7Cn0KCiRTSUd7
J0NIRCd9ID0gJFNJR3snQ0hMRCd9ID0gJ2hhbmRsZXInOwojJFNJR3snVEVSTSd9ID0gJ2hh
bmRsZXInOwokU0lHeydVU1IxJ30gPSAnc3RhcnRwcm9jJzsKCnN1YiBzdGFydHByb2MKewog
IGlmICgoJHBpZCA9IGZvcmspID09IDApCiAgewogICAgIHByaW50ICRTSUd7J1RFUk0nfSwg
IlxuIjsKICAgICAjIGNoaWxkCiAgICAgZXhlYyAkcHJvZ25hbWUsICRhcmdzOwogICAgIGRp
ZSAiZXhlYyBmYWlsZWRcbiI7CiAgfQoKICBwcmludCAicGlkID0gJHBpZFxuIjsKfQoKd2hp
bGUgKDEpCnsKICAgc2xlZXAgMTsKfQoKcHJpbnQgIndhaXRpbmdcbiI7CndhaXQ7CnByaW50
ICJleGl0aW5nXG4iOwo=
--------------167EB0E72781E494446B9B3D--



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

Date: Fri, 27 Mar 1998 16:52:41 -0500
From: Birgitt Funk <birgitt@order.booktraders.com>
Subject: Re: Going Rates for PERL Programming???
Message-Id: <351C1FA9.8EABE3B6@order.booktraders.com>

Peter Perchansky wrote:
> 
> Greetings Brian:
> 
> brian d foy wrote in message ...
> >In article <6fbg77$k1v@julius.ling.ohio-state.edu>,
> kcohen@julius.ling.ohio-state.edu (Kevin B Cohen) posted:
> 
> >i've been know to quote OUTRAGEOUS rates for some projects
> >that i really had no intention of doing.  some people just
> >don't get the hint that $9 trillion/hour is a nice way of
> >saying "no thanks". i bump up the rates that high for any
> >project which has the words "<some name> Script Archive" in
> >the description :)
> 
> What I find interesting are those times when one quotes a very high rate for
> the purpose of not getting the project... and then you are handed it...
> 

Yes, istn't it nice how you are "well paid" ...

Birgitt Funk


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

Date: Fri, 27 Mar 1998 20:14:09 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Help unpacking Little-Endian shorts and longs
Message-Id: <slrn6ho21t.4bl.jgloudon@manitoba.bbn.com>

Clinton Bodine <Clinton.Bodine@mci.com> wrote:
>I had tried a couple of them, but didn't play with all of them.  It turns
>out that n gives my the numbers I expect.  But aren't these values signed? 
>What happens when my unsigned shorts and longs has a 1 in the "sign" bit? 
>I won't get the results I expect, right?

Yech.. this means you have signed shorts in network order, which pack doesn't
have a type for.
You could get the correct sign on the extracted integers by running them
through a sub like

sub unsigned_to_signed { unpack ("s", (pack "s", $_[0]) ); }

although this is a bit convoluted. You can do this without using a sub of 
course.

-- 
Jason Gloudon


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

Date: 27 Mar 1998 21:39:02 GMT
From: Andy Matinog <nonoboy@idiom.com>
Subject: Re: IMAP support?
Message-Id: <6fh69m$ak9$1@news.idiom.com>

In comp.lang.perl.modules kjj@arf.eng.mcd.mot.com wrote:
> I'll be releasing an alpha version of Net::IMAP next week.

YES! I was considering writing one myself. The only main thing keeping
me from doing so was the RFC.

Thanks!

-----------
nonoboy@idiom.com
http://www.idiom.com/~nonoboy


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

Date: Fri, 27 Mar 1998 14:38:45 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Macperl
Message-Id: <pudge-2703981438450001@ppp-48.ts-1.kin.idt.net>

In article <6fg961$p0a$1@nnrp1.dejanews.com>, tchurch@gmu.edu wrote:

# I am new to Mac developement and have two problems in my first attempt.  I am
# trying to make a stand-alone app and have two discrepencies.
# 
#     1.  The script works fine on my machine, but when I port it I get error
#         messages that tell me perl cannot find Macperl::DoApplescript.  The
#         applescript is to open the select file window when the user double-
#         clicks on the app.  The drag and drop part works just fine.
# 
#     2.  Whenever the script exits, it leaves an instance of Macperl running
#         under the finder(? top left corner list on the Mac).  I would like
#         the application to shut down completely and not have this instance
#         running.  Is this possible?

Apologies, I don't have much time to answer directly now ... I suggest
that you jump on the macperl list (details at
http://www.ptf.com/macperl/).  Also check out the review chapters of the
upcoming MacPerl book at the same address.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


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

Date: Fri, 27 Mar 1998 13:53:11 +0000
From: Joy Peterson <jpeterson@dtint.com>
Subject: Re: Need help with PERL programming
Message-Id: <351BAEE2.2B62@dtint.com>

masroor wrote:
> 
> I am trying to program the following, but having problems to capture a
> specific data. Any help would be appreciated.
> The following is the description.
> 
> 1)Say when you ping a machine from the command line in UNIX you get the
>   following.
> The command I am using to ping is "ping 10.10.10.10".
> 
> OUTPUT below
> ========================================================
> 64 bytes from 10.10.10.10: icmp_seq=0 ttl=255 time=0 ms
> 64 bytes from 10.10.10.10: icmp_seq=1 ttl=255 time=0 ms
> 
> 2) I would feed the above ping response back to my perl program, and in my
>    perl program I need to capture the "icmp_seq=0" information. But I am
>    unable to do so.
> 
> 3) I do the following to redirect the output of the ping to my perl
> script.
> 
>   % ping 10.10.10.10 | myprog.pl
> 
> 4) The contents of myprog.pl is below.
> 
>    #!/bin/perl
>    print "$ARGV[0]\n" ;
> 
> 5) The command "ping 10.10.10.10" is a continous command, it should never
>    stop. But when I do step #3 , the ping stops and I get no output.
> 
> 6) Basically my goal is to redirect of the ping output to myprog and
>    process the icmp_seq value, how can I capture the "icmp_seq" value ?

You are trying to get the data from the command line, but when you pipe
a command into myprog.pl as you are doing in step 3, the data will come
in through STDIN.

Try this instead:

#!/bin/perl
while ($line = <STDIN>) {
	print "$line";
}

Joy Peterson


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

Date: 27 Mar 1998 19:12:38 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Nested quantifier in regexp problem
Message-Id: <6fgtn6$enc@news-central.tiac.net>

In article <351dea42.5636082@nntp2.ba.best.com>,
Rick Freeman <rick@marinweb.com> wrote:

>two cats
>term 1 is two
>term 2 is cats
>
>"two cats"
>term 1 is two cats
>
>my "two cats"
>term 1 is my
>term 2 is two cats

>The problem is that the quantifiers + and * are giving me a headache
>(and of course it's a resume processing application, so "C++" is one
>of the first things people will try to search for).

[mike@stok tmp]$ ./try.pl
> my "two cats" like C++
Got 'my' pattern is my
Got 'two cats' pattern is two\ cats
Got 'like' pattern is like
Got 'C++' pattern is C\+\+
> my two cats
Got 'my' pattern is my
Got 'two' pattern is two
Got 'cats' pattern is cats
[mike@stok tmp]$ cat try.pl
#!/usr/local/bin/perl -w

use Text::ParseWords;

for (print '> '; <>; print '> ') {
  chomp;
  @words = shellwords $_;
  for (@words) {
    print "Got '$_' pattern is \Q$_\E\n";
  }
}

might be one lazy way of leveraging shellwords (but you might want to use
an eval block to catch errors from unbalanced quotes...)

Text::ParseWords is part of the standard distribution and has pod
documentation.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Sat, 28 Mar 1998 00:43:47 GMT
From: info@gadnet.com
Subject: Perl print email problem
Message-Id: <351c47a3.54847300@news.newsguy.com>

This is driving me nuts. What is wrong with this:

		$mailprog = '/usr/lib/sendmail';
		open(MAIL,"|$mailprog -t");
		print MAIL "To: info\@gadnet.com\n";
		print MAIL "From: test\@gadnet.com (Myname)\n";
		print MAIL "Subject: Test Subject\n\n";
		close (MAIL);

It returns an unspecified 'Server Error'.

This, on the other hand, does not return an error, but does not send
any email either:

		$mailprog = '/usr/lib/sendmail';
		open(MAIL,"|$mailprog -t");
		print MAIL "To: info\@gadnet.com";
		print MAIL "From: test\@gadnet.com (Myname)\n";
		print MAIL "Subject: Test Subject\n\n";
		close (MAIL);

The only difference is the carriage return character at the end of the
3rd line.

What's going on??????




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

Date: 27 Mar 1998 14:04:08 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <x77m5gj6qf.fsf@sysarch.com>

Randal Schwartz <merlyn@stonehenge.com> writes:

> >>>>> "brian" == brian d foy <comdog@computerdog.com> writes:
> 
> brian> you should get the authors' permission as well ;)
> 
> In fact, you should write a Perl program that sends email to the
> authors of all postings in this newsgroup thread asking for
> permission for that commercial act.
> 
> Oops, wrong thread.

randal, could you write that for me for free? i will be charging
exorbitant fees for viewing the dictionary and i won't pay you any
royalties.

:-)

uri


p.s. i am hereby asking for permissions to put on my web site those
definitions. i will just format definitions into table with no editing
and full attributions to the authors. i will pay 100% of the fees stream
of with a viewing charge of $0.00. is that fair to you authors?

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: 27 Mar 1998 15:19:06 -0600
From: Hal Snyder <hal@vailsys.com>
Subject: Re: rant: illiterate Perl programmers
Message-Id: <87u38jde7p.fsf@jaguar.vail>

It's not just Perl programmers - "it's"/"its" dyslexia is endemic.

What's next? Her's and your's? Sad times we're living in...


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

Date: 27 Mar 1998 15:15:34 -0600
From: Hal Snyder <hal@vailsys.com>
Subject: Suppressing "used only once"
Message-Id: <87vhszdedk.fsf@jaguar.vail>

We have a lot of legacy code requiring files that just define variables.

oldstuff.pl:
  $oldFoo = "gnarf";
  $theAnswer = 42;
  ...

proggy.pl:

  ...
  require ".../oldstuff.pl";
  ...

Just one small step forward for some persons would be the use of "-w",
but they are immediately punished by gobs of "used only once" warnings
about variables in the required file that are not used in the main
program.

I tried permutations of $^W and __WARN__ in the main program but was
unable to suppress "used only once" warnings for oldFoo, etc.

The [ugly] workaround we're using now is to insert after the require,

  (($oldFoo, ... other unused variables in oldstuff ...)) if (0);

Is there a better way to do this?


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

Date: 27 Mar 1998 16:48:32 -0500
From: Uri Guttman <uri@sysarch.com>
To: Hal Snyder <hal@vailsys.com>
Subject: Re: Suppressing "used only once"
Message-Id: <x74t0jkdov.fsf@sysarch.com>

Hal Snyder <hal@vailsys.com> writes:

> We have a lot of legacy code requiring files that just define variables.
> 
> The [ugly] workaround we're using now is to insert after the require,
> 
>   (($oldFoo, ... other unused variables in oldstuff ...)) if (0);
> 
> Is there a better way to do this?

use vars qw( $oldFoo, ... ) ;

put this in the oldfoo.pl file itself so it works for all new scripts.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


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

Date: Fri, 27 Mar 1998 19:47:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: trivial example reveals a taint problem?
Message-Id: <EqHtnB.EA8@world.std.com>

Howard Cohen <hoco@shell5.ba.best.com> writes:

>Can anyone explain what $ENV{ENV} is?

The ENV environment variable tells some bourne shell supersets (read
that as BASH and the Korn Shell, I think the POSIX shell specification
too. I should mention zsh too, since if I don't mention it, and Bob
Friesenhahn is reading this, he'll remind me about it again.) the name
of the file to read and source before executing. If this environment
variable points to a file that specifies aliases, then the actual
programs that execute when the script calls another program may not be
what the script programmer expects. The perlsec man page that was
previously cited shows $ENV{ENV} being deleted from the hash before
perl will run other programs.

Details about ENV can be found in the bash and ksh man pages, and the
BASH info documentation.

-- 
Andrew Langmead


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

Date: 27 Mar 1998 21:28:49 GMT
From: sitaram@diac.com (Sitaram Chamarty)
Subject: Re: trivial example reveals a taint problem?
Message-Id: <slrn6ho6hl.2ik.sitaram@ltusitaram.diac.com>

On 27 Mar 1998 03:15:22 GMT, Howard Cohen <hoco@shell5.ba.best.com> wrote:

>      Insecure $ENV{ENV} while running with -T switch at testit line 4.

$ENV is the name of a file that gets executed every time a
subshell is started.  This applies to ksh at least, and possibly
bash also.

As such, it is a security hole - your backtick hostname could be
triggering off ANYthing at all using that script.

If older perl's didnt do that, and your 5.004_004 does, I'd call
that a feature.  In the true sense of the word - not the Microsoft
sense :-)


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

Date: Fri, 27 Mar 1998 20:19:51 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: upgrade breakage?
Message-Id: <slrn6ho2cj.4bl.jgloudon@manitoba.bbn.com>

Jay Allen <jallen10@wvu.edu> wrote:
>Hey,
>
>Just wondering about something;  We are getting ready to upgrade our machines 
>from Solaris 2.5 to Solaris 2.6.  (The machines are Sun, btw).  Would anyone 
>happen to know if upgrading the OS will break my installations of PERL, or 
>installations of Netscape Enterprise Server on those machines? I'd appreciate 
>it if someone could warn me if they know of something that might break when 
>upgrading like this - I need to get back to our other systems people quickly, 
>and prepare to re-install stuff if need be when we upgrade, so I'd appreciate 
>it if any replies could be e-mailed to me at: jallen10@wvu.edu .  Thanks!

I have transplanted a perl 2.5.1 solaris binary and associated libraries to a 
2.6 machine. The basics work as well as dynamically loaded xs modules as well.

Summary of my perl5 (5.0 patchlevel 4 subversion 3) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos somehost 5.5.1 generic_103640-08 sun4u sparc sunw,ultra-2 '
    hint=previous, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-fast', gccversion=
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-Kpic', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Sep 23 1997 11:15:03
  @INC:
    /usr/local/lib/perl5/sun4-solaris/5.00403
    /usr/local/lib/perl5
    /usr/local/lib/perl5/site_perl/sun4-solaris
    /usr/local/lib/perl5/site_perl
    .

-- 
Jason Gloudon


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

Date: Thu, 26 Mar 1998 13:22:00 +0100
From: C.VOGEL@LINK-GOE.de (Chris Vogel)
Subject: Re: || and 'or' - implications?
Message-Id: <6q$AYN62tSB@-sweet.link-goe.de>

                                           Goettingen, Stardate 0907.39
Hi there,

I'll give it a try - even though I'm relative new to perl, too...
Please correct if I'm wrong.

  ian (Ian Macdonald) wrote in slrn6hit16.okf.ian@caliban.xs4all.nl on
  26.03.98 following lines, starting with '*'

* Can someone explain to me in lucid terms what the implications are of
* using the symbolic and literal forms?

Having a look at the the list of precedences of perl operators in
perlop you will find that the precedence of the symbolic written 'or'
'||' is higher than the one of the literal 'or' 'or'.

Inbetween both versions sits the list operator with its precedence.
'open' needs a list of parameters, eg. 'open FILEHANDLE, "<file.txt"'
Using parenthesis is left up to you, but might be important with the
use of 'or' or '||':

open FILEHANDLE, "<file.txt";       # open file.txt for reading
open(FILEHANDLE, "<file.txt");      # same

open FILEHANDLE, "<file.txt" or die;
    First try to open what is specified in the _list_ of parameters
    and then if the returnvalue is false die. The commands take this
    execution order, because the precedence of the list operator ','
    (comma) is higher (it binds more tightly) than the one of 'or'.

open FILEHANDLE, "<file.txt" || die;
    In this case '||' has the higher precedence than the list operator
    ','. This will be executed like: Is return value of "<file.txt" or
    return value of 'die' true (die will not be executed because the
    string is true). "<file.txt" returns itself and therefore the open
    command takes the right values as a list of parameters. The only
    difference is that this one will not die, if the open commands
    fails.

open(FILEHANDLE, "<file.txt") || die;
    This is the correct version of using '||' with open, because the
    parenthesis enclosing the list of parameters have a higher
    precedence than the '||' operator. The command will therefore work
    as expected.

open(FILEHANDLE, "<file.txt") or die;
    The parenthesis might make the line more readable to some people,
    but are not nessecary (see above example without them).

Hope this is right and helps - otherwise I got it wrong myself and
would appreciate a correction.

Chris.


--
   Gesetz 103: Ein paar hundert Lichtjahre koennen gute Freunde nicht trennen.
   (Wesley Crusher)



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

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

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