HDTenEightyP/NetNews huggingface dataset:
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Where do I find my packages?
Originator: tchrist@pixel.convex.com
Date: Tue, 13 Oct 1992 15:01:10 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 sommar@enea.se (Erland Sommarskog):
:>Instead of looking through the symbol table, have each return
:>register an atexit() function to call.
:
:Not very appealing, since it would result in quite much code 
:cluttering. If a package consists of several routines, but no
:particular initiation routine each routine may have to make such 
:a registration, which may be easily forgotten if I'm adding a 
:new routine.

I don't see that it's so bad.

    package foobar;
    INIT: {
	 ....
	 &'atexit('cleanup');
    } 
    sub main'global_func;
    sub blah;
    sub other_blah;
    sub cleanup;


now in main:

    sub main {
	local(@ARGV) = @_;
	# do everything
    } 

    $return = eval { &main(@ARGV) };
    if ($@) { 
	# handle exception
    }
    &cleanup_exits;

:In that case I rather hard-code into my general abort handler
:which cleanup calls to look for, then I know at least that
:they always will be done.

And why wouldn't they be done in the above code segment?

:> Use die.

:OK, but wouldn't it be nicer to have less to write? 

Then make it into a library.

:In my case,
:I'm writing a family of commands which all use a common library.
:Specifically there is an initiation file which all commands
:require, and which defines the &abort subroutine everyone uses.

Sounds like a fine way.  I have a catch/throw library in exceptions.pl
that may work for you.

:With the eval solution, I would have to have more code which was
:common to all main files which is no fun at all the day I realize
:I want to change it all.

Again, then use a library, like exceptions.pl or atexit.pl .

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

    PL/1, "the fatal disease", belongs more to the problem set than to the
    solution set.  -- E. W. Dijkstra
Newsgroups: comp.lang.perl,comp.unix.admin
From: bill@bilver.uucp (Bill Vermillion)
Subject: Re: Why I am glad I know perl
Organization: W. J. Vermillion - Winter Park, FL
Date: Fri, 9 Oct 1992 11:32:51 GMT

In article <BvpIos.9Ew@cs.psu.edu> ehrlich@colossus.cs.psu.edu (Dan Ehrlich) writes:
>Here is just one reason why every system administrator should know perl.

>Scenario:  Sitting in a window on a standalone workstation as root.

>           Enter "rm *" assuming that I am in /foobar/blech/bin.

>           Notice that I must have been in /bin because "ls" no longer
>           exists.  Panic begins to set in.

>           Confirm that I was really in /bin.  Panic mounts.

