HDTenEightyP/NetNews huggingface dataset:
From: spaf@cs.purdue.edu (Gene Spafford)
Newsgroups: comp.lang.perl
Subject: Re: stat problem
Date: 6 Jan 1993 12:49:43 -0500
Organization: Department of Computer Sciences, Purdue University
NNTP-Posting-Host: uther.cs.purdue.edu
In-reply-to: jwh2@cornell.edu's message of Wed, 6 Jan 1993 15:10:16 GMT

In addition to the response pointing out that you need the full path
name (or, alternatively, you need to chdir to the directory you are
examining), you should consider changing

	if( -d $file) { next; }
	if( -B $file) { next; }
	$one_file[$ct] = $file;
	($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat($one_file[$ct]);
to
	if( -d $file) { next; }
	if( -B _) { next; }
	$one_file[$ct] = $file;
	($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size) = stat(_);

This saves on the number of underlying "stat" calls that need to be
made.

Other optimizations (like using a single associative array and/or
pruning) are left as an exercise to the reader. :-)
-- 
Gene Spafford
Software Engineering Research Center & Dept. of Computer Sciences
Purdue University, W. Lafayette IN 47907-1398
Internet:  spaf@cs.purdue.edu	phone:  (317) 494-7825
Newsgroups: comp.lang.perl
From: buboo@alf.uib.no (Ove Ruben R Olsen)
Subject: Re: How to run a Perl under DOS?
Organization: University of Bergen, Norway
Date: Fri, 8 Jan 93 03:26:28 GMT

Mike Scheidler writes:

>Could someone shed some light on how to execute a script using one of
>the DOS ports of perl?
>
>I've seen an example somewhere which wraps the invocation of PERL.EXE into
>a .BAT file (using %0 through %9 to pass any parameters), but it doesn't
>seem to exit cleanly for me when using DOS 5.0.

We use this for DOS-5.00:

@REM = (qq:
@echo off
perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
@end :) ;
# End of #! emulation for MS-DOS perl.


\Ruben.
(Want's to replace c:\command.com with c:\bin\perl)

-- 
        Ove Ruben R Olsen a Gnarfer and VI user. EMAIL: ruben@uib.no. 
     Maintaining the EX/VI-archive and a couple of the Comp.Editors FAQs.
    People that are ignorant tend to live a frustrated life, at least when 
     it comes to editing - But I do belive this is a general rule in life
Newsgroups: comp.lang.perl
From: drl@vuse.vanderbilt.edu (David R. Linn)
Subject: Query - arrays of files
Originator: drl@jester
Organization: Vanderbilt University School of Engineering, Nashville, TN, USA
Distribution: na
Date: Tue, 12 Jan 1993 15:51:45 GMT

I am having trouble attempting to use arrays of filehandles.  Is this
supported in perl?  For more details, read on.

I am now using perl to generate my named/DNS files.  In an attempt for
generality, I have added some #DNSInfo# comments to my host file that
describe, among other things, which subnets of Vanderbilt's class B
network belong to the School of Engineering.  I scan the whole file:
processing the #DNSInfo# comments, ignoring other comments and
collecting host info for later processing.

After the scan is complete, I know the number of subnet files for which
I need to generate PTR resource records and I tried to create an array
of file handles:

	# for now, I *know* @subnets == (100, 101, 102, 103)
	for $subnet (@subnets) {
		open($PTR[$subnet],">rev.$subnet");
	}

I thought that this would given me an arry @PTR of file handles to my
PTR RR files, one for each subnet.  I planned to write the PTR RR for a
given host with a statement like

	printf $PTR[$subnet] "%s\t\tPTR\t%s\n",
		$octet[3], "$canonical.$subdomian.$domain";

This didn't work and further reading has convinced me that it shouldn't
have.  However, the idea of using an array of file handles is still
appealing.  The problem comes in generating the file handle names.
Would any of you more-experienced folks care to suggest a way to do
this (or to explain why this is a bad idea)?

	 David
-- 
David R. Linn, System/Mail/News Manager	| INET: drl@vuse.vanderbilt.edu
Disclaimer: I speak only for myself	| Phone: [+1] 615-343-6164
      "Some do, some don't and that's the way of the world."
Newsgroups: comp.lang.perl
From: barr@pop.psu.edu (David Barr)
Subject: Re: getopts.pl bug fix
Organization: Penn State Population Research Institute
Date: Fri, 08 Jan 93 18:35:25 GMT

In article <1993Jan8.062100.20495@uvaarpa.Virginia.EDU> aks%anywhere@hub.ucsb.edu writes:
>First, if an option requires an argument and @ARGV is empty, its
>variable will get set to "shift @ARGV", which is "undef"; not a good
>thing to *set* a variable with.

Says who?

--Dave
-- 
System Administrator, Population Research Institute    barr@pop.psu.edu
#define ENOTTY          25              /* Not a typewriter */
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Arrgh: Looking for usenet news watcher
Originator: tchrist@pixel.convex.com
Date: Mon, 4 Jan 1993 14:17:37 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of mitra@pandora.sf.ca.us (Mitra):
:If you find it then I'd like a pointer to it as well

convex.com:/pub/perl/scripts/clip

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

    I think it's a new feature.  Don't tell anyone it was an accident.  :-)
            --Larry Wall on s/foo/bar/eieio in <10911@jpl-devvax.JPL.NASA.GOV>
