HDTenEightyP/NetNews huggingface dataset:
From: tal@Warren.MENTORG.COM (Tom Limoncelli)
Subject: suid mount wrapper
Followup-To: poster
Organization: Mentor Graphics -- IC Group
Date: Mon, 31 Aug 1992 17:00:23 GMT

I'm looking for a tperl script that can be used as a wrapper
for "/etc/mount".  In other words, people want to be able to
mount cdrom's and floppy disks.

I'm sure 100 people have written this already, so rather
than re-invent the wheel.

The one feature I'm really looking for is something that will
get the hostname (in a taint-save way) so I can only let this
program run on certain machines.

Thanks in advance,

Tom
P.S.  Send me email and I'll post a summary.
-- 
Tom Limoncelli -- tal@warren.mentorg.com (work) -- tal@plts.uucp (play)
"Oh! I thought it was one of those useless demos of everything that
    a GUI builder could do." -Anonymous person watching demo of
         Solaris 2.0's graphical tool for managing NIS+
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Fast String Operations?
Date: 27 Aug 92 00:27:21 GMT
Organization: NetLabs, Inc.

In article <1992Aug25.151625.3134@IDA.ORG> rlg@IDA.ORG (Randy garrett) writes:
: I'm looking for the fastest way to perform the following operation.
: Basically, this is a conversion of one database format to another.
: If I have a NULL field, indicated by 2 pipe symbols next to
: each other, I want to insert either a -1 or a ~ between the 
: two pipes, depending upon whether the type of that field
: is a integer or a character.  I know the type of the field
: because I've already pre-filled that array with the correct
: types from the Data Dictionary (Thanks Sybase to Perl Interface!).
: 
: So, I read in a series of lines from a file.  If I find 2 pipe 
: symbols adjacent to each other, "||", in the input string, I want
: to insert either a ~  or a -1 depending on the type of that field,
: which I get from the @name array.

There's a very important piece of information that you left out.  Namely,
what percentage of the lines do you expect will have a null field?  If
many lines don't have null fields, you want to say this:

    while (<INPUT>) {
	next unless /\|\|/;
	# replacement algorithm goes here
    }

This sort of short circuit can save you oodles of time, regardless of
how inefficient your replacement algorithm is.  Presuming, of course,
that most lines will be rejected immediately.

If most lines have null fields, then it's a waste of time to do the
short circuit, and you can just go straight for one of the split
methods previously posted (preferably the correct one).

