HDTenEightyP/NetNews huggingface dataset:
From: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Subject: Re: Conversion of a largish script to perl
Reply-To: lezz@merlin.dev.cdx.mot.com (Lezz Giles)
Organization: Motorola Codex, Canton, MA
Date: Thu, 8 Oct 1992 20:31:03 GMT

In article <1992Oct8.162317.11810@news.eng.convex.com>, tchrist@convex.COM (Tom Christiansen) writes:
|>From the keyboard of aps583@huxley.anu.edu.au (Anthony P Scott):
|>:I have written a largish shell script that makes use of the shell (sh),
|>:sed and awk as well as making calls to a set of fortran programs.
|>:
|>:While the script does what is wanted it is slow in some areas, mainly
|>:in the use of sed to delete ranges of text and the like. Also there
|>:are some features in perl that I could make use of in getting an
|>:even better script.
|>:
|>:I can use a2p and s2p to translate individual portions of my script
|>:but does any body have an idea on how to translate the sh portions?
|>:
|>:I suppose the perl version could be developed the same way as the 
|>:present script, that is piece by piece, but that is quite slow
|>:an tedious and the script works now and I don't have the time and ....
|>
|>I fear that there's no automated way, because the big gains
|>in speed will be through re-evaluating and reimplementing 
|>the underlying algorithm.

Some time ago when I first started learning Perl I had exactly this problem -
I needed to convert a largish script from shell into perl.  It was an excellent
way to learn some of the details of perl and also an excellent way to revisit
just what the script was doing.  My advice mirrors Tom's - do the whole conversion
by hand and you won't regret it!  The one thing that you should consider _before_
you start conversion is whether you want to improve and change what the script
does while doing the conversion, or whether you simply want to do a straight
translation while resisting the temptation to tweak the functionality.

Lezz JAPH Giles
From: hom00@ccc.amdahl.com (Harold O Morris)
Newsgroups: comp.lang.perl
Subject: Re: Malformed cmd link (?)
Date: 14 Oct 92 17:41:32 GMT
Reply-To: hom00@JUTS.uts.amdahl.com (Harold O Morris)
Organization: Amdahl Corporation, Sunnyvale CA

In article <Bw32wx.M4y@da_vinci.it.uswc.uswest.com> rray@lookout.it.uswc.uswest.com (Randy J. Ray) writes:
>We are gettign this error in several scripts we are writing, running perl 4.035
> ... Can someone better explain what this
>error message means, and what is causing it, and finally, how to eliminate it?

I get it very consistently when I re-do the same module.  I.e. I keep
editing/re-doing a function (in a module) all while in the same invocation
of perl.  Before 4.35, there was no problem doing this.
Newsgroups: comp.lang.perl
From: sommar@enea.se (Erland Sommarskog)
Subject: Where do I find my packages?
Organization: Enea Data AB
Date: Sun, 11 Oct 1992 14:38:46 GMT

Is there some special place somewhere I can find the names of
all packages in my script?

The background problem: I have a general abort routine which I
call instead of simply saying "die". Today it looks for a cleanup
routine in the main and the locks packages if they are defined, 
but it would be much more elegant if I could traverse the array 
of packages, and call each cleanup routine I find.

I'm running Perl 4.019.

By the way, it would be a nice extention to the language if
dies were trappable to faciliate when you need to do some
cleanup before you exit.


-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
There are many sorts of Macedonians: Greek, Bulgarian, Roumanian, Macedonian...
From: Sepp@ppcger.ppc.sub.org (Josef Wolf)
Newsgroups: comp.lang.perl
Subject: Re: ? possible (de)reference nested data types syntax ?
Distribution: world
Organization: PPC Germersheim, Germany
Date: 3 Oct 92 01:26:43 GMT

In <2AC77229.9104@tct.com> chip@tct.com (Chip Salzenberg) writes:
] According to ram@eiffel.com (Raphael Manfredi):
] >Another alternative would be to use a named function, like:
] >	$array_ref = ref(@array);	# For purists :-)
] >	$assoc_ref = ref %array;	# For others...
] Yes, please!  It could even return an array for:
] 
]     ref(@a, $b, %c)

Yes, please do it this way! It would be very confusing to use '\'.
Just imagine all the variants of single/double-quotes for eval()'d
stuff (nesting them would become a nightmare :-( ;-) )

Greetings
    Sepp

-- 
|   Josef Wolf,  Germersheim,  Germany    aka    sepp@ppcger.ppc.sub.org   |
|    also available via    ..!uunet.uu.net!ira.uka.de!smurf!ppcger!sepp    |
|--------------------------------------------------------------------------|
| ...und wieviel brave Deutsche haben wieder nichts geschnallt... (Marius) |
Newsgroups: comp.lang.perl
From: cobrin.sbd-e@rx.xerox.com (Steve Cobrin)
Subject: problems compiling 4.35 on SunOS 4.1.2
Reply-To: cobrin.sbd-e@rx.xerox.com
Organization: Rank Xerox Systems Centre, Welwyn Garden City, UK
Date: Tue, 13 Oct 1992 19:51:04 GMT


Hi, I'm having problems compiling 4.35 on a SunOS 4.1.2 (unpatched) system

I'm always failing

	op/groups......FAILED on test 1

This should be a straight 4.1.2 system, the only *strange* thing I've done
is place /usr/5bin before /usr/bin in my search path, I've tried not
including -I/usr/ucbinclude in the cc flags, like a previous poster 
recomended but to no avail.

Can anybody help me?

As an aside, what help is the hint "sunos_4_0_2" ? since it doesn't seem
to reduce the number of interactions I need to give configure, and besides
the default OS shipped now with sun's is 4.1.3!

	-- Steve
From: peter@micromuse.co.uk (Peter Galbavy)
Newsgroups: comp.lang.perl
Subject: FAQ ? : Sun RPC's in perl wanted
Date: 7 Oct 92 08:57:00 GMT
Organization: MicroMuse Limited, London, England.

This is more then likely an FAQ - but I cannot find an answer:

Is there an implmentation of Sun RPC's in perl (a perl API more than
anything) ?

Thanks
Peter G.
-- 
Peter Galbavy
Tech Support, Micromuse Ltd
Phone: +44 71 352 7774		E-Mail: P.Galbavy@micromuse.co.uk
From: dansmith@Autodesk.COM (Daniel Smith)
Newsgroups: comp.lang.perl
Subject: Re: more readable perl :-)
Date: 16 Oct 92 17:14:02 GMT
Organization: Autodesk Inc., Sausalito CA, USA

> >     sub isn't_foobled { !&is_foobled }
and then I wrote w/out benefit of coffee:
> 		ain't(&bad) unless you've(&broken_apostrophe_key);  :-)

	&whoops; &that's($backwards);

					Daniel
  
-- 
     Daniel Smith, Autodesk, Sausalito, California, (415) 332-2344 x 2580
	      Disclaimer: written by a highly caffeinated mammal
	    dansmith@autodesk.com            dansmith@well.sf.ca.us

Newsgroups: comp.lang.perl
From: mcook@fendahl.dev.cdx.mot.com (Michael Cook)
Subject: Re: Where do I find my packages?
Organization: Motorola Codex, Canton, Massachusetts
Date: Mon, 12 Oct 1992 04:18:19 GMT

sommar@enea.se (Erland Sommarskog) writes:

>Is there some special place somewhere I can find the names of
>all packages in my script?

Yes.  The symbol table.

	@packages = grep(/^_/, keys %_main);

From the manpage:

          The symbol table for a package happens to be stored in the asso-
          ciative array of that name prepended with an underscore.  The
          value in each entry of the associative array is what you are
          referring to when you use the *name notation.

>The background problem: I have a general abort routine which I
>call instead of simply saying "die". Today it looks for a cleanup
>routine in the main and the locks packages if they are defined, 
>but it would be much more elegant if I could traverse the array 
>of packages, and call each cleanup routine I find.

See the dumpvar example in the manpage.  You could probably do something like
this:

	for (@packages)
	{
	    $p = substr($_, 1);
	    eval "&${p}'cleanup if defined(${p}'cleanup";
	    $@ && die $@;	# (see below)
	}

>By the way, it would be a nice extention to the language if
>dies were trappable to faciliate when you need to do some
>cleanup before you exit.

Dies *are* trappable, via eval.

	eval 'die "foo"';
	print "[$@]\n";

See "die" and $@ in the manpage.

Michael.
Newsgroups: comp.lang.perl
From: thayer@cs.columbia.edu (Charles Thayer)
Subject: Re: OOP?  What's is perl 5 going to be like?
Organization: Columbia University Department of Computer Science
Date: Sun, 11 Oct 1992 08:24:33 GMT

imp>		Has anybody given any thought to an object oriented perl?
			lots of people, but were all too busy writing
			perl scripts for work :)
tchrist>	..an object [will be] a pointer plus a package.
			gee I guess package really did come from ada,
  			better check my perl book :)
cjross>		You have pointers, therefore you can OOP.
			or a string type and a goto :( but it ain't
			pretty

That would give us a lot, but we're still looking at difference
between a programming environment that has objects versus one that is
object oriented.  The big gap here is a little bit of syntax that
could support inheritance in a way that is easy and functional to use.
But I could go on about Booch's three primary requirements for an OOP,
and this is where it starts getting too sticky for discussion unless
there's a real proposal to consider :(

Is there going to be a struct?  How would one invoke an object's
method?  Will packages support inheritance from other packages
(via the old if symbol not here check parent)?

After all one can program in an object-oriented way in perl or c.  In
c it takes a lot of typing and extra '*'s.  In perl it takes a lot of
careful escaped strings and deep evals.  (Packages are not the best
closures for going object-oriented without a simpler eval syntax.)

Did anyone at LISA hear Larry speak about perl 5?  Any discussion of
object-oriented features?

/charles

-- 
==============================================================================
Charles Thayer, Columbia University, Dept. CS, Tech-staff... my words only.
From: mallen@carla.Wichita (mallen)
Newsgroups: comp.lang.perl
Subject: Where can I find the latest version of PERL
Keywords: perl
Date: 7 Oct 92 13:28:37 GMT
Distribution: na
Organization: wichita

Can anyone tell of an ftp or mailserver site that has the latest version
of PERL available.  Please email me directly.

Thanks in advance.
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Need help with regexp problem
Date: 7 Oct 92 16:30:45 GMT
Article-I.D.: netlabs.1992Oct7.163045.20145
Organization: NetLabs, Inc.

In article <1992Oct6.204046.2305@panix.com> fhd@panix.com (Frank Deutschmann) writes:
:              \b -- white space if there are optional modifiers

\b doesn't match white space.  It matches a word boundary, which is always
zero width.  You want something like \s* to scan past optional whitespace.

Larry
Newsgroups: comp.lang.perl
From: aps583@huxley.anu.edu.au (Anthony P Scott)
Subject: Conversion of a largish script to perl
Originator: aps583@huxley
Organization: Australian National University
Date: Thu, 8 Oct 92 06:21:08 GMT

I have written a largish shell script that makes use of the shell (sh),
sed and awk as well as making calls to a set of fortran programs.

While the script does what is wanted it is slow in some areas, mainly
in the use of sed to delete ranges of text and the like. Also there
are some features in perl that I could make use of in getting an
even better script.

I can use a2p and s2p to translate individual portions of my script
but does any body have an idea on how to translate the sh portions?

I suppose the perl version could be developed the same way as the 
present script, that is piece by piece, but that is quite slow
an tedious and the script works now and I don't have the time and ....

Any help would be appreciated.

Kind regards,

Tony Scott.  aps583@huxley.anu.edu
Newsgroups: comp.lang.perl
From: mab@wdl39.wdl.loral.com (Mark A Biggar)
Subject: Perl for VMS
Organization: Loral Western Development Labs
Date: Mon, 12 Oct 1992 22:51:43 GMT


Does anyone have a perl for VMS that does not have the socket emulation
stuff linked into it.  The currently available VMS-perl via ftp does
have that stuff and won't run on a VMS machine that (stingy project) does
not have the emulation library installed.

--
Mark Biggar
From: bense@heart4 (Booker C. Bense)
Newsgroups: comp.lang.perl
Subject: Re: Perl on Cray
Date: 9 Oct 92 21:57:56 GMT
Organization: San Diego Supercomputer Center @ UCSD

In article <1992Sep30.144717.6696@nsisrv.gsfc.nasa.gov> pat@news.gsfc.nasa.gov (patrick m. ryan) writes:
>
>Has anyone successfully compiled perl 4.035 on a Cray YMP?
>The config file would seem to indicate that it is possible.
>We have a Cray YMP running Unicos 6.1.  I get lots of
>"not enough stack space" errors when I try to compile it.
>
>Any clues?
>

- We have compiled both 4.19 and 4.34 on the ymp at sdsc.edu

I suggest you contact 

grossa@sdsc.edu   	(4.19 perl )

diegella@sdsc.edu	(4.34 perl ) 


- Booker C. Bense                    
prefered: benseb@grumpy.sdsc.edu	"I think it's GOOD that everyone 
NeXT Mail: benseb@next.sdsc.edu 	   becomes food " - Hobbes
Newsgroups: comp.lang.perl
From: sommar@enea.se (Erland Sommarskog)
Subject: Re: Problem with associative arrays
Organization: Enea Data AB
Date: Sun, 11 Oct 1992 14:29:43 GMT

Chris Hare (chare@unilabs.uucp) writes:
>   if ( defined( $errorMsgText{'$msgNo'} ) )
>	  {
>      printf "$errorMsgText{'$msgNo'}\n" ;

It would probably make more sense with double instead of single quotes.
-- 
Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se
There are many sorts of Macedonians: Greek, Bulgarian, Roumanian, Macedonian...

Newsgroups: comp.lang.perl
From: ej@id.dth.dk (Erik Johansen)
Newsgroups: comp.lang.perl
Subject: error in sys/ioctl.ph, while eval &TIOCSWINSZ
Keywords: ph, perl,include
Date: 7 Oct 92 12:05:03 GMT
Organization: Department of Computer Science


While trying to make perl emulate telnetd i ran into the following error
while trying to eval &TIOCSWINSZ:

syntax error in file (eval) at line 1, next 2 tokens ")("

Sub TIOCSWINSZ is defined by the library file sys/ioctl.ph,
created by h2ph as follows:

  eval 'sub TIOCSWINSZ { &_IOW(ord(\'t\'), 103, \'struct winsize\');}';

Again sub _IOW is defined as:

  eval 'sub _IOW {
    local($x,$y,$t) = @_;
    eval "(\'int\')( &_IOC_IN|(($sizeof{$t}& &_IOCPARM_MASK)<<16)|($x<<8)|$y)";
  }';

Sub _IOC_IN is defined as:
  eval 'sub _IOC_IN {(\'int\')0x80000000;}';

Sub _IOCPARM_MASK is defined as:
  eval 'sub _IOCPARM_MASK {0x7f;}';

To me it seems to be a problem in _IOW where it says (\'int\')( &_IOC_IN ...
Is that the right diagnosis, and what should I do about it ?

-- 
Erik Johansen / Institute for Computer Science / Danish Technical University
ej@id.dth.dk
Newsgroups: comp.lang.perl
From: walter@optimla.aimla.com (Walter Hunt)
Subject: Re: Building on SunOS 4.1.2 -- Core dump...
Reply-To: walter@optimla.aimla.com (Walter Hunt)
Organization: OptImage Interactive Services Co., L.P.
Date: Mon, 12 Oct 92 18:22:28 GMT

In article <1992Oct.103536.1394@abigale.uucp>, joel@abigale.uucp (Joel Rosi-Schwartz) writes:
|> In article <1992Oct8.183031.7429@peanuts.informatik.uni-tuebingen.de> jw@peanuts.informatik.uni-tuebingen.de (Joerg Wedeck) writes:
|> >In article <fritz.718476311@Cadence.COM>, fritz@Cadence.COM (Frederick Staats) writes:
|> >|> I've been trying to build perl-4.035 on a Sparc IPX with
|>  [ stuff deleted ]
|> >
|> >Try using gcc, I had the same problem under SunOS 4.1.3. When I used gcc
|> >everything worked fine (except 1 test).
|> 
|> I find this thread interesting and relevant to me at the moment.  I
|> am currently porting my application to Sun and it uses perl.  My
|> experience is exactly the opposite of what is stated above.  I tried
|> several times to build with gcc 2.2.2 and regardless of what I tried
|> (SysV/BSD universes for lib/includes, perl/Sun malloc, -O or no -O, -
|> static or using shared libs) I got the following test results (ok's
|> deleted):
|> 
|> 	op/eval........FAILED on test 0
|> 	op/regexp......FAILED on test 45
|> 	lib/big........ok
|> 	/bin/sh: 19198 Memory fault - core dumped
|> 
|> I finally gave up and compiled with Suns /usr/bin/cc and everything
|> work perfectly.  I will probably backtrack and try it with
|> /usr/5bin/cc and the SysV libs/includes, if I have the time before I
|> have to return the loaner machine.  The relevant details are:
|> 
|> 	SparcStation2 GX
|> 	SunOS: 4.1.2/5.0


	I was having the same problems. The fix was pointed out by
maplgrv!vid%astroatc.uucp@cs.wisc.edu (Dave Greunke). When doing the Configure
thing, DO NOT allow it to set your compiler flags to include /usr/ucb/include.
This will get defininitions for varargs which will make perl croak. I re-ran
Configure, with no -I flags in the compile flags, and got a properly working
version.

	Thanks also to uunet!antares.Tymnet.COM!mooring (Ed Mooring) and Mike
Stok <uunet!meiko.com!mike>, who sent me working config.sh files.


|> 
|> Cheers,
|> Joel
|> -- 
|>      ==================================================================
|>      ||               T E C H N E   R E S E A R C H                  ||
|>      ||  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  ||
|>      ||                     Joel Rosi-Schwartz                       ||
|>      ||   Hildorien House            +   Email: joel@abigale.UUCP    ||
|>      ||   12 Waverley Way            +    (pyrltd!abigale.UUCP!joel) ||
|>      ||   Finchampstead, Wokingham   +   Phone: +44 (734) 730.260    ||
|>      ||   Berkshire RG11 4YD (UK)    +   Fax:   +44 (734) 730.272    ||
|>      ==================================================================

-- 
Walter Hunt					walter@optimage.com
OptImage Interactive Services Company, L.P.	walter@aimla.com
11040 Santa Monica Blvd., Suite #300		uunet!{optimage,aimla}!walter
Los Angeles, Ca. 90025				(310) 445-5718
Newsgroups: comp.lang.perl
From: fritz@Cadence.COM (Frederick Staats)
Subject: Building on SunOS 4.1.2 -- Core dump...
Organization: Cadence Design Systems, Inc.
Date: Wed, 7 Oct 1992 16:45:11 GMT

I've been trying to build perl-4.035 on a Sparc IPX with
standard SunOS 4.1.2.  The closest default configuration
is "sunos_4_0_2" which leaves me with a version of perl
that core dumps on startup.  Could someone send me a working
conifg.h?  I have built this version of perl on a RS/6000
with AIX 3.2 without problem in the past.

--
Frederick Staats, Applications Engineer   fritz@Cadence.COM
Cadence Design Systems, Inc.
555 River Oaks Parkway, Bldg. 1           (408) 428-5225 (Voice)
San Jose, CA 95134                        (408) 954-8917 (Fax)
Newsgroups: comp.lang.perl
From: elitman@nxstep.com (Eric A. Litman)
Subject: NNTP via dialup link
Followup-To: comp.lang.perl
Reply-To: elitman@nxstep.com
Organization: NXSTEP Ventures
X-Newsreader: TIN [version 1.1 PL6]
Date: Thu, 15 Oct 1992 06:09:10 GMT

I have been commissioned with setting up a limited newsfeed for a site
with minimal available resources. What I would like to do is allow the
users at the site to open a dialup connection to an internet-connected
machine and emulate a real NNTP connection using perl scripts.

The concept is simple enough. A user will tip/cu (kermit drops carrier
when it is killed) into his/her account on the remote machine, kill
the tip process without dropping carrier, then run the preferred news
reader on the client machine. On this machine, in place of a local NNTP
server will be a perl script, registered in /etc/inetd.conf, which
will first send a command to run a similar script on the remote
machine, then simply copy all input to /dev/ttya (the outgoing serial
device on a NeXT.) The script on the remote machine will open the NNTP
connection to the server and pass back and forth the necessary
commands. Basic copy-in, copy-out procedure.

Assuming the client script is called pnntpd (pseudo-NNTP), the line in
/etc/inetd.conf on the client machine will read:

  nntp  stream  tcp  nowait  root  /usr/local/scripts/pnntpd pnntpd

Here's a simple diagram of what I need:

{newssrv}<-->[ server script ]<-->%phone%<-->[ client script ]<-->{client}

When the news reader opens the connection to the local NNTP server, it
will simply pass all of its data through both scripts to the real,
remote NNTP server. The client newsreader, Tin, will be configured so 
that it connects to 'localhost'.

I have something of a dysfunctional client script that is missing the
output command to the server machine to start the nntp session:

	 # taken from Steve_Hayman@next.com
	 open(TTYA, "+>/dev/ttya");
		  if ( fork() ) {
			# parent - copy stdin to ttya
				while ( <STDIN> ) {
						 print TTYA;
				}
			} else {
				# child - copy ttya to stdout
				while ( <TTYA> ) {
					 print;
				}
			}

This seems very straight-forward, but not knowing how to script in
perl I'm at a loss. What I need is a working script for the server
machine, and hopefully a nicer client script as well. Would it be
possible to have the script dial the modem, log into the remote
machine (through a Xylogics Annex box), and start the server script
without any interaction from the user? This would be *ideal*.

I truly appreciate any help you might have to offer. I will gladly
summarize to the group any responses I receive.

--
Eric A. Litman  #import <std/disclaimer.h> | NeXTMail, MIME accepted - please 
Federal Region, NeXT Campus Consultant     | indicate in Subject line.
Newsgroups: comp.lang.perl
From: msolda@lamont.ldgo.columbia.edu (M Solda)
Subject: undump for SunOS 4.1.1 on a Sun3
Keywords: sun3, sunos4.1.1, undump
Reply-To: msolda@lamont.ldgo.columbia.edu
Organization: Lamont-Doherty Geological Observatory
Date: Sun, 11 Oct 1992 17:49:34 GMT

i have been having problems, well, no luck, in getting undump to work on a 
sun3 running sun os 4.1.1.  i took the undump that was posted to this news
group a while back.  it worked successfully for a sun4, but undump compiled
and ran successfully, but the binary it created dumped core.

i compiled perl 4.035 statically for the sun3 (as i did for the sun4).  i
created the core file from a perl script running perl with the -u option.
the core file got created, and as i said, undump created the binary
without error. but it runs only to dump a core.

please, any help would be greatly appreciated!
Newsgroups: comp.lang.perl
From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
Subject: Re: how does one tar to stdout? and related?
Keywords: tar,stdout, pipes,redirection
Organization: Software Research Associates, Inc., Japan
Date: Mon, 12 Oct 1992 01:40:02 GMT
Reply-To: utashiro@sra.co.jp

In article <1992Oct8.184423.27220@fnbc.com>
	jja@fnbc.com (Joseph Alotta) writes:
>> i have a problem getting tar to write to stdout.  i can get it to read  
>> from stdin, but not the other way around.  i have these large files on 
>> tape and i want to read and subset them before i write them on disk  
>> because they are really big.  i'd like to do something like:
>> 
>> tar -xvf /dev/rst0  mybigfile | grep "1000" | filter.pl

I made a program called "taro" and that is probably you
want.  You can use it like this:

	taro cat /dev/rst0 yourbigfile | whatever you want
or
	taro s:yourbigfile:/dev/stdout: /dev/rst0 | tar xf - /dev/stdout

You can get taro via anonymous ftp from

	sra.co.jp[133.137.4.3]:pub/lang/perl/sra-scripts

You can also find it in comp.lang.perl or alt.sources archives.

---
K.Utashiro
utashiro@sra.co.jp
Newsgroups: comp.lang.perl