Newsgroups: comp.lang.perl
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Converting ctime format into an integer ??
Originator: tchrist@pixel.convex.com
Date: Mon, 4 Jan 1993 23:37:38 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of mikewe@rigel.cs.pdx.edu (Michael C welsh):
:I am trying to convert the actual ctime format:
:
:	Sun Jan  3 14:17:18 PST 1993
:
:into an integer for comparison.....
:
:Does anyone know if there is anything laying around..or a really
:good and (gulp) easy way to do this ?????

Routines don't lay -- only people and chickens do.  Routines lie.
I guess if they had a promiscuous mode it might make a difference.

Anyway, FAQ 2.24 addresses this question.  You can get it from
convex.com in /pub/perl/info/faq if it's not on your system, 
and yes, I'll be putting out an update this week.

--tom

-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

    pos += screamnext[pos]  /* does this goof up anywhere? */
        --Larry Wall in util.c from the perl source code
From: okamoto@hpcc01.corp.hp.com (Jeff Okamoto)
Date: Mon, 11 Jan 1993 22:36:17 GMT
Subject: Problem with study under Perl 4.035?
Organization: An-Pan Man Headquarters
Newsgroups: comp.lang.perl

Just a tickler in case anybody missed this.

Here's a strange error that occurs in both 4.019 and 4.035, but works properly
on 4.010.

	$pat = "test";

	while ( <> ) { 
		study;
		if ( /$pat/o ) {
			print "Found pattern\n" ;
		} else {
			print "Didnt find\n";
		}
	}

If the input to this program is "test", "test" on two lines, 010 will
correctly report it was found twice, but 019 and 035 will say it wasn't
found on the second try.

Removing the call to study, or the /o trailer will solve the problem for
both 019 and 035.  Am I just doing something stupid?  Granted, the study
is pretty useless in this case, but the script should still work.
-- 
 \      oo	The New Number Who,
  \____|\mm	Jeff Okamoto
  //_//\ \_\	HP Corporate Computing & Services
 /K-9/  \/_/	okamoto@ranma.corp.hp.com
/___/_____\	
-----------	(415) 857-6236
Newsgroups: comp.lang.perl
From: Mark.McIntosh@engr.UVic.CA (Mark  McIntosh)
Subject: SUMMARY: Sun RPC Implementation
Organization: University of Victoria, Victoria, BC, Canada
Distribution: comp
Date: 05 Jan 93 22:56:54 GMT

I recently posted the question:

In article <MARK.MCINTOSH.92Dec17163608@sombrio.UVic.CA> you write:
>I am considering building a client-server system using Sun RPC.  Has
>anyone built a Perl interface to Sun RPC?  ie. it would allow Sun RPC
>calls to be made from a Perl program.

I received three responses.  Two of them were requests for a copy of
the information.  Randal Schwartz suggested there were examples of
this on convex.com, but I couldn't see anything obvious there.  I did
find a Perl client example at another FTP site, but I looked at this
before Christmas holidays and the site name escapes me now.  I didn't
turn up any RPC server examples.  It wasn't that clear in my question
that I wanted to do the server side in Perl as well.

One person suggested this "isn't for the weak of heart", which I
believe.  If anyone has any further pointers, I'd appreciate receiving
them.  Regrettably, I am not in a position to start work on a Perl
interface for Sun RPC from scratch.

Thanks for everyone's help,
Mark J. McIntosh <Mark.McIntosh@engr.UVic.CA>
____________________________________________________________________________
University of Victoria, Faculty of Engineering - Dean's Office
Box 3055, Victoria, BC, CANADA    \ "...the mystery of life isn't a problem to
V8W 3P6            (604) 721-6049  \    solve but a reality to experience." 
UUCP: ...!ubc-cs!uvicctr!sirius!mmcintos  \ from Dune
HOME: markvax!mmcintos@pacinfo.bc.ca
From: wiml@stein.u.washington.edu (William Lewis)
Newsgroups: comp.lang.perl
Subject: Re: X interface for perl programs
Date: 4 Jan 93 21:45:22 GMT
Article-I.D.: shelley.1iab5iINNspj
Organization: University of Washington
NNTP-Posting-Host: stein.u.washington.edu

rutt@paradise.mti.sgi.com (John C. Ruttenberg) writes:
>Has anyone made a GUI "toolkit" that perl programs can use?  The best thing
>would be simple enough to use in trivial little perl programs and would make a
>certain class of users pretty happy.

  Try looking into Wafe. It's a program that basically provides a Tcl
interface to a widget set (it's distributed expecting the Athena widget
set, but the docs claim it's easy to use any widget set.) You communicate
with the Wafe process via pipes. The distribution contains several examples
of Perl programs using Wafe to provide a graphical interface. One nice
feature is that since it's a separate process, your perl script doesn't
have to wake up for simple things like screen refreshes; and you don't have
to link together a new perl binary with special usersubs.
  It should be findable on archie; its "home" site is
ftp.wu-wien.ac.at:pub/src/X11/wafe/wafe-whatever.tar.Z  (whatever
version.)
Newsgroups: comp.lang.perl
From: lwall@netlabs.com (Larry Wall)
Subject: Re: bug with "last"
Organization: NetLabs, Inc.
Date: Mon, 11 Jan 1993 22:37:16 GMT

In article <cameron-930111155241-1-06364@fuligin> cameron@cs.unsw.oz.au writes:
: This loop runs three times.
: 
: 	for (('a','b','c'))
: 		{ print "\$_ is '$_'\n";
: 		  { last; }
: 		}
: 
: Surely it shouldn't? This is perl 4.035.

Remember that a bare block like

	{ last; }

is defined to be a loop that executes once.  Since "last" exits
the innermost loop, that's the block that it exits.

Larry
From: merlyn@ora.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: PERL
Date: 10 Jan 93 14:18:59 GMT
Article-I.D.: romulus.MERLYN.93Jan10061855
Organization: Stonehenge Consulting Services; Portland, Oregon, USA

>>>>> In article <1993Jan10.004928.19211@analsyn.gts.org>, anton@analsyn.gts.org (Anton J Aylward) writes:
Anton> You don't say how often to get two copies.  You don't say if you have to
Anton> buy them at the same time.

Anton> Two copies a year seems right, unless you are going to take one apart
Anton> and laminate each page.

Actually, you could probably ask OR&A to send you a copy a week for the
rest of your life.  I know it would make *my* life easier.

<grin>

qx/echo Just another Perl hacker, >&2/
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
merlyn@ora.com (semi-permanent) merlyn@reed.edu (for newsreading only)
factoid: "Portland, Oregon, home of the California Raisins and Lone-Star Beer!"
From: wiml@stein.u.washington.edu (William Lewis)
Newsgroups: comp.lang.perl
Subject: Re: Arrgh: Looking for usenet news watcher
Date: 4 Jan 93 21:36:56 GMT
Article-I.D.: shelley.1iaaloINNrtp
Organization: University of Washington
NNTP-Posting-Host: stein.u.washington.edu

tchrist@convex.COM (Tom Christiansen) writes:
>From the keyboard of mitra@pandora.sf.ca.us (Mitra):
>:If you find it then I'd like a pointer to it as well
>convex.com:/pub/perl/scripts/clip

  This is probably the script I saw. Unfortunately, I need to be able to
operate this over NNTP, so I'll probably end up doing a fair amount
of rewriting. (I'll post it if I ever end up with anything generally useful,
of course...) Anyway, thanks.
From: matthew@sunpix.East.Sun.COM (Matthew Stier - Sun NC Development Center)
Newsgroups: comp.lang.perl
Subject: Paralleling data collection.
Date: 11 Jan 1993 13:40:32 GMT
Organization: Sun Microsystems, Research Triangle Park, NC
Distribution: world
NNTP-Posting-Host: klondike.east.sun.com


Okay folks,  here is what I'm doing, and what I'd like to do.

First, I'm using perl to collect and process data on file servers at
my worksite.  I currently do this by grabbing a list of hostnames and
then stepping thru each of the hosts, rsh'ling and saving the results,
Then I do my processing.  Here's some sample code.

#
# Compile a sorted list of hosts to check
#
@hostnames = ();
while (($hostname, $aliases) = gethostent) {
        push(@hostnames, $hostname) if $aliases =~ /\bserver\d+\b/;
}
@chk_hosts = sort @hostnames;

#
# Run $task on each host, and save the result.
#
foreach $host (@chk_hosts) {
        # Rsh to $host, and execute df for local filesystems only
        open(RSH, "($rsh -n $host '$task') 2>&1 |") || next;
        undef $/; $task{$host} = <RSH>; $/ = '\n';
	close(RSH);
}


Notice that the each host is processed sequentially.  Nothing procludes 
running the $task on each hosts at the same time, except my ability to
write the code.  

I'd prefer to key all the data in memory. I don't want to have to juggle
around with log files more than I have to.  If someone has written a 
subroutine to do this, I'd like to get a copy of it.  I'm looking for
something along the lines of:

%task_out = &rsh($task, @hosts);


Thanks in advance
-- 
Matthew Lee Stier                          |
Sun Microsystems ---  RTP, NC  27709-3447  |     "Wisconsin   Escapee"
Email: matthew.stier@East.Sun.COM          |
Phone: (919) 469-8300 fax: (919) 460-8355  |
From: sommar@enea.se (Erland Sommarskog)
Newsgroups: comp.lang.perl
Subject: wantarray bug in (syb)perl?
Date: 5 Jan 93 13:05:32 GMT
Organization: Enea Data AB

I haven't tracked down the following very closely. It was simply
too easy to get around. But anyway, the code below doesn't seem
to work if I say "if (wantarray)" instead of "if ($wantarray)",
but seems to work OK when I catch wantarray in the beginning 
of the routine as I do.

I wouldn't say that has made me lose sleep, but I though someone
might be interest. If not, well another waste of bandwidth...

sybperl -v
This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.4 $$Date: 91/06/10 01:23:07 $
Patch level: 10

Copyright (c) 1989, 1990, 1991, 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 4.0 source kit.

sub sql {
    local(@sql) = @_;
;# Calls dbcmd for each element in @sql with the default DB handle and
;# the default sepatator. Each row is returned as a string with lines
;# separated by $SQL_sep. Return value is scalar or array depending on
;# wantarray. If a scalar is required, and there is more than one row,
;# only the first is returned.

    local($line, @res, @data, $stat, $_, $wantarray);

    $wantarray = wantarray;    # Seems to get cleared otherwise.

    foreach $line (@sql) {
       &dbcmd($def_handle, " $line") || &abort("dbcmd failed");
    }

    &dbsqlexec($def_handle) || &abort("dbsqlexec failed");

    while(($stat = &dbresults($def_handle)) != $NO_MORE_RESULTS) {
        &abort("dbresults failed") if $stat == $FAIL;
        while (@data = &dbnextrow($def_handle)) {
            foreach (@data) { s/^NULL$//; }
            push(@res, join($SQL_sep, @data));
        }
    }

    if ($wantarray) {       # only "wantarray" always gives false here.
       @res;
    }
    else {
       if (length(@res) > 1) {
           $" = "\n";
           &abort("single-row query returned more than one row:\n@row");
       }
       $res[$[];
    }
}
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
Jag gav en k{ck tjeck en check.
Newsgroups: comp.lang.perl
From: dennis@oakhill.sps.mot.com (Dennis Armstrong )
Subject: Re: X interface for perl programs
Reply-To: dennis@oakhill.sps.mot.com
Organization: Motorola Semiconductor Products Sector
Date: Thu, 7 Jan 1993 13:09:56 GMT

In article 1ia0pmINNgnj@fido.asd.sgi.com, rutt@paradise.mti.sgi.com (John C. Ruttenberg) writes:
> Has anyone made a GUI "toolkit" that perl programs can use?  The best thing
> would be simple enough to use in trivial little perl programs and would make a
> certain class of users pretty happy.
> -- 
> 
>                                       John Ruttenberg -- (203) 874-7154


There would be a couple hundred users at this site that are PERL hacks that would love to have just a 
plain X-Toolkit that is integrates with PERL.  Of coures a real GUI would be better.



+-------------------------------------------+----------------+
| Name     : Dennis Armstrong               |   *****        |
| Company  : Motorola Incorporated          |  * - - *       |
| Address  : 6501 William Cannon Drive West |  * @ @ *  HAVE |
|            Austin, Texas 78735-8598       | (|  U  |) A    |
| Mail Drop: OE37                           |  | \_/ |  NICE |
| Phone    : 512-891-2322                   |   \___/   DAY! |
| Internet : dennis@gort.sps.mot.com        |  __! !__       |
| UUCP     :                                | /  `-'  \      |
+-------------------------------------------+----------------+

Newsgroups: comp.lang.perl
From: mark@drd.com (Resident.Alien)
Subject: perl man index searching problem
Organization: DRD Corporation
Distribution: na
Date: Mon, 11 Jan 1993 20:43:24 GMT

163 drd:/home/tierra/mlawrenc/wip% man -d man/
open /usr/man/man1/man.1 to check for filters in cat < /usr/man/man1/man.1 | nrof
f -h -man - | col
no PRS for man.1 in /usr/man/pr1/man.1
Reformatting page.  Please wait ... nroff -h -man -  < /usr/man/man1/man.1 | (thi
s proc) | col> /tmp/man.19007
done
Valid sections for man.1 follow.  Choose the section
index number or string pattern. (0 for full page, RTN to quit.)

Idx  Subsections in man.1     Lines
 1   NAME                         2
 2   SYNOPSIS                    56
 3   DESCRIPTION                 68
 4   Section Selection           89
 5   Search Strategy             71
 6   Indexing                    71
 7   Online Problem Reports      23
 8   OPTIONS                    197
 9   EXAMPLES                    57
10   ENVIRONMENT                 47
11   FILES                       13
12   SEE ALSO                    13
13   NOTES                       81
14   DIAGNOSTICS                 99
15   RESTRICTIONS                20
16   BUGS                        15
17   AUTHOR                       3
18   COPYRIGHT                    6

Which section would you like? 5
running: more -s '+/^[  ]*S.Se.ea.ar.rc.ch.h S.St.tr.ra.at.te.eg.gy.y'   /tmp/man
.19007
pattern not found

Is my 'more' helplessly inadequate?  I'm running SunOS Release 4.1.1.

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
Patch level: 19
-- 
mark.lawrence@drd.com                                     (918)743-3013
DRD Corp., 5506 South Lewis Ave., Tulsa, OK 74105         (918)745-9037 fax
Xref: sparky comp.lang.perl:7765 biz.sco.general:5074
From: kumar@cleaver.mti.sgi.com (Kumar Venkat)
Newsgroups: comp.lang.perl,biz.sco.general
Subject: Re: Perl on SCO Open Desktop, SCO Unix 3.2v4
Date: 12 Jan 93 02:00:50 GMT
Organization: Silicon Graphics, Inc.

Regarding big.t failing ....


I was able to get around this by using the -DCRIPPLED_CC flag
with cc. Then perl passed all the tests in the suite. I may have
compromised some performance, but I am just glad to get perl
running.


Kumar Venkat
From: mab@wdl39.wdl.loral.com (Mark A Biggar)
Newsgroups: comp.lang.perl
Subject: Re: bug with "last"
Date: 11 Jan 93 22:31:51 GMT
Organization: Loral Western Development Labs

In article <1993Jan11.175416.3503@netcom.com> lgolding@netcom.com (Laurence J. Golding) writes:
>	... If the LABEL is omitted, the loop control statement refers to
>	the innermost enclosing loop.
>Now, in your example, the "{last;}" certainly does not look like a loop,
>and the "for" certainly does look like the innermost enclosing loop.  So it
>appears that the book should read:
>	... If the LABEL is ommitted, the loop control statement refers to
>	the innermost enclosing _block_.

This rule doesn't work because last ignores BLOCKS that are branches of
if statements and the BLOCK in a do {...} expression.  As the book and man 
page say a unadorned BLOCK is equivalent to a do-it-once loop.  Now you
might get away with saying "the innermost BLOCK that is the body of a loop"
but that would get confused with my last does not work with do {...} while();
So, I guess the best thing is to just leave it alone.

--
Perl's Maternal Uncle
Mark Biggar
mab@wdl1.wdl.loral.com
From: ckclark@athena.mit.edu (Calvin Clark)
Newsgroups: comp.lang.perl
Subject: Re: "Secure" way to find out hostname
Date: 6 Jan 1993 17:22:54 GMT
Organization: Massachusetts Institute of Technology
Reply-To: ckclark@mit.edu
NNTP-Posting-Host: w20-575-84.mit.edu
In-reply-to: lusol@Lehigh.EDU's message of 6 Jan 93 14:01:49 GMT

In article <1993Jan6.140149.11253@Lehigh.EDU> lusol@Lehigh.EDU (Stephen O. Lidie) writes:


   $euid = $>;               # user  
   $> = $<;          
   ..
   chop($hostname = `/bin/hostname`);
   ..
   $> = $euid;               # back to root or whatever


   OK you Perl heavies, let's hear the full 'how to untaint' story....

A full enough story is in the perl man page.  The likely problem here is
that taintperl does not trust $PATH inherited from the environment, and
if you try to set $ENV{'PATH'}, it cannot reference any variable
previously marked as tainted.  So this is okay:

	$ENV{'PATH'} = "/bin:/usr/bin";
	chop($hostname = `/bin/hostname`);

but this bad:

	$oldpath = $ENV{'PATH'};
	$ENV{'PATH'} = "/bin:/usr/bin:$oldpath";
	chop($hostname = `/bin/hostname`);

Simply specifing /bin/hostname is not good enough for taintperl, since
it doesn't know that /bin/hostname won't execvp() or system() or
popen() some random command using the user-specified path.

A fairly complete explanation of what you have to do to your scripts is
given in the Camel Book.

-Calvin
--
Calvin Clark <ckclark@mit.edu>
Newsgroups: comp.lang.perl