[9248] in Perl-Users-Digest
Perl-Users Digest, Issue: 2843 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 11 15:07:14 1998
Date: Thu, 11 Jun 98 12:01:40 -0700
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, 11 Jun 1998 Volume: 8 Number: 2843
Today's topics:
Re: McCabe complexity analysis (Georg Bauer)
Re: McCabe complexity analysis (Georg Bauer)
Re: McCabe complexity analysis (Georg Bauer)
Re: MODERATION: Time to Vote (John Stanley)
Re: MODERATION: Time to Vote (Stuart McDow)
Re: MODERATION: Time to Vote <jdporter@min.net>
Re: MODERATION: Time to Vote <jdporter@min.net>
Re: Multiple $ENV{PATH} entries on Win NT (Ethan H. Poole)
Re: open pipe? <David.Boyce@fmr.com>
Re: Opening Files (Andre L.)
Re: Passing variables from bourne script to perl script (Charles DeRykus)
PASV (Tu-Thach)
Re: Perl Books? <postmaster@castleamber.com>
Re: Perl Books? <ewy@iti-oh.com>
Re: Perl Books? <coreyp@rc.gc.ca>
Redirecting STDOUT/STDERR to a file <adroeder@att.com>
Re: RTFM <adroeder@att.com>
Re: RTFM <adroeder@att.com>
Re: Where is the robot? (Kevin Reid)
Re: Why it's stupid to `use a variable as a variable na (Kevin Reid)
Re: Why it's stupid to `use a variable as a variable na (Sean McAfee)
Re: Win32 error message <bowlin@sirius.com>
Win32::GetShortPathName bug? (Kevin Radke)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 11 Jun 1998 16:56:41 GMT
From: gb@hugo.westfalen.de (Georg Bauer)
Subject: Re: McCabe complexity analysis
Message-Id: <gb-1106981856420001@hugo.westfalen.de>
In article <6ljmjc$rkg$2@client3.news.psi.net>, abigail@fnx.com wrote:
>That's a silly argument, as Pascal has if and not.
language wars and sneezy comments about other languages _are_ silly.
bye, Geog (feeling sometimes _very_ silly)
--
"Sicher ist, das nichts sicher ist. Aber selbst das nicht."
- Ringelnatz
------------------------------
Date: Thu, 11 Jun 1998 16:43:27 GMT
From: gb@hugo.westfalen.de (Georg Bauer)
Subject: Re: McCabe complexity analysis
Message-Id: <gb-1106981843270001@hugo.westfalen.de>
In article <m3bts2otbm.fsf@windlord.Stanford.EDU>, Russ Allbery
<rra@stanford.edu> wrote:
>> if ((handle = fopen(file_name, mode)) == NULL)
> if (handle = fopen (file_name, mode)) return -1;
Hmm. Those two lines look different to me ...
bye, Georg
--
"Sicher ist, das nichts sicher ist. Aber selbst das nicht."
- Ringelnatz
------------------------------
Date: Thu, 11 Jun 1998 16:51:45 GMT
From: gb@hugo.westfalen.de (Georg Bauer)
Subject: Re: McCabe complexity analysis
Message-Id: <gb-1106981851460001@hugo.westfalen.de>
In article <6lkena$qbl$1@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:
> I wonder why these allegedly respected authors seem
> to thing there's some different between
> if (p)
> and
> if (p == NULL)
> When of course, there isn't.
Uh - sure?
[(p == NULL) same as (!p)] not same as [(p) same as (p != NULL)] looks
much better to me ...
bye, Georg
--
"Sicher ist, das nichts sicher ist. Aber selbst das nicht."
- Ringelnatz
------------------------------
Date: 11 Jun 1998 17:43:15 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: MODERATION: Time to Vote
Message-Id: <6lp4vj$stp$1@news.NERO.NET>
In article <6lp028$js5$1@ns1.arlut.utexas.edu>,
Stuart McDow <smcdow@arlut.utexas.edu> wrote:
>stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>>
>> Gosh, 57 lines, including quotes and headers. What invective. But Tom
>> has no interest in keeping the discussion civil.
>
>Take it to news.groups, please.
Tom started this thread. Why didn't you tell him the same thing?
------------------------------
Date: 11 Jun 1998 18:32:53 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: MODERATION: Time to Vote
Message-Id: <6lp7sl$ieu$1@ns1.arlut.utexas.edu>
stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
>
> Tom started this thread.
Yeah. And?
> Why didn't you tell him the same thing?
I'm sure he read my posting.
--
Stuart McDow Applied Research Laboratories
smcdow@arlut.utexas.edu The University of Texas at Austin
"Look for beauty in roughness, unpolishedness"
------------------------------
Date: Thu, 11 Jun 1998 18:49:41 GMT
From: John Porter <jdporter@min.net>
Subject: Re: MODERATION: Time to Vote
Message-Id: <3580283C.2CAD@min.net>
Stuart McDow wrote:
>
> stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
> >
> > Tom started this thread.
>
> Yeah. And?
>
> > Why didn't you tell him the same thing?
>
> I'm sure he read my posting.
Don't be sure.
tchrist kills all cross-posted articles.
John Porter
------------------------------
Date: Thu, 11 Jun 1998 18:51:56 GMT
From: John Porter <jdporter@min.net>
Subject: Re: MODERATION: Time to Vote
Message-Id: <358028C4.7EEE@min.net>
Stuart McDow wrote:
>
> stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
> >
> > Tom started this thread.
>
> Yeah. And?
>
> > Why didn't you tell him the same thing?
>
> I'm sure he read my posting.
Don't be sure.
tchrist kills all cross-posted articles.
John Porter
------------------------------
Date: 11 Jun 1998 17:36:42 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: Multiple $ENV{PATH} entries on Win NT
Message-Id: <6lp4ja$1v$1@gte1.gte.net>
In article <MPG.fe993ee9cd30cac9896ba@nntp.hpl.hp.com>, lr@hpl.hp.com says...
>
>In article <6loqo5$jsc$1@nnrp1.dejanews.com>, holgerman@my-dejanews.com
>says...
>> I am trying to set an explicit $ENV{PATH} at the beginning of my Perl CGI
>> scripts for security reasons. Under UNIX, I would set something like
>>
>> $ENV{PATH} = '/usr/bin:/bin:/usr/sbin';
>>
>> Every path entry was seperated by a colon and that was it. Under NT, I need
to
>> set something like
>>
>> $ENV{PATH} = 'c:/system32/winnt';
>>
>> Unfortunately, Perl on Win seems to now treat the colon as part of the path,
>> not as a seperator.
>>
>> Anybody knows how to add more than one? I am on NT Server 4.0, using
>> ActiveWare's Perl for Windows, Build 315.
>
>Use semicolon. Surprise!!!
Perhaps more precisely, use the $^O variable to test for the OS and if it
contains "Win32", use a semicolon, else use the colon (simply assuming unix
platform if not a Win32 platform).
--
Ethan H. Poole | Website Design and Hosting,
| CGI Scripting...
========Personal========= | ============================
* ehp @ gte . net * | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/
------------------------------
Date: Thu, 11 Jun 1998 13:00:37 -0400
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: open pipe?
Message-Id: <35800D35.460F9AC2@fmr.com>
> open(DATA, '</root/dbfile') ;
The DATA filehandle is special - use a different name.
-David
------------------------------
Date: Thu, 11 Jun 1998 14:44:59 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Opening Files
Message-Id: <alecler-1106981444590001@dialup-507.hip.cam.org>
In article <357F2B3A.602E@linex.com>, ted <teds@linex.com> wrote:
> How would I open and read all the files in a folder without
> naming the files in my script? I'm working with Macperl.
>
> Would appreciate any help. Thanks in advance.
>
> -Ted
> teds@linex.com
This solution involving File::Find appears to work, but I'm on a bit of a
shaky ground. Gurus, feel free to blast if something is wrong.
Uncomment the $File::Find::prune line if you don't want to search nested
directories.
I'm hoping Chris will jump in with some MacOS specifics, if any.
#!/usr/local/bin/perl -w
use File::Find;
$dir = 'Hard Disk:Some Folder'; # MacOS path
sub Read_files {
# $File::Find::prune = 1;
if ((not -d) && (open THIS, $_)) {
# read the file and do whatever
close THIS;
}
}
find(\&Read_files, $dir);
__END__
A.L.
------------------------------
Date: Thu, 11 Jun 1998 18:13:55 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Passing variables from bourne script to perl script
Message-Id: <EuEFz7.5o4@news.boeing.com>
In article <358022FF.559B30AC@hal.ddntl.didata.co.za>,
Mark Fergusson <mferg@hal.ddntl.didata.co.za> wrote:
>
>I have a boune shell script which contains a number of variables (about
>20). Some of these varaiables contain a long sentence. I need to run a
>perl script from here and pass these variables to the perl script.
>
>Eg.
>
>#script1
>!#/bin/sh
>variable1="this is a long sentence which can contain *:()&^% etc"
>variable2="test"
>
>#run perl script
>./script2
>
>when I run ./script1
>perl script (script2) needs to set $variable1 and $variable2 as above.
>
>#!/usr/local/bin/perl
># variable1 & variable2 set as in script1
># <help here>
>$variable1="this is a long sentence which can contain *:()&^% etc";
>$variable2="test";
>
perldoc Env for full details.
Here's an example:
#!/bin/sh
variable1="this is a long..."
export variable1
./script2
#!/usr/bin/perl -w
use Env qw(variable1 variable2);
print "$variable1\n"; # etc ...
HTH,
--
Charles DeRykus
------------------------------
Date: 11 Jun 1998 18:25:46 GMT
From: tuthach@argo.unm.edu (Tu-Thach)
Subject: PASV
Message-Id: <6lp7fa$11e6$1@lynx.unm.edu>
I wrote a PERL program to ftp to my host and get a file. I can login and
everything. but after that, my code looks
print MYSOCK "PASV\r\n";
print MYSOCK "RETR $filename\r\n";
and the output prints "Entering Passive Mode (bunch of numbers)"
and halts there forever. Am I doing something wrong? Or missing
something?
Thanks
------------------------------
Date: 11 Jun 1998 17:06:22 GMT
From: "John Bokma" <postmaster@castleamber.com>
Subject: Re: Perl Books?
Message-Id: <01bd955b$9877ea00$02521e0a@tschai>
Gary M. Greenberg <garyg@gator.net> wrote in article
<MPG.fe8f0beda6f2e06989682@news.gator.net>...
> In article <6lk5qf$kdu$1@nnrp1.dejanews.com>, ptimmins@netserv.unmc.edu
> says...
> [snip]
> > Try O'Reilly and Assoc at www.oreilly.com
> >
> > Learning Perl, 2nd Edition (Schwartz, Christiansen, and Wall)
> > Programming Perl, 2nd Edition (Wall, Christiansen, and Schwartz)
> >
> > "Learning ..." is intro, 302 pp, $29.95 American
> > "Programming ..." is the main reference, 670 pp, $39.95 American
>
> And, let's not forget that all O'Reilly later editions are 25% off to
> you when you tear out the title page from your old edition and mail it
> in with your order for the new one ;-p
What!? That's torture of animals. Ripping the skin of a Lama or Camel.
John
--
------------------------------------------------------------------
C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
http://www.castleamber.com/ john@castleamber.com
NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
------------------------------
Date: Thu, 11 Jun 1998 13:54:03 -0400
From: "Eric Youngquist" <ewy@iti-oh.com>
Subject: Re: Perl Books?
Message-Id: <6lp5so$qc$1@malgudi.oar.net>
or go to www.bookpool.com and get 32-38% off all O'Reilly books. No need to
tear any pages out...
(BTW. I have not affiliation with bookpool, I just buy my books there.)
(
John Bokma wrote in message <01bd955b$9877ea00$02521e0a@tschai>...
>
>
>Gary M. Greenberg <garyg@gator.net> wrote in article
><MPG.fe8f0beda6f2e06989682@news.gator.net>...
>> In article <6lk5qf$kdu$1@nnrp1.dejanews.com>, ptimmins@netserv.unmc.edu
>> says...
>> [snip]
>> > Try O'Reilly and Assoc at www.oreilly.com
>> >
>> > Learning Perl, 2nd Edition (Schwartz, Christiansen, and Wall)
>> > Programming Perl, 2nd Edition (Wall, Christiansen, and Schwartz)
>> >
>> > "Learning ..." is intro, 302 pp, $29.95 American
>> > "Programming ..." is the main reference, 670 pp, $39.95 American
>>
>> And, let's not forget that all O'Reilly later editions are 25% off to
>> you when you tear out the title page from your old edition and mail it
>> in with your order for the new one ;-p
>
>What!? That's torture of animals. Ripping the skin of a Lama or Camel.
>
>John
>
>
>--
>------------------------------------------------------------------
>C A S T L E A M B E R Software Development (Java/Perl/C/CGI)
>http://www.castleamber.com/ john@castleamber.com
>
>NEW: http://www.binaries.org/ Guide to Program Binaries & Pictures
>
------------------------------
Date: Thu, 11 Jun 1998 15:18:44 GMT
From: "Corey Parsons" <coreyp@rc.gc.ca>
Subject: Re: Perl Books?
Message-Id: <EuE7vI.Cv@rc.gc.ca>
also try www.mcp.com they have a number of electronic books online from
publishers like QUE.
------------------------------
Date: Thu, 11 Jun 1998 13:42:15 -0400
From: Tony Roeder <adroeder@att.com>
Subject: Redirecting STDOUT/STDERR to a file
Message-Id: <358016F7.C07204B3@att.com>
This is a multi-part message in MIME format.
--------------3ACBB46E77B0092ED0FADA49
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Using Perl under Windows NT - could someone clarify exactly (a code
example) how to redirect STDOUT and STDERR to a file. Thanks in advance.
--------------3ACBB46E77B0092ED0FADA49
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Tony Roeder
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Tony Roeder
n: Roeder;Tony
org: AT&T
email;internet: adroeder@att.com
title: Technical Staff Member
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------3ACBB46E77B0092ED0FADA49--
------------------------------
Date: Thu, 11 Jun 1998 13:10:01 -0400
From: Tony Roeder <adroeder@att.com>
To: adroeder@att.com
Subject: Re: RTFM
Message-Id: <35800F69.9A8AB5BF@att.com>
> >> Learning Perl on Win32 Systems by Randal L. Schwartz, Tom Christiansen,
> >> Erik W. Olson, published by O'Reilly
>
> >> Haven't read it ... but I hear it's good.
FYI : I have read this book and found it very helpful as I amn getting ready to
code some NT Administrator-type programs that do nightly extracts of Visual Cafe
.java files from Visual Source Safe and then build and jar them to a working
directory pointed to by IIS.
Tony R.
------------------------------
Date: Thu, 11 Jun 1998 13:12:08 -0400
From: Tony Roeder <adroeder@att.com>
To: adroeder@att.com
Subject: Re: RTFM
Message-Id: <35800FE8.412EDD92@att.com>
> >> Learning Perl on Win32 Systems by Randal L. Schwartz, Tom Christiansen,
> >> Erik W. Olson, published by O'Reilly
>
> >> Haven't read it ... but I hear it's good.
FYI : I have read this book and found it very helpful as I amn getting ready to
code some NT Administrator-type programs that do nightly extracts of Visual Cafe
.java files from Visual Source Safe and then build and jar them to a working
directory pointed to by IIS.
Tony R.
------------------------------
Date: Thu, 11 Jun 1998 14:32:57 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Where is the robot?
Message-Id: <1dagq0d.1ksyb6b4rz3bqN@slip166-72-108-44.ny.us.ibm.net>
David Graff <dgraff@computex.com> wrote:
> Ok i'm a newbie on the group and should be ogg'ed for this...i'm
> lost...what's the point of this? *laughing nervously at other
> responses*
Whenever open() is used without 'or die "..."', somebody replies saying
they should be checking the return value of open().
Somebody got the idea that there was an auto-responder posting these
messages. Therefore, the original message was a test to see if the
(non-existant) auto-responder would reply to the message.
> F.Quednau wrote:
>
> > If I'd say to you:
> >
> > open (THEBOTTLE, "< $with_a_screwdriver"); #!!!
> >
> > Would you really do it?
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Thu, 11 Jun 1998 14:32:53 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Why it's stupid to `use a variable as a variable name'
Message-Id: <1daflxm.nmi5dosz59f0N@slip166-72-108-44.ny.us.ibm.net>
Zenin <zenin@bawdycaste.org> wrote:
> Mark-Jason Dominus <mjd@op.net> wrote:
> >snip<
> : The main point of this article was to present a real example of a case
> : where using a variable as a variable name was a really stupid thing to
> : do.
> >snip<
>
> But just don't forget that you can do it when you need to. There
> are valid reasons to use soft refs, it's just that most of them
> are at the wizard level.
>
> Always, always use strict. If you have a small piece that needs
> soft refs, subs, etc then mark it as such:
>
> use strict;
> {
> no strict 'refs'; # eg, warning: we are doing funky things here
> ...magic only goes here...
> }
TMTOWTDI. If you want obfuscation, you can also get around "use strict
'refs'" by accessing the symbol table:
$var = "Yup!\n";
print ${$::{'var'}{SCALAR}};
--
Kevin Reid. | Macintosh.
"I'm me." | Think different.
------------------------------
Date: Thu, 11 Jun 1998 18:52:55 GMT
From: mcafee@gorf.rs.itd.umich.edu (Sean McAfee)
Subject: Re: Why it's stupid to `use a variable as a variable name'
Message-Id: <bIVf1.535$Y3.2848083@news.itd.umich.edu>
In article <1daflxm.nmi5dosz59f0N@slip166-72-108-44.ny.us.ibm.net>,
Kevin Reid <kpreid@ibm.net> wrote:
>Zenin <zenin@bawdycaste.org> wrote:
>> Always, always use strict. If you have a small piece that needs
>> soft refs, subs, etc then mark it as such:
>> use strict;
>> {
>> no strict 'refs'; # eg, warning: we are doing funky things here
>> ...magic only goes here...
>> }
>TMTOWTDI. If you want obfuscation, you can also get around "use strict
>'refs'" by accessing the symbol table:
>$var = "Yup!\n";
>print ${$::{'var'}{SCALAR}};
ITYM
print ${*{$::{'var'}}{SCALAR}};
or, more succinctly,
print ${*{$::{'var'}}};
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Thu, 11 Jun 1998 11:01:22 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: michael_stahl@peoplesoft.com
Subject: Re: Win32 error message
Message-Id: <35801B72.796E9AF6@sirius.com>
frinteru@hotmail.com wrote:
>
> Hello all,
>
> I am running a perl script to automate some processes on an NT machine using
> Perl 4.003 for Win32. The error message that I am getting is as follows:
>
> Can't locate object method "autoflush" via packager "IO::Handle" at autorps
> line 83.
>
> It should not look for the IO::handle.pm or should it? does the environment
> have to be set right in your system path?
>
> We are operating in an mks environ.
>
> Any help would be appreciated.
I have been using Perl on an NT for quite some time. I suggest you use
the standard distribution 5.004.02 instead of the ActiveState distribution.
This will solve a lot of problems. I realize that switching over may be
painful, but the sooner you switch, the easier it will be. The standard
distribution works better, comes with the standard modules that people in
this group refer to and has tons of documentation.
I do hope this helps, -- Jim Bowlin
------------------------------
Date: 11 Jun 1998 18:22:05 GMT
From: radke@dsdl.ee.iastate.edu (Kevin Radke)
Subject: Win32::GetShortPathName bug?
Message-Id: <6lp78d$mip$1@news.iastate.edu>
As the following code shows, it appears
Win32::GetShortPathName is returning a string
that is too long. This is running under Windows NT v4 SP3.
A quick look at the output of this test file shows an embedded
null character in the returned string. My guess is it is
returning a buffer the length of the input string. Or am
I doing something incorrectly? This is the 5.004_02 perl
binary distribution from CPAN...
U:\perl>perl -v
This is perl, version 5.004_02
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
U:\perl>type shortname.pl
use Win32;
my ($long_name) = "C:\\Program Files\\";
my ($short_name) = Win32::GetShortPathName ($long_name);
print ("Short name is '$short_name'\n");
U:\perl>perl shortname.pl
Short name is 'C:\PROGRA~1\ les\'
Kevin
------------------------------
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 2843
**************************************