Alternately, (there's always an alternately) you can do something
fancy like this:

    #!/usr/bin/perl

    $/ = '|';
    @default = (-1,'~',-1,-1,'~',-1,'~',-1);

    while (<>) {
	$field = 0, print "\n" if s/^\n//;
	next unless /^\|/;
	print $default[$field];
    }
    continue {
	print;
	++$field;
    }

This presumes there's always a | right before the "\n".  It seemed from
your description that this is so, but it wasn't explicit.

Anyhoo, try them out on your data, and see which one is faster.  I can't
predict without seeing the data.

By the way.  Just between you and me and the gatepost, this *might*
be a better job for C than for Perl, if you only have to support this
on one architecture.  C is better than Perl at character crawling:

    #include <stdio.h>

    char *def[] = {"-1","~","-1","-1","~","-1","~","-1"};

    main() {
	int ch;
	int lastch;
	int field = 0;

	while ((ch = getc(stdin)) != EOF) {
	    if (ch == '\n')
		field = 0;
	    else if (ch == '|') {
		if (lastch == '|')
		    fputs(def[field], stdout);
		field++;
	    }
	    putc(ch, stdout);
	    lastch = ch;
	}
    }

Or sumph'n like that.

Larry
Newsgroups: comp.lang.perl
From: wengland@stephsf.com (Bill England)
Subject: Re: C cross referencer (was Re: locsym)
Date: Fri, 4 Sep 1992 01:46:15 GMT
Organization: Stephen Software Systems Inc., Tacoma/Seattle, +1 800 829 1684
X-Bytes: 1373

In article <22274@venera.isi.edu> rod@venera.isi.edu (Rodney Doyle Van Meter III) writes:
>[...]
>
>The next tool I'm looking for is a C cross referencer that will
>handle ANSI syntax.  Perl is the obvious choice for writing
>such a tool; has anyone done it?  I invested about two hours
>in an extremely primitive one myself, but I don't want to
>reinvent the wheel if somebody has designed and written one
>already.

   Hmm, I'm not sure what you mean by "handle ANSI syntax."
   The easy way is to let your C compiler do the work and then
   pull the symbols out of the object files and libraries.

   The current version of GCC will produce "file.X" output
   that includes all function calls to a program, (properly
   protoized even. )  I did hack a quick perl function
   to combine a bunch of .X's into a single prototype.h file 
   for an application.  -I'll try and post that tomorrow-

>I like to use it as I'm writing. cxref supplied w/ SunOS
>barfs on my ragged code, and can't handle ANSI.

   True.  Which compiler are you using on your Sun?
-- 
 +-  Bill England,  wengland@stephsf.COM -----------------------------------+
 |   * *      H -> He +24MeV                                                |
 |  * * * ... Oooo, we're having so much fun making itty bitty suns *       |
 |__ * * ___________________________________________________________________| 
Newsgroups: comp.lang.perl
From: pomeranz@irving.nas.nasa.gov (Hal R. Pomeranz)
Subject: Re: comp.lang.perl.scripts (?)
Organization: NAS, NASA Ames Research Center, Moffett Field, CA
Date: Wed, 26 Aug 92 15:50:46 GMT

In article <1992Aug26.095418.11990@eskimo.celestial.com> Ken Pizzini writes:
>
> I think that at least a keyword, and perhaps a new group, is a good
> idea so that automated archivers can readily spot "source".
>

On rec.arts.tv.soaps tanjential threads are prefaced with a "TAN:" in
the subject line, e.g. 

	Subject: TAN:Disgusting foods

We could agree to something like a "SRC:" prefix.  It's easy to include
in your kill file and easy for archivers to spot, and not too much work
to type.

--
===============================================================================
Hal Pomeranz     Senior Member of Technical Staff     NASA Ames Research Center
	     pomeranz@nas.nasa.gov     pomeranz@cs.swarthmore.edu
       "Tell me are we living or are we wasting time?"  --Law and Order
Newsgroups: comp.lang.perl
From: chupchup@ferkel.ucsb.edu (Robert Earl)
Subject: Re: Very tiny bug in printf? (perl 4.034)
Organization: (EVIL!)
Date: Thu, 3 Sep 1992 20:33:53 GMT

mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:

| hansk@aie.nl (Hans Kinwel) writes:

| >I expected the following three lines to print out 08 two times.

| >$val="8";
| >printf ("%02s\n", $val);
| >printf ("%02d\n", $val);

| In _Standard C_ by Plauger and Brodie, they say "Following the percent
| character (%), you can write zero or more flags: ... 0 -- to pad a conversion
| with leading zeros after any sign or prefix, in the absence of any other
| padding," which seems to be saying that you should get "08" for both.

Actually, this behavior seems to be deemed undefined by the standard:
"For d, i, o, u, x, X, e, E, f, g, and G conversions, leading zeros
... are used to pad the field width; no space padding is performed...
For other conversions, the behavior is undefined."

So printf, given "%02s", can do whatever it jolly well feels like
doing, but hey, this is Perl, and Perl does what Perl does.  :-)

-- 
"If you've got a pig that likes jumping fences, | robert earl
you have to make its fence a lot higher all at  | rearl@ucsd.edu
once -- if you do it by increments, all you're  | rearl@piggy.ucsb.edu
doing is training a jumping pig." -Henry Spencer|
Newsgroups: comp.lang.perl
From: zq@eecg.toronto.edu (Qing Zheng)
Subject: Problem with pipe
Date: 31 Aug 92 22:26:43 GMT

#! /local/bin/perl
#
#	This is my own lpr command mylpr
#
#doing something that I want.
.....
# execute the real lpr
exec '/usr/ucb/lpr', @ARGV;