That's a good reason for having file called -i in every important
directory tree.    It will force interactive in case you do something
like the above, or if for example you wanted to do a rm -r *.o  and you
accidentally hit the space bar and typed rm -r * .o - and your first
indication was the mssage    .o not found   :-(

I stick that file in the head of / /bin /usr/bin /etc.  Just a bit of
extra insurance in directories where you really never want to use a
wild card rm (or almost never). 

-- 
Bill Vermillion - bill@bilver.oau.org  bill.vermillion@oau.org
                - bill@bilver.uucp 
                - ..!{peora|ge-dab|tous|tarpit}!bilver!bill
Newsgroups: comp.lang.perl
From: neil@salmon.demon.co.uk ("Neil S. Briscoe")
Subject: Re: Why I am glad I know perl
Date: Thu, 8 Oct 1992 09:59:53 +0000

In article <91946@netnews.upenn.edu> rsk@gynko.circ.upenn.edu (Rich
Kulawiec) writes:
:In article <BvpIos.9Ew@cs.psu.edu> ehrlich@colossus.cs.psu.edu (Dan Ehrlich) writes:
:>Here is just one reason why every system administrator should know perl.
:>
:>Scenario:  Sitting in a window on a standalone workstation as root.
:>           Enter "rm *" assuming that I am in /foobar/blech/bin.
:
:System administrators, at least those who are worth their salt, do
:not enter "rm *" as root unless they mean it.    As wonderful as perl
:may be, it's no substitute for extraordinary care when one is su'd.
:
:Anachronistically still using awk, sed, and the rest,
:---Rsk

Unless, of course, they've remembered to run zsh.  Whenever you type
"rm *" in zsh it asks you if you really meant to do that regardless of
any aliases for rm you may have set up.

Emacs, Zsh and Perl.  Tools for life!

Regards
Neil

Neil S. Briscoe				Telephone: +44 252 376737
System Administrator			Fax:       +44 252 376644
                                        Email: neil@salmon.demon.co.uk
                                               nbriscoe@cix.compulink.co.uk
Bartec Medical Systems Ltd.
Impression House
Invincible Road				"!##@!** Listen who swears
Farnborough				Christopher Robin has fallen downstairs"
Hants GU14 7NP				-- The Goodies Book of Criminal Records
England
"A man is incomplete until he's married -- then he's finished!"
-- seen on a desktop calendar
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: Visual
Date: 14 Oct 92 18:30:47 GMT
Organization: NetLabs, Inc.

In article <KENTD.92Oct12145256@zappa.FtCollins.NCR.com> kentd@FtCollins.NCR.com (Kent Dalton) writes:
: Aaron> Have you ever noticed how you never see Larry Wall and Weird Al
: Aaron> in the same place at the same time (same 4D coords for you
: Aaron> extra-D'rs).
: 
: Hmm. I smell a conspiracy. Has anyone ever heard LW sing, can he hold a
: tune? If he can't, then they're probably the same person. ;-)

That doesn't prove anything.  I can sing out of tune if I want to.

Larry
Newsgroups: comp.lang.perl
From: rray@lookout.it.uswc.uswest.com (Randy J. Ray)
Subject: Malformed cmd link (?)
Organization: US WEST Communications, Inc. -- Denver, CO
Date: Tue, 13 Oct 1992 23:36:32 GMT

We are gettign this error in several scripts we are writing, running perl 4.035
on different platforms. We have one script "require"'ing a second, and the
second is "require"'ing a third, and is constructing the name of the third
script using a variable. The third script contains three routines, and we get 
the error message once for each routine. Can someone better explain what this
error message means, and what is causing it, and finally, how to eliminate it?

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST IT/CSD                 rray@lookout.it.uswc.uswest.com
                                                           Phone: (303)595-2852
"It's not denial. I'm just very selective about the reality I accept." --Calvin
===============================================================================
Newsgroups: comp.lang.perl
From: tal@Warren.MENTORG.COM (Tom Limoncelli)
Subject: Re: Sorting .newsrc
Organization: Mentor Graphics -- IC Group
Distribution: usa
Date: Tue, 13 Oct 1992 16:09:31 GMT

In <BvzsrJ.BIH@sran230.sra.co.jp> utashiro@sran230.sra.co.jp (Kazumasa Utashiro) writes:

>I compared "fixnewsrc" with my "newsrc" program to sort
[...]
>You can use shell style wildcard to specify the order of
>newsgroups.  "newsrc" is available by anonymous ftp from
>sra.co.jp[133.137.4.3]:pub/lang/perl/sra-scripts.

Great program!  I'm going to use it a lot!

I just made a couple quick changes to newsrc which let me have blank
lines and comments in the .newsorder file.  I also corrected some
typos.  Here are the diffs.

*** ../ftp/newsrc-1.7   Tue Oct 13 11:50:42 1992
--- newsrcsort  Tue Oct 13 12:04:50 1992
***************
*** 20,25 ****
--- 20,29 ----
  ;#    comp.{sys,os,newprod,protocols,unix}
  ;#    comp
  ;#
+ ;# The .newsorder file can have blank lines.  Any line
+ ;# beginning with "#" is ignored.
+ ;#
+ ;#
  require('getopts.pl');
  ;#require 'usage.pl';
  $option='rvshf:xu'; @arglist=(
***************
*** 30,36 ****
      'h::show help message',
      'f:order-file:specify order file (default: ~/.newsorder)',
      'x::show diff',
!     'u::move unscribed groups at the end',
  );
  sub usage {
      print &Usage($0, $option, "[ newsrc-file ]", @arglist);
--- 34,40 ----
      'h::show help message',
      'f:order-file:specify order file (default: ~/.newsorder)',
      'x::show diff',
!     'u::move unsubscribed groups at the end',
  );
  sub usage {
      print &Usage($0, $option, "[ newsrc-file ]", @arglist);
***************
*** 53,61 ****
  open(NEWSRC, $newsrc) || die "$newsrc: $!\n";
  if (open(ORDER, $order)) {
      @order=<ORDER>; close(ORDER); chop(@order);
  } else {
      warn "You don't have .newsorder file.\n";
!     warn "Dafault order is used (@default_order)\n";
      @order = @default_order;
  }
  $uniqname='x000'; sub uniqname { $uniqname++; }
--- 57,67 ----
  open(NEWSRC, $newsrc) || die "$newsrc: $!\n";
  if (open(ORDER, $order)) {
      @order=<ORDER>; close(ORDER); chop(@order);
+       @order=grep(!/^#/, @order);
+       @order=grep(!/^\s*$/, @order);
  } else {
      warn "You don't have .newsorder file.\n";
!     warn "Default order is used (@default_order)\n";
      @order = @default_order;
  }
  $uniqname='x000'; sub uniqname { $uniqname++; }


Tom

-- 
Tom Limoncelli -- tal@warren.mentorg.com (work) -- tal@plts.uucp (play)
"I like Bill Clinton tremendously.  I know him from the governors' conferences.
The Democrats nominated their best person, a very able fellow.  The country is
well served by that choice." -Bush's re-election chair in NJ (Thomas Kean)
From: majidi@rwja.umdnj.edu (Masoud Majidi)
Newsgroups: comp.lang.perl
Subject: writing binary data (beginner's question)
Date: 10 Oct 92 15:17:23 GMT
Organization: Robert Wood Johnson Medical School, Piscataway NJ

Dear netters,

I have been trying to store some int as binary data in a file and I thought
something like the following would work:

syswrite (TO, $value, 4)

where $value is say 5 and 4 is the num of bytes in an integer. But the ascii
value of data is stored in the file. Could you please somebody tell me what
am I missing?

Thanks in advance,

Masoud Majidi (majidi@umdnj.edu)
Newsgroups: comp.lang.perl
From: weingart@inf.ethz.ch (Tobias Weingartner)
Subject: Challenge!
Followup-To: comp.lang.perl
Keywords: challenge, freq
Reply-To: weingart@inf.ethz.ch
Organization: ETH - Switzerland
Date: Fri, 16 Oct 1992 19:59:01 GMT

Hello all.  Here is a short perl script that takes <>,
and prints out the number of times it encounters each
\w.  Does anyone have a shorter version, and/or a version
that runs faster?

tau.inf.ethz.ch% wc /usr/dict/words
   25144   25144  206672 /usr/dict/words

tau.inf.ethz.ch% time freqn /usr/dict/words
0       1
1       2
2       1
3       1
4       1
5       1
6       1
7       1
8       1
9       1
a       16454
b       4118
c       8225
d       5810
e       20161
f       2667
g       4130
h       5218
i       13995
j       431
k       1931
l       10079
m       5839
n       12110
o       12754
p       5519
q       378
r       13449
s       10220
t       12849
u       6492
v       1903
w       1974
x       621
y       3640
z       433

50.6 user, 5.7 sys, 1:06 real, 84% cpu
0k text, 592k data+stack, 592k avg, 83k max
4 in, 0 out, 46 faults, 106 reclaims, 0 swaps


Script:
#!/usr/local/bin/perl
while(@_ = split(//, <>)){ for(@_){ tr/[A-Z]/[a-z]/; $array{$_}+=1; } }
for(sort(keys %array)){ print "$_\t$array{$_}\n" unless( ! m/\w/ ); }


This was run on an IPC.

--Toby.

Oh, doing the same thing on a snake, an' claiming it was faster
does not count. ;)

Newsgroups: comp.lang.perl
From: rsalz@osf.org (Rich Salz)
Subject: Re: A novice question
Organization: Open Software Foundation
Date: Tue, 13 Oct 1992 20:06:03 GMT

In <mcook.717786116@fendahl.dev.cdx.mot.com> mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:
>The probable reason you couldn't see what was going wrong is that you have
>your precedence mixed up.  This:
> chdir $foo || die "can't cd to $foo $!\n";
>is the same as this:
> chdir ($foo || die "can't cd to $foo $!\n");

No:
	; ls -l /bar
	/bar not found
	# [Exit 2]
	; perl -e 'chdir "/bar" || die "Cant chdir $!\n"'
	Cant chdir No such file or directory
	# [Exit 2]
Newsgroups: comp.lang.perl
From: leung@DSG.Tandem.COM (Steven Leung)
Subject: How to split(/$ch/)?
Organization: Tandem Computers
Date: Wed, 7 Oct 1992 22:05:26 GMT

When $ch==',' it works. But when $ch=='^', it doesn't.
/\^/ works, but to have two split depending on the value
of $ch doesn't seem to be elegant. Any suggestions? 
Thanks in advance.

Steven
------
328. Seek opportunity, not security. ...
        - Life's Little Instruction Book by H. J. Brown, Jr.

Newsgroups: comp.lang.perl
From: gregory@netcom.com (Brian Gregory)
Subject: full text search?
Keywords: text search line boundaries
Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
Date: Tue, 13 Oct 1992 20:34:38 GMT

I don't think this made it the first time:

Is there a perl script out there (ala' cgrep, etc.) that works
across line boundaries?  I want to match 'foo bar' given both

asdf qwer foo bar zxcv

-or-

asdf qwer foo
bar zxcv

...that way I can match phrases with no artificial line distinctions.

Thanks in advance!

Brian
gregory@netcom.com
Newsgroups: comp.lang.clos,comp.lang.lisp
From: Tim Larkin <tsl1@cornell.edu>
Subject: Re: How to neatly destroy instances?
X-Xxdate: Tue, 13 Oct 92 17: 45:04 GMT
Nntp-Posting-User: tsl1@cornell.edu
Organization: Cornell University
X-Useragent: Nuntius v1.1.1d7
Date: Tue, 13 Oct 1992 16:37:25 GMT

In article <1992Oct13.142031.569@colorado.edu> PeiYu Huang,
huangp@wasser.Colorado.EDU writes:
>    Because I use a class variable list to maintain all current instances
>of that class for browsing purpose. One can use a form in an 
>"initialize-instance :after" method to update the list. I guess I may
need to 
>define another method to
>clean up the list BEFORE destroying the instance, say my-instance,
otherwise when
>my-instance becomes unbound, I can no longer access the list via it. 

I may be missing something here, but if the instance belongs to the class 
variable list, and neither belongs to any other set nor is the value of 
any global symbol, then to "destroy" it, by which I infer you mean to 
recover its allocated memory, you need only to remove it from the class 
list. The gc will then recover the memory.

I guess I'm not too certain what you mean by "destroy".


Tim Larkin
Federal Nutrition Laboratory
Tower Road
Ithaca, New York
tsl1@cornell.edu
607-255-7008
Newsgroups: comp.lang.clos
From: jmorrill@bbn.com (Jeff Morrill)
Newsgroups: comp.lang.clos
Subject: Re: How to neatly destroy instances?
Date: 13 Oct 92 11:42:51 GMT
Article-I.D.: bbn.1490.719005371
Reply-To: jmorrill@BBN.COM
Organization: The Ohio State University Department of Computer and Information Science


Maybe somebody could explain again exactly why finalization is useful.

If you "let go" of an object in the sense of removing the last pointer
to it, then couldn't the application "finalize" the object at that time?
Why is it better to wait until the garbage collector gets around
to cleaning up the bits?

If finalization was added to the language, then it would
promote laziness in the language.  The garbage collector would end
up doing all sorts of things like closing forgotten streams, freeing
forgotten windows, releasing forgotten locks.  Given finalization,
I don't see any way of preventing the garbage collector from getting
involved in essentially any activity.

jeff morrill
jmorrill@bbn.com
From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton)
Newsgroups: comp.lang.clos
Subject: Re: Introductory tutorial on CLOS
Date: 16 Oct 92 15:00:32 GMT
Article-I.D.: subnode.5805.9210161500
Organization: The Ohio State University Department of Computer and Information Science

> Could someone suggest a text-like book on the subject.

   Sonya E. Keene.
   {\em Object-Oriented Programming in Common Lisp: A Programmer's
        Guide to CLOS}.
   Addison-Wesley, Reading, Massachusetts, 1989.
   ISBN 0-201-17589-4.
   266 pages; paperback.

Advantages:

A good introduction that doesn't just tell you the mechanics.  There's
lots of good advice on naming conventions, organizing class relationships,
etc.  The reference section in the back contains the stuff you most need
to know without an excess of obscuring detail.

Limitataions:

Virtually all examples are chosen from a narrow range of systems
programming applications; they're such things as I/O streams and
locks to control interaction between processes.  There's little
discussion of how to organize O-O programs large enough to require
several packages and files (packages are regarded as a general
Common Lisp issue beyond the scope of the book), and little about
when to use CLOS as opposed to the rest of CL.  The meta-object
protocol is barely mentioned.

Verdict:

There's still no serious competition.

Jeff Dalton,
AI Applications Institute,                               J.Dalton@ed.ac.uk
Edinburgh University.
From: john@linus.mitre.org
Newsgroups: comp.lang.clos
Subject: Re: Fate of obsolete accessors
Date: 13 Oct 92 09:51:36 GMT
Article-I.D.: coltrane.9210131751.AA07286
Organization: The Ohio State University Department of Computer and Information Science

Jeff Dalton (jeff@aiai.edinburgh.ac.uk) writes:

  Suppose I

    1. Define a class with a slot A, :acessor GET-A.
    2. Redefine the class w/o the alot A.

  What happens to the access method on the generic function GET-A?

  In PCL the method goes away.  But is this behavior guaranteed?  What
  if the method was redefined to no longer be a slot access between
  (1) and (2)?

Page 4-15 of the ANSI Draft says

  Redefining a class ...  Any method object created by a :READER,
  :WRITER, or :ACCESSOR option specified by the old DEFCLASS form is
  removed from the corresponding generic function.

So it seems that in either situation, the Right Thing (tm) is
guaranteed to happen.  If you redefine the method between (1) and (2),
then the original method object defined in (1) doesn't get removed by
(2), because it's already been removed, by your redefinition.
Presumably, neither does the new method get removed, since it isn't
the same method object added by (1).

John Burger
john@mitre.org
Newsgroups: comp.lang.clos
From: jonl%kuwait@lucid.com (Jon L White)
Subject: Re: How to neatly destroy instances?
Organization: The Ohio State University Department of Computer and Information Science
Date: Tue, 13 Oct 1992 15:48:17 GMT

re: Date: Tue, 13 Oct 1992 14:20:31 GMT
    From: huangp@wasser.Colorado.EDU (PeiYu Huang)
    . . .
    Because I use a class variable list to maintain all current instances
    of that class for browsing purpose. One can use a form in an 
    "initialize-instance :after" method to update the list. I guess I may 
    need to define another method to clean up the list BEFORE destroying the
    instance, say my-instance, otherwise when my-instance becomes unbound, I 
    can no longer access the list via it. 

    Any comments?

    Date: Tue, 13 Oct 1992 13:40:40 GMT
    From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton)
    . . . 
    Now, one thing that didn't happen in X3J13's revision of Common
    Lisp was changes to garbage collection to support such things 
    as finalization and weak pointers.  I think it was reasonable
    not to do this, but I want to add my voice to those saying
    "we want it" in the hope that implementors will be influenced.


A "weak-set" is surely the obvious choice, when there is an automated 
garbage colllector, for keeping around a list of all instances of a class.

Lucid's 4.1 release ("on your Sparc desk ``next week'') has both
finalization and weak pointers as first-class, documented facilities;
and I know other vendors have some, possibly undocumented, versions of 
such things too.


-- JonL --
From: jeff@aiai.edinburgh.ac.uk (Jeff Dalton)
Newsgroups: comp.lang.clos
Subject: Fate of obsolete accessors
Date: 12 Oct 92 13:15:54 GMT
Organization: The Ohio State University Department of Computer and Information Science

Suppose I

  1. Define a class with a slot A, :acessor GET-A.
  2. Redefine the class w/o the alot A.

What happens to the access method on the generic function GET-A?

In PCL the method goes away.  But is this behavior guaranteed?
What if the method was redefined to no longer be a slot access
between (1) and (2)?

-- jd
Newsgroups: comp.lang.clos
From: huangp@wasser.Colorado.EDU (PeiYu Huang)
Subject: Re: How to neatly destroy instances?
Reply-To: huangp@wasser.Colorado.EDU (PeiYu Huang)
Organization: University of Colorado, Boulder
Date: Tue, 13 Oct 1992 14:20:31 GMT

In article <22625@venera.isi.edu>, tar@ISI.EDU (Thomas A. Russ) writes:
>
>Why do you feel a need to destroy instances explicitly?
>
    Because I use a class variable list to maintain all current instances
of that class for browsing purpose. One can use a form in an "initialize-instance :after" method to update the list. I guess I may need to define another method to
clean up the list BEFORE destroying the instance, say my-instance, otherwise when
my-instance becomes unbound, I can no longer access the list via it. 

Any comments?

P. Huang 
Newsgroups: comp.lang.clos
From: herr@gambln.enet.DEc.COM (Bob Herr - DTN 297-9833)
Subject: Please add me
Organization: The Ohio State University Department of Computer and Information Science
Date: Thu, 15 Oct 1992 01:39:32 GMT


herr@gambln.enet.dec.com

thanks

-Bob Herr
Newsgroups: comp.lang.clos
From: smh@franz.com (Steve Haflich)
Subject: Re: clos & environment available?
Organization: The Ohio State University Department of Computer and Information Science
Date: Tue, 13 Oct 1992 03:25:08 GMT

> From: chyde@pecos.ads.com (Clinton Hyde)
> 
> both have pretty good versions of CLOS. I use Franz' version. because
> of this, following answers apply only to it...
> 
> class examiner: none that I know of. 
> ...

Thanks to Clint for the nice description, but I want to correct this
one point: Although there is no specialized class inspector in the
base CL implementation, there is a bells-and-whistles mouse-sensitive
clos metaobject browser (with both graphical and textual components)
included in the optional Composer program development system.  We
placed it in the development environment because ``examining'' classes
etc. is clearly a programming- and debugging-time activity, not
something that is usually relevant to a completed application.
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.clos
Subject: Re: Retrieving documentation of slots?
Date: 13 Oct 1992 19:20:27 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: telecaster.think.com

In article <1992Oct13.181308.24194@umbc3.umbc.edu> cs631114@umbc8.umbc.edu (cs631114) writes:
>Hmm, I finally got around to trying to use doc strings on slots, and much
>to my embarrassment realized I didn't know how to retrieve them! Assumedly
>I am overloooking the obvious. Hints, anyone?

No, you're not overlooking anything.  As it says in the Notes section of
the dpANS description of DOCUMENTATION:

    This standard prescribes no means to retrieve the \term{documentation
    strings} for individual slots specified in a \macref{defclass} form,
    but \term{implementations} might still provide debugging tools and/or
    programming language extensions which manipulate this information.
    Implementors wishing to provide such support are encouraged to consult
    the \term{Metaobject Protocol} for suggestions about how this might be
    done.

In most implementations you should be able to get the documentation strings
with the MOP, presumably using an accessor on the slot-description object.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.lang.clos,comp.lang.lisp