If I issue the following command

	%mylpr file

everthing is ok. However, when I issue

	%cat file |mylpr

the print out is not correct. I guess the problem is that the pipe is not
properly passed over to the "exec '/usr/ucb/lpr', @ARGV" since some lines of
the initial part of the file is missing. Any idea on how to solve this problem?

  Thanks in advance.

  Please send mail to zq@eecg.toronto.edu

---Qing

Newsgroups: comp.lang.perl
From: mike@meiko.com (Mike Stok)
Subject: Re: Fast String Operations?
Organization: Meiko Scientific Corp.
Date: Wed, 26 Aug 1992 11:31:47 GMT

In article <1992Aug25.151625.3134@IDA.ORG> rlg@IDA.ORG (Randy garrett) writes:
>I'm looking for the fastest way to perform the following operation.
>Basically, this is a conversion of one database format to another.
>If I have a NULL field, indicated by 2 pipe symbols next to
>each other, I want to insert either a -1 or a ~ between the 
>two pipes, depending upon whether the type of that field
>is a integer or a character.  I know the type of the field
>because I've already pre-filled that array with the correct
>types from the Data Dictionary (Thanks Sybase to Perl Interface!).
>
>So, I read in a series of lines from a file.  If I find 2 pipe 
>symbols adjacent to each other, "||", in the input string, I want
>to insert either a ~  or a -1 depending on the type of that field,
>which I get from the @name array.
>
>Here's the code I'm using.  It works, but the bad news is that
>I process 800+ Megabytes of data at a crack with this. It 
>takes almost a day of CPU time on a Sparc 2!  Any words of
>wisdom on how to speed it up would be greatly appreciated.

My guess at the code would be something like:

#!/usr/bin/perl

$string = "a|bcd||g||i|||";
@name = (1,2,1,1,2,1,2,1);

if ($string =~ /\|\|/)
{
  chop ($string);
  @field = split (/\|/, $string, @name);
  for ($index = 0; $index < @field; $index++)
  {
    $field[$index] = ('', '-1', '~')[$name[$index]] if $field[$index] eq '';
  }
  $string = join ('|', @field) . '|';
}

print "$string\n";

This would only do any processing if there were 2 adjacent |s in the
string, and I assume that the | is used as a field terminator rather
than a separator (hence the chop and the . '|' after the join), and
that there will always be the right number of fields in a string, and
that $[ is left at the default value of 0.  It produces a different result
to your code :-(, but if field 0 is the "a", 1 is "bcd", and field 2
is the first empty field, I see that $name[2] == 1, so this is an empty
integer field so it becomes '-1'.  My result $string was a|bcd|-1|g|~|i|~|-1|
but yours was a|bcd|~|g|-1|i|-1|~|...

I haven't measured how fast it goes compared to your code, but I would
happily buy you a beer if it's slower :-)  (I guess I should owe you one
anyway as I get a different answer)

Mike
--
The "usual disclaimers" apply.    | ... many were weak and confused, succumbing
Mike Stok                         | to drink or drugs whenever possible ...
mike@meiko.com                    |
Meiko tel: (617) 890 7676         |                          Hunter S. Thompson
From: merlyn@ora.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl
Subject: Re: Camel Book for 5.xxx hardback?
Date: 30 Aug 92 16:23:04 GMT
Article-I.D.: romulus.MERLYN.92Aug30092301
Organization: Stonehenge Consulting Services; Portland, Oregon, USA

In article <1992Aug29.162151.1847@meiko.com> mike@meiko.com (Mike Stok) writes:
   If there's going to be a new Camel Book for the new Perl, will it ever
   be available as a hardback?  Of all the books on my shelf the Camel
   Book is the most heavily used (with the possible exception of
   Peopleware which is rarely on the shelf :-) and although it's only 18
   months old it's showing quite a few signs of wear and tear.  How many
   people out there would be interested in shelling out extra money for a
   more durable book?

We are making plans to update the Camel book (and the new tutorial book)
as necessary to keep them up to date with the changes in Perl (including
the upcoming 5.0 release).

Your request for a hardcopy book will be forwarded to my contact at the
publishers.

Of course, if your book wears out in 18 months, maybe that's the
point; it's time to get a new book with the new information in it! :-)

Maybe we should sell a subscription service? :-)

@_=unpack("a5"x 5,"Just another Perl hacker,");@_{"",@_}=@_;print while$_=$_{$_}
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
From: merlyn@ora.com (Randal L. Schwartz)
Newsgroups: comp.lang.perl
Subject: the official word from Tim O'Reilly (of OR&A) about hardcover Camels
Date: 1 Sep 92 03:42:51 GMT
Article-I.D.: romulus.MERLYN.92Aug31204248
Organization: Stonehenge Consulting Services; Portland, Oregon, USA


Here's what Tim O'Reilly said when asked about the hardcopy books:

==================================================

From: Tim O'Reilly <______@ora.com>
Date: Mon, 31 Aug 1992 14:03:32 PDT
To: _______@ora.com
Subject: hardcover sales

In general, I think that you can tell people that hardcover sales
don't seem to be sufficient to justify the added expense, but that we
will continue to look into it.

==================================================

There.  Straight from the horse^H^H^H^H^Hcamel's mouth.

print "Just another Perl [book] hacker,"
--
Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
merlyn@reed.edu (guest account) merlyn@ora.com (better for permanent record)
cute quote: "Welcome to Portland, Oregon -- home of the California Raisins!"
Newsgroups: comp.lang.perl
From: ian@unipalm.co.uk (Ian Phillipps)
Subject: Re: How do I make traps in perl?
Organization: Unipalm Ltd., 216 Cambridge Science Park, Cambridge CB4 4WA, UK
Date: Wed, 2 Sep 1992 12:27:22 GMT

lwall@netlabs.com (Larry Wall) writes:

>    sub CATCHINT {
>	print "OUCH! Don't DO that!!!\n";
>    }

I've wanted the equivalent of a longjmp to allow a sig handler to yank
me out of nest of routines etc, and plonk me down somewhere standard
(e.g. a main STDIN-reading loop). The "goto" spec is so discouraging
that I've not even tried it, and nothing else seems to fit.

I *could* just stay in the handler, but that doesn't have too good
long-term consquences.

Ian
-- 
Ian Phillipps, Unipalm Ltd, 216 Science Park,		Phone +44 223 420002
Milton Road, Cambridge, CB4 4WA, England.		Phax  +44 223 426868
	The road to hell is paved with melting snowballs - Larry Wall
From: sol0@ns1.cc.lehigh.edu (Stephen O. Lidie)
Newsgroups: comp.lang.perl
Subject: Re: Camel Book for 5.xxx hardback?
Date: 1 Sep 92 12:49:11 GMT
Organization: Lehigh University


Speaking of the Camel, I think I have a bug fix for one of
the sample programs - where do I send the corrections?

Steve Lidie
Lehigh University Computing Center
Newsgroups: comp.lang.perl
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: randomize.c
Organization: Computer Science, University of Melbourne, Australia
Date: Mon, 31 Aug 1992 23:15:32 GMT

aas@rosmer.nr.no (Gisle Aas) writes:

>Why not:    perl -e '@l=<>;print splice(@l,rand($#l),1) while @l'

Because it's not random?

Try
             perl -e 'srand;@l=<>;print splice(@l,rand($#l),1) while @l'

-- 
Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
This .signature virus is a self-referential statement that is true - but 
you will only be able to consistently believe it if you copy it to your own
.signature file!
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Bad label: _EVAL_
Date: 4 Sep 92 17:29:52 GMT
Organization: NetLabs, Inc.

In article <JKT.92Sep3135937@seneca.SED.Provo.Novell.COM> jkt@SED.Provo.Novell.COM (Jack Thomasson) writes:
: >>>>> On 3 Sep 92 08:26:20 GMT, jim@spitws117.sbil.co.uk (James
: >>>>> Gillespie) said:
: 
: James>     open (OUTPUT, "> $oldfile") || die "Couldn't open '$oldfile' for writing\n";
: 
: the old "how many single quotes was that, anyway?" bug.  try:
: 
: ... || die "could not open $oldfile for writing\n"; # avoid the problem
: 
: or
: 
: ... || die "couldn\'t open \'$oldfile\' for writing\n"; # escape the
: problem

Well, er, actually, no.  You can put as many single quotes inside double
quotes as you like.  Perl isn't like the shells--there's generally only
one level of interpretation going on inside a quoted string.  I'm always
vaguely amused when I see someone putting

	die "Can not snuffle quietly: $!"

because I know they're probably being superstitious.  I'd say

	die "Can't snuffle quietly: $!"

This is OK in Perl.  By design.

Larry
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: comp.lang.perl.scripts (?)
Date: 27 Aug 92 05:39:41 GMT
Organization: NetLabs, Inc.

In article <26912@life.ai.mit.edu> cracraft@wheat-chex.ai.mit.edu (Stuart Cracraft) writes:
: 
: I would like a newsgroup where perl scripts of general use
: can be posed. Also, subroutines that solve typical everyday
: common problems could be posted.

As a general rule, I think that solutions to everyday common
problems ought to be purveyed in everyday common newsgroups.
Categorizing solutions by the language they're done in is a bit
like appraising paintings only by whether they're oil or acrylic.
People shouldn't oughta have to care much whether their problem
is solved with Perl, C, sed, awk, *sh, or nroff.

When you expect the world to be ideal it occasionally tries to
live up to your expectations.

Larry
Newsgroups: comp.lang.perl
From: meissner@osf.org (Michael Meissner)
Subject: Re: help - range passed via ARGV
Organization: Open Software Foundation
Distribution: comp.lang.perl
Date: 28 Aug 92 15:05:08

In article <SMOTHERS.92Aug27182321@seaview.mcd.intel.com>
smothers@seaview.mcd.intel.com (Charles Smothers ~) writes:

| I know this was posted about a month ago, could someone mail
| me some of the replys.  Here is the question:
| 
| I need to expand a range that is passed via ARGV.  A simple
| program that will do the following will give me the help
| I need:
| % myprog 1..3 7 10..12     <- command line
| 1 2 3 7 10 11 12           <- output
| %

My email bounced, so I will post this.  Hopefully the answer is more
correct than scalar (%array) which I gave out.  Mea cupla :-)

Try:
	@badargs = grep (! /^\d+(\.\.\d+)$/, @ARGV);
	$" = "' '", die "$0: arguments are not numeric: '@badargs'\n" if (scalar (@badargs) != 0);
	@foo = ();
	grep (push (@foo, eval ($_)), @ARGV);
	$, = " ";
	$\ = "\n";
	print @foo;

To explain it, lines 1-2 abort if any line is not a case range or
simple number (to prevent calling eval with something that you don't
expect).  Line 3 prevents an unused variable warning when using perl
-w.  Line 4 puts into @foo the expanded case ranges.  The trick is
that perl uses the syntax <value1>..<value2> to make an array of
ranges from value1 to value2.  The remaining lines just print out the
output.

If instead you wanted to take non numeric items as is without
aborting, you would use:

	@foo = ();
	grep (push (@foo, (/^\d+\.\.\d+$/ ? (eval ($_)) : ($_)), @ARGV);
	$, = " ";
	$\ = "\n";
	print @foo;
--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

You are in a twisty little passage of standards, all conflicting.
Newsgroups: comp.lang.perl
From: veals@crchh606.bnr.ca (Percy Veals)
Subject: Why does this cause a core dump??
Organization: Bell Northern Research
Date: Wed, 2 Sep 1992 15:36:48 GMT

Why does this fragment of code cause a core dump?


  $data{'myfile$data'} = "myfile.data";
  foreach ( keys %data ) {   
     rename($_, $data{$_}) || warn "Data file not found\n";
  }

I am running Perl4.035 on a HPUX 7.05 box. My old copy of 
perl4.019 also dumps core. 

Cheers--Percy Veals
--
-----------------------------------------------------------------
Percy Veals    #include <disclaimer.h>     Bell-Northern Research
                                           2201 Lakeside
E-mail: veals@bnr.ca                       Richardson, TX 
Voice: (214) 684-4843
-----------------------------------------------------------------










Newsgroups: comp.lang.perl
From: albert@INSL.McGill.CA (Albert Pang)
Subject: Looking for MS-DOS port of perl?
Organization: INSL, McGill University, Montreal, Canada
Date: Tue, 25 Aug 92 23:30:25 GMT

I first apologize if this is a FAQ.

Does anybody have the executables of Perl for MS-DOS.  I notice that
there is a 'msdos' directory in the perl distribution.  In the
README.msdos file, it mentioned that perl has been compiled under
MS-DOS using the MSC compiler.  Unfortunately, I do not have a C
compiler for MS-DOS.  

Is anyone who has perl executable and are willing to share it with the
rest of the world.  It will be much appreciated.

-- 
------------------------------------------------------------
Albert Pang		<albert@brahms.insl.mcgill.ca>
Information Networks & Systems Lab
McGill University
Newsgroups: comp.lang.perl
From: vsh@etnibsd.uucp (Steve Harris)
Subject: Re: Ordering indices based on their values
Organization: Eaton Corp, Semiconductor Equipment Div., Beverly, MA
Distribution: comp.lang.perl
Date: Fri, 28 Aug 1992 21:48:03 GMT


@array = (7,2,4,-1,5);
print join(' ',&idx_sort(@array)), "\n";

sub idx_sort {
    # returns indicies of input array sorted by values of input array
    local($i) = 0;
    grep(s/.*\t//,sort(numeric grep($_ .= "\t" . $i++,@_)));
}
sub numeric { $a <=> $b; }
-- 
... Steve Harris - Eaton Corp. - Beverly, MA - uunet!etnibsd!vsh
From: ram@eiffel.com (Raphael Manfredi)
Newsgroups: comp.lang.perl
Subject: Re: Using $*, but pattern doesn't match
Date: 25 Aug 92 23:07:10 GMT
Organization: Interactive Software Engineering, Santa Barbara CA

Quoting tchrist@convex.COM (Tom Christiansen) from comp.lang.perl:
>From the keyboard of ram@eiffel.com (Raphael Manfredi):
>:You have to use [.\n] if you want to match anything.
>
>Sorry, [] is a nonmagical zone, so your dot is a literal.
>Often we use [^\0] to mean (just about) anything.

Hmm... I meant (.|\n) obviously :-)

>    Though I'll admit readability suffers slightly... 
>                    --Larry Wall in <2969@jato.Jpl.Nasa.Gov>

Your quote fits perfectly. Do you have an intelligent signature daemon
behind your ~/.signature named pipe ? :-)
-- 
Raphael Manfredi <ram@eiffel.com>
Interactive Software Engineering Inc.
270 Storke Road, Suite #7                      / Tel +1 (805) 685-1006 \
Goleta, California 93117, USA                  \ Fax +1 (805) 685-6869 /
From: stantz@sierra.corp.sgi.com (Mark Stantz)
Newsgroups: comp.lang.perl
Subject: 4.035 bug or feature...why does this run?
Date: 27 Aug 92 17:10:36 GMT
Organization: Silicon Graphics, Inc.


	Consider the following trivial perl program, which computes the
union of two sets of strings:


#!/usr/local/bin/perl

@s1 = ("just", " another ");
@s2 = ("perl", " hacker", "\n");

@u = @s1;
foreach $item (@s2) {
  push(@u, $item) unless (grep(($_ eq $item), @s1))		# Huh?
}

print @u;


	Why does this program run when there is no ';' at the end of 
the line indicated with the comment?  Apparently it works fine under 4.035, 
but doesn't run under 4.019 or earlier versions.  I would have expected the 
'doesn't run' behavior in 4.035 as well.

	What's the story behind this?

------------------------------------------------------------------------------
Mark Stantz    |      "...And on the seventh day, it was Miller Time..."
stantz@sgi.com | 				-- Guinessis