[9871] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3464 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 17 13:07:17 1998

Date: Mon, 17 Aug 98 10:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 17 Aug 1998     Volume: 8 Number: 3464

Today's topics:
        Accessing a variable from a child process. <richard.garside@zen.co.uk>
    Re: Accessing a variable from a child process. (Greg Bacon)
    Re: ActivePerl 5.005: Dynamically Generated @INC? (David Cantrell)
    Re: Array element var in a "foreach" loop? or an exhanc <jdporter@min.net>
        Can't use DBI after compiling perl program <tmgil@cs.vu.nl>
    Re: COBOL and Perl <jdporter@min.net>
    Re: COBOL and Perl <dmcs@cyburban.com>
    Re: COBOL and Perl <jdf@pobox.com>
    Re: Help with require (Maurice Aubrey)
    Re: Kermit Speaks <jdporter@min.net>
        Monitoring Other Programs. <dchristi@newbridge.com>
    Re: Monitoring Other Programs. (Greg Bacon)
    Re: Monitoring Other Programs. (Maurice Aubrey)
        parse http_logfile.gz of proxy server? <faerber@ind.uni-stuttgart.de>
        PERL and file updates <debbie@jot.nb.ca>
    Re: PERL and file updates <jdf@pobox.com>
    Re: PERL and file updates (M.J.T. Guy)
        Perl and the DOM mmesmer@yahoo.com
    Re: Perl CGI Question (Chris Russo)
    Re: Perl Style (Chris Sherman)
        POSTing out <sysop@millenia.com>
    Re: Q: How to read all the file name in a directory <grant.griffin@iowegian.com>
    Re: Q: How to read all the file name in a directory <grant.griffin@iowegian.com>
    Re: Q: How to read all the file name in a directory <grant.griffin@nospam.com>
    Re: Quickie encapsulation question <jdporter@min.net>
        Random Number (Darren Ferguson)
    Re: Random Number (Greg Bacon)
    Re: Reference Confussion <rs83@is7.nyu.edu>
    Re: Reference Confussion <rs83@is7.nyu.edu>
    Re: Reference Confussion <jdf@pobox.com>
        Spawning Perl script on NT theobald.john@mcleodusa.net
    Re: taint checking seems to slow down my code <jdporter@min.net>
    Re: What is the purpose of Perl <rbowen@rcbowen.com>
        WIN32::NetAdmin User Management <kgenus@newbridge.com>
    Re: X-file (?=...), case postponed. (Patrick Timmins)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 17 Aug 1998 15:54:27 GMT
From: "Richard Garside" <richard.garside@zen.co.uk>
Subject: Accessing a variable from a child process.
Message-Id: <TmYB1.161$hO5.279175@news-reader.bt.net>

Hi,

I have a program that to implement a pipe to another server forks into two
processes. One is listening to the server and one is sending information to
it. I want to have a variable that can be accessed by both processes or at
least to be able to pass a value from one to the other.

Thanks,
Richard.




------------------------------

Date: 17 Aug 1998 16:14:45 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Accessing a variable from a child process.
Message-Id: <6r9ktl$p9o$1@info.uah.edu>

In article <TmYB1.161$hO5.279175@news-reader.bt.net>,
	"Richard Garside" <richard.garside@zen.co.uk> writes:
: I have a program that to implement a pipe to another server forks into two
: processes. One is listening to the server and one is sending information to
: it. I want to have a variable that can be accessed by both processes or at
: least to be able to pass a value from one to the other.

You want the IPC::Shareable module.  From its README:

    IPC::Shareable allows you to tie a a variable to shared memory
    making it easy to share the contents of that variable with other
    Perl processes.  Currently either scalars or hashes can be tied;
    tying of arrays remains a work in progress.  However, the variable
    being tied may contain arbitrarily complex data structures -
    including references to arrays, hashes of hashes, etc.

Find it on the CPAN:

    <URL:http://www.perl.com/CPAN/modules/by-module/IPC/>

Greg
-- 
If you view your problem closely enough you will recognize yourself as part of
the problem.


------------------------------

Date: Mon, 17 Aug 1998 16:48:01 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: ActivePerl 5.005: Dynamically Generated @INC?
Message-Id: <35d85b33.858334@thunder>

[ CCed to london_pm@makelist.com just in
  case it gets lost in the bedlam of clpm. ]

On Tue, 11 Aug 1998 10:23:30 GMT,
  dave@mag-sol.com enlightened comp.lang.perl.misc thusly:

>On all of the Unix Perls I've used up to and including 5.004, the value of
>@INC is hard-coded into the executable when it's compiled. This means that if
>I want I can move the executable and it still refers to the libraries under
>the original directory (I know this is a slightly strange thing to want to
>do, but bear with me...). Moving perl into different directories and running
>'perl -V' gives the same result.
>
>Under ActivePerl 5.005, it seems that the value of @INC is dynamically
>generated. It seems to use the directory that the executable is in to
>determine what @INC should contain. Moving perl into differnt directories and
>running 'perl -V' gives *different* results.
>
>I haven't been able to try this on a Unix version of 5.005 so I suppose it's
>possible that this is a 5.005 change rather than an ActivePerl one.

Previous versions of Activeware's perl stored @INC in the registry at
HKLM\SOFTWARE\ActiveWare\Perl5\PRIVLIB.  That is certainly the case up
to and including 5.003_07 (build 316, of Mar 13 1998).

I haven't used any of the 5xx builds yet (due to laziness ;-) so can't
tell whether that's still true for more recent versions.

I believe that if that entry doesn't exist it will try to use
'sensible' values.

--
David Cantrell, part-time NT/java/SQL techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


------------------------------

Date: Mon, 17 Aug 1998 12:06:51 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Array element var in a "foreach" loop? or an exhanced grep ?
Message-Id: <35D8551B.3701@min.net>

Mark-Jason Dominus wrote:
> 
> In article <35D6D5FF.AD6C0784@sneex.fccj.org>,
> Bill 'Sneex' Jones  <bill@fccj.org> wrote:
> >What about $. (dollar sign period combo)?
> 
> No, that only works for filehandles.  I had a sick fantasy that you
> could tie a filehandle to your array and read from it to get the
> elements and update $., but it doesn't work.

No, but it allows you to "expose" a method which you can call
to get the current index from the tied object.

	tie @a, ...
	for ( @a ) { ...
		$i = tied(@a)->index;
	}

-- 
John Porter


------------------------------

Date: 17 Aug 1998 15:12:12 GMT
From: "Thomer M. Gil" <tmgil@cs.vu.nl>
Subject: Can't use DBI after compiling perl program
Message-Id: <6r9h8c$sop$1@star.cs.vu.nl>


Hello,



    I am using the perl to c "compiler" which on itself
    works remarkably well.

    After compiling the C program, though, the executable
    gives an error when started:

    Can't locate object method "connect" via package "DBI" at main.pl line 58.

    Directly running mail.pl using perl works fine.

    I hope someone can help.

    Thomer


------------------------------

Date: Mon, 17 Aug 1998 12:21:00 -0400
From: John Porter <jdporter@min.net>
Subject: Re: COBOL and Perl
Message-Id: <35D8586C.5079@min.net>

Shaun C. Murray wrote:
> 
> the Object Oriented extensions pretty much put [COBOL] 
> at the vanguard of current languages.

ROFL.

-- 
John Porter


------------------------------

Date: 17 Aug 1998 11:28:06 -0500
From: DavidM <dmcs@cyburban.com>
Subject: Re: COBOL and Perl
Message-Id: <35D85866.6E39@cyburban.com>

Abigail wrote:
> 
> ++ Having skipped reading much about PASCAL, reading only about
> ++ C so far and not getting into Perl yet, I would like to know
> ++ if in general COBOL programs could be rewritten effectively in
> ++ Perl.
> 
> Well, you can always write equivalent programs in Perl.
> 
You absolutely CANNOT write all COBOL programs in PERL. PERL has no
equivalent to many of COBOL features.



> ++ I saw a thread in comp.lang.cobol where someone indicated that
> ++ a three page COBOL program could be rewritten in AWK in five
> ++ lines, so I wonder if this might be the same with Perl.
> 

Impossible.


> Oh, yeah, for 3 line COBOL programs that might be true. But what
> will you do for a 150,000 line COBOL program?
> 
> ++ Are there things in COBOL which can't  be done in Perl.
> 

Can you dynamically call subroutines in Perl?
Can you do SORT's in PERL?
Can PERL use different collating sequences?
Can you write CICS programs in PERL?
Can you write IMS programs in PERL?

> 
> That is why Perl is Perl, and nowhere near close to COBOL. That's also
> why COBOL isn't suitable for modern programming.
> 

Thats funny, it is still the most widely used business language.
IBM will very soon allow COBOL to do everything that JAVA can.
Its a top priority project at IBM.


------------------------------

Date: 17 Aug 1998 12:37:31 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: dmcs@cyburban.com
Subject: Re: COBOL and Perl
Message-Id: <yasn4ihw.fsf@mailhost.panix.com>

DavidM <dmcs@cyburban.com> writes:

> Can you dynamically call subroutines in Perl?

Of course.

> Can you do SORT's in PERL?

Certainly.

> Can PERL use different collating sequences?

You can arbitrarily define your sort order, if that's what you mean.

> Can you write CICS programs in PERL?
> Can you write IMS programs in PERL?

Hmm.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


------------------------------

Date: Mon, 17 Aug 1998 15:46:04 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Help with require
Message-Id: <slrn6tgk1u.kdt.maurice@we-24-130-48-83.we.mediaone.net>

On Sat, 15 Aug 1998 11:08:46 GMT, Russ Romei <romei@stampfair.com> wrote:

>does anyone know how (if you can) require a file on another server?
>require "http://www.foobar.com/perlfile.cgi"
>I get a file not found error
>
>Is there any way around this?

No, you can't do that.  One way around it, is with something like this:

#!/usr/bin/perl

use FileHandle;
use LWP::Simple qw( get );

defined($url = get 'http://www.myhost.foo/MyModule.pm')
  or die "unable to fetch url";
$fh = new FileHandle "> /tmp/MyModule.pm"
  or die $!;
print $fh $url;
close $fh or die $!;

require "/tmp/MyModule.pm";
&MyModule::hello;

which will fetch the file, store it locally, and then require it.
You need the LWP library for this.

Depending on the origin of the code, you might want to check out
the Safe module.

-- 
Maurice Aubrey <maurice@hevanet.com>

The goal of Computer Science is to build something that will last
at least until we've finished building it. 


------------------------------

Date: Mon, 17 Aug 1998 12:15:28 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Kermit Speaks
Message-Id: <35D85720.37AC@min.net>

Kermit the frog wrote:
> 
> Here's an interesting experiment: respond with silence to those who
> are not worthy of your knowledge...

No.  This is exactly the wrong thing to do.
And Tom C has explained in voluminous detail why.


> As for my anonymity, Mr. Gebis, I do not have time to sort through a
> thousand emails entitled 'FUCK YOU' that I'm sure I would have
> received on this hot little topic.

Your hyperbole fails to serve you here.  You got your 4q responses
publically instead of privately.

I too think people should be willing to put their name to their
words.  And I'm not pointing at you, "kermit"; plenty of other
people also think they're kEwL by hiding behind an alias.

-- 
John Porter


------------------------------

Date: Mon, 17 Aug 1998 11:05:34 -0400
From: Duncan Christie <dchristi@newbridge.com>
Subject: Monitoring Other Programs.
Message-Id: <35D846BE.BF1DA240@newbridge.com>

Hi,
	I want to have a perl script run after one program finishes and take
the file it outputted and read it.  Normally, I would not consider this
much of a problem; however, it is difficult to determine the name of the
outputted file (pseudo-random). Any ideas?

Thanks,

Duncan Christie.

P.S. Please, no RTFM replies.


------------------------------

Date: 17 Aug 1998 15:40:23 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Monitoring Other Programs.
Message-Id: <6r9it7$jhd$10@info.uah.edu>

In article <35D846BE.BF1DA240@newbridge.com>,
	Duncan Christie <dchristi@newbridge.com> writes:
: 	I want to have a perl script run after one program finishes and take
: the file it outputted and read it.  Normally, I would not consider this
: much of a problem; however, it is difficult to determine the name of the
: outputted file (pseudo-random). Any ideas?

Why not modify your programs to write to STDOUT and read from STDIN
respectively?  You would invoke it as

   % prog1 | prog2

That way, you don't have to worry about guessing where the output of
your first program is. :-)

: P.S. Please, no RTFM replies.

RTFM if you don't want to worry about being told to RTFM. :-)

Greg
-- 
Nothing inspires forgiveness quite like revenge. 
    -- Dogbert


------------------------------

Date: Mon, 17 Aug 1998 16:00:36 GMT
From: maurice@hevanet.com (Maurice Aubrey)
Subject: Re: Monitoring Other Programs.
Message-Id: <slrn6tgkt6.kgg.maurice@we-24-130-48-83.we.mediaone.net>

On Mon, 17 Aug 1998 11:05:34 -0400, Duncan Christie <dchristi@newbridge.com> 
wrote:

>	I want to have a perl script run after one program finishes and take
>the file it outputted and read it.  Normally, I would not consider this
>much of a problem; however, it is difficult to determine the name of the
>outputted file (pseudo-random). Any ideas?

Write the file into a directory.  Have the second program look for any
files in that directory, processes them, and remove/move them.

If that wouldn't work, then we need more details.  

-- 
Maurice Aubrey <maurice@hevanet.com>

Beware of bugs in the above code; I have only proved it correct, 
not tried it. 
  - Donald Knuth


------------------------------

Date: Mon, 17 Aug 1998 16:28:29 +0200
From: Johannes Faerber <faerber@ind.uni-stuttgart.de>
Subject: parse http_logfile.gz of proxy server?
Message-Id: <35D83E0D.6C81@ind.uni-stuttgart.de>

Hi,

i have never really used perl so far, but I think, this problem has
been done in perl a hundred times and maybe someone has a script 
already:

I have a huge gzipped logfile and want to read it line by line to
produce output of those few fields I am interested in (user, date,
time, ..)

The problem is, that the fields (separated by blanks) contain 
a) one_word_strings or integers,
b) the date in brackets and a blank: [25/Mar/1998:13:10:07 +0100] and
c) strings with blanks, that are quoted: "Mozilla/4.03 [en] (Win95; I)"
   and the number of blanks is varying.

How do I read these fields into my script (best without unzipping, like
eg pipe from gzcat to the perl-script)?



Thanks a lot for any suggestions and hints,
Johannes



PS: the format is as follows (here fields separated by blank lines
instead blanks):

format=                         example:
%Ses->client.ip%                1.2.3.4
-                               -
%Req->vars.pauth-user%          -
[%SYSDATE%]                     [25/Mar/1998:00:10:35 +0100] 
"%Req->reqpb.proxy-request%"    "GET http://0.0.0.0/ex?empty HTTP/1.0"
%Req->srvhdrs.clf-status%       200
%Req->vars.p2c-cl%              83
"%Req->headers.referer%"        "http://0.0.0.0/proxy/ex?tabs+rprt"
"%Req->headers.user-agent%"     "Mozilla/4.04 [en] (Win95; I)"
%Req->reqpb.method%             GET
%Req->reqpb.uri%                http://0.0.0.0/ex?empty
%Req->reqpb.query%              -
"%Req->reqpb.protocol%"         "HTTP/1.0"
%Req->vars.remote-status%       200
%Req->vars.r2p-cl%              83
%Req->headers.content-length%   -
%Req->vars.p2r-cl%              -
%Req->vars.c2p-hl%              412
%Req->vars.p2c-hl%              117
%Req->vars.p2r-hl%              445
%Req->vars.r2p-hl%              117
%Req->vars.xfer-time-total%     0.539
%Req->vars.xfer-time-dns%       0
%Req->vars.xfer-time-cwait%     0 
%Req->vars.xfer-time-iwait%     0.396 
%Req->vars.xfer-time-fwait%     0.524
%Req->vars.actual-route%        DIRECT
%Req->vars.cli-status%          FIN
%Req->vars.svr-status%          FIN
%Req->vars.cch-status%          DO-NOT-CACHE
%Req->vars.unverified-user%     admin





-- 
Institute of Communication Networks and Computer Engineering (IND)
University of Stuttgart
Pfaffenwaldring 47                           Tel: +49-711-685 7968
D-70569 Stuttgart                            Fax: +49-711-685 7983
Johannes Faerber                      faerber@ind.uni-stuttgart.de


------------------------------

Date: Mon, 17 Aug 1998 12:43:54 -0300
From: "Debbie Ervine" <debbie@jot.nb.ca>
Subject: PERL and file updates
Message-Id: <6r9j1j$60a$1@garnet.nbnet.nb.ca>

Hi!

I'm under the gun here and I'm hoping some one can help me.

I need to read a file (one record at a time) and under certain conditions,
move new data to a portion of the record and rewrite the record. Is there
any way to do this in PERL?
 As I see it, my only option is to open the file, read all the records into
an array and do any processing at the same time, then close the file. Next I
would open in read mode, which would of course destroy the original file,
write the contents of my array to the file and close it again. In effect,
this would mean recreating an entire file every time I need to update a
record.
Two questions: am I making any sense here?
and: is there an easier way to do this?

Any help would be greatly appreciated!

Debbie




------------------------------

Date: 17 Aug 1998 12:10:18 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: "Debbie Ervine" <debbie@jot.nb.ca>
Subject: Re: PERL and file updates
Message-Id: <n293a611.fsf@mailhost.panix.com>

"Debbie Ervine" <debbie@jot.nb.ca> writes:

> I need to read a file (one record at a time) and under certain conditions,
> move new data to a portion of the record and rewrite the record. Is there
> any way to do this in PERL?

Certainly.  See the documentation that comes with perl.  In
particular, perlfaq5 addresses various techniques for updating files.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


------------------------------

Date: 17 Aug 1998 16:55:20 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: PERL and file updates
Message-Id: <6r9n9o$itg$1@pegasus.csx.cam.ac.uk>

Debbie Ervine <debbie@jot.nb.ca> wrote:
>I need to read a file (one record at a time) and under certain conditions,
>move new data to a portion of the record and rewrite the record. Is there
>any way to do this in PERL?
> As I see it, my only option is to open the file, read all the records into
>an array and do any processing at the same time, then close the file. Next I
>would open in read mode, which would of course destroy the original file,
>write the contents of my array to the file and close it again. In effect,
>this would mean recreating an entire file every time I need to update a
>record.
>Two questions: am I making any sense here?
>and: is there an easier way to do this?

Two answers: more or less,
and: not in general.

This subject is covered by the entry in perlfaq5

     How do I change one line in a file/delete a line in a
     file/insert a line in the middle of a file/append to the
     beginning of a file?

the gist of which is (i) except in special cases, you have to copy the file
(ii) suggestions of what can be done in the special cases.

If by "easier" you mean "easier to code quickly and robustly", then
copying is the way to go, and hang the expense.   And Perl packages
most of this up for you, with the -i switch.

If the performance is really critical, you'll have to work a lot harder.
See the FAQ.


Mike Guy


------------------------------

Date: Mon, 17 Aug 1998 16:11:51 GMT
From: mmesmer@yahoo.com
Subject: Perl and the DOM
Message-Id: <6r9ko7$rhv$1@nnrp1.dejanews.com>



I'm wondering if there's been any work on a Perl module that can access the
Document Object Model.  I'd like to be able to parse web page elements (like
forms) independent of other content on the page and the DOM seems like a
reliable solution.

Has anyone thought of this?

- Mike

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Mon, 17 Aug 1998 09:36:15 -0700
From: news@russo.org (Chris Russo)
Subject: Re: Perl CGI Question
Message-Id: <news-1708980936150001@buzz.hq.alink.net>

In article <6r5qf6$9mv$1@nnrp1.dejanews.com>, markwb8113@my-dejanews.com wrote:

>I have a perl/cgi script that reads an inventory file into a two dimensional
>associative array. Using that array, I generate an inventory-item/checklist
>web- form. Based on user input (via the web-form), secondary scripts are then
>executed. I would like to pass the inventory data that has already been read
>into my 2-d array from one script to the next. I could just re-read the
>inventory file over and over again in each subsequent script, but I thought
>it would more efficient to re-use the array once it had been loaded
>originally. Any ideas, comments or suggestions, would be greatly appreciated.

Please don't post the same question multiple times, especially not in the
space of less than an hour.

Anyway...

I read Abigail's suggestion, and that sounded like one way to handle your
task.  I have a different perspective on the problem, though.

Rather than passing off execution to some other script, why don't you just
load in the subroutines from another file and then hand your hash to those
subroutines.

Look into 'require' in "man perlfunc", and remember to pass hash/array
references, not the hashes/arrays themselves.

Regards,

Chris Russo

-- 
Chris Russo
news@russo.org
http://www.russo.org


------------------------------

Date: Mon, 17 Aug 1998 15:39:31 GMT
From: sherman@unx.sas.com (Chris Sherman)
Subject: Re: Perl Style
Message-Id: <ExuBHv.K82@unx.sas.com>

In <6r1ele$ccq$1@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:

> [courtesy cc of this posting sent to cited author via email]

>Anyone who thinks "or" is more legible than "||", or "BEGIN" is more
>legible than "{", should go try playing the calculus without recourse
>to any symbolic notation.

Actually, I really like what "or" does.  It is unfortunate that 
the symbol for what "or" does is "or" instead of something like,
oh, \/ or ::.  But just because "or" looks like "or" doesn't
mean I don't want to use it.  In fact, I use it alot.

However I usually use "or" to separate chunks of code.  (ie.  open or die)
I don't use "or" much inside expressions--that is more ||'s domain.  So
"or" makes a good separator between symbol-packed expressions.  Anyway,
JMHO.
-- 
     ____/     /     /     __  /    _  _/    ____/
    /         /     /     /   /      /     /          Chris Sherman
   /         ___   /        _/      /          /
 _____/   __/   __/   __/ _\    _____/   _____/           sherman@unx.sas.com


------------------------------

Date: Mon, 17 Aug 1998 08:44:20 -0700
From: "Brian Andrus" <sysop@millenia.com>
Subject: POSTing out
Message-Id: <6r9j4r$msv$1@supernews.com>

How would I do a redirect and pass variables to another web page at the same
time, using the POST method from PERL?

I need to pass some variables that I use in a PERLSCRIPT off to another
location to be processed further. BUT the other location expects the
variables to be passed in POST mode.

Brian




------------------------------

Date: Sun, 16 Aug 1998 09:34:21 +0100
From: Grant Griffin <grant.griffin@iowegian.com>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <35D6998D.1340@iowegian.com>

I R A Aggie wrote:
> 
> In article <35D59369.3AB3@iowegian.com>, grant.griffin@iowegian.com wrote:
> 
> + I guess I'm still not wise enough to understand how hurting people...er,
> + excuse me...hurting "idiots" is ever helpful.  It might be OK to squash
> + a bug, but remember that behind every "idiot" there is a "person" who
> + has feelings.
> 
> So, you're scorning TomC, eh? Ever consider the possiblity that Tom has
> feelings, too?
> 
> James

James,

I regret it if this hurts your feelings, but I would like to point out
that you unfairly damn me by editorial omission.  Immediately after I
said to Tom "...behind every "idiot" there is a 'person' who has
feelings", I said "I bet you've even been there yourself".  Also, my
very first posting to Tom on this subject began with the sentence "Sorry
to do unto you what you do unto others, but..."

Each Human Being has feelings.  That is precisely the point.  That is
what distinguishes people from insects, and it also is what makes us all
equal ("idiot" and "apostle" alike).  Therefore, I am acutely aware that
Tom C. has feelings.  I am merely trying to make him (more) aware that
others do, too.  If I hurt his feelings in the process, I am actually
showing him the folly of his technique by applying it to him (though as
kindly as possible); I want to remind him of what if feels like to be on
the other end.

All that calling people "idiots" accomplishes is that it gives you
licence to step on them.  Actually, it probably even feels _good_ to
step on an idiot--just like it feels good to step on a cockroach.  Don't
you think people who step on idiots get a little "charge" when they hit
the "Send" button?  But if instead of "idiots", you call them "Newbies"
then you have no such license, and in fact, you might even feel
obligated to kindly help them learn something.  The choice is up to
you...

It _has_ occurred to me that there must be many people who enjoy Tom's
blood-lettings--and they probably don't appreciate my reform efforts. 
However, I fully understand that Tom has been at this for many years,
and I'm sure somebody like me comes (and goes) every now and then;
evidently Tom has been able to resist so far, so I really only hope to
make the world of Perl a better place in a very, very, very small way.

=g2
--


------------------------------

Date: Sun, 16 Aug 1998 09:40:32 +0100
From: Grant Griffin <grant.griffin@iowegian.com>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <35D69B00.4431@iowegian.com>

I R A Aggie wrote:
> 
> No. A car is a complex system, and has many features you may not be
> familiar with. Anti-lock brakes, for instance. Unless told, most people
> will not be able to tell you, for sure, how its done. Writing things down
> is an old and honored tradition of passing information, knowledge and
> ideas.
> 

Actually, I understood about the anti-lock brakes.  There wasn't
anything to understand, really: they just come on automatically as
needed when I push the pedal.  But I had to read the manual to learn how
to run the _air conditioner_!  Is there a good reason why the air
conditioner should be so difficult to run, and so different from every
other car I have ever ridden?

You must have a slow time traveling, having to stop and read the manual
of each complex automobile system you rent! ;-)

=g2


------------------------------

Date: Mon, 17 Aug 1998 10:47:04 -0500
From: Grant Griffin <grant.griffin@nospam.com>
Subject: Re: Q: How to read all the file name in a directory
Message-Id: <35D85077.9DD0DE55@nospam.com>

Stefaan A Eeckels wrote:

> > In an ideal world, any given gizmo would be so easy to use that nobody
> > would _have to_ read the manual!  (Not that Windows is even remotly
> Frankly, this is one of the silliest statements I have heard
> in a long time.
> > _close_ to that goal.)  For example, I just bought a new car.  Do I want
> > to read the manual?  No.  Did I have to?  Yes.  The people who designed
> > the car screwed up.
> Design a system even an ignoramus can use, and you'll find
> only ignorami will want to use it ;-)

This gives me an in to go back to a point Tom C. had made.  He had stereotyped
people based on their choice of operating systems (Windows/Unix).  I don't
think that makes much sense, and, in fact, it sounds _to me_ like "one of the
silliest statements I have heard in a long time".  But if one _were_ to
stereotype Windows Users versus Unix users I might suggest:

    - Unix users value simplicity-of-concept at the expense of
difficulty-of-use; Windows users value ease-of-use at the expense of
complexity-of-implementation.  (But complexity-of-implementation is a problem
primarily for the programmer, not for the user.)
    - Windows users seem to be a little more tolerant of the failings of
others.  After all, we tolerate the multitudinous failings of Windows, don't
we?!  Since our Operating System sets no example of "perfection", we are more
likely to understand that we (and others) are imperfect.  (That's a very
polite way of saying we have fewer genuises with bad social skills...)

But  stereotyping people based on choice of OS is just plainly silly.  You
might as well stereotype them based on eye color (mine are green).

As a Windows programmer, I can tell you that it takes a _great deal_ of
programmer effort to make the thing "so easy to use that nobody would have to
read the manual".  Obviously, that can't entirely be done, which is why
Windows programs always ship with a Help System (er...excuse
me..."manpages").  Even then, the user often gets frustrated, and/or calls the
Help Desk.  I contend that each consultation of the Help System, and each call
to the Help Desk, are symptoms of a system which should be easier to use.
Yes, even if they come from us ignorami.  (I fully understand that some people
want Unix to remain A Very Exclusive Club, but that notwithstanding, I think
it is a good thing, not a bad thing, if people with lesser abilities then you
and I have are able to use computers.)

But I submit to you that only the truly _masochistic_ would read the manual on
a system which is so natural and intuitive to use that you don't have to.  For
example in reaching my "journeyman" level of Perl competancy, I have read well
over half of "Programming Perl" in bits and pieces--but I certainly have no
ambition to read it cover-to-cover.  Likewise, I have no desire (or time) to
read all 1000+ pages of on-line Perl documentation.

On the other hand, I _have_ read the much briefer--and much more
accessible--book, "The C Programming Language" cover-to-cover, three times.
What Tom doesn't seem to grasp (or maybe is denying) is that people often
_have_ read the documentation--his documentation--but they can't understand
it, becase it isn't written at an "ignoramus" level.  (Perhaps this is why he
gets so offended when people _still_ have dumb questions which therefore
expose "flaws" in his documentation.)  In that vein, IMHO, "Programming Perl"
should be renamed "The Perl Reference Manual".  It's a great book--IF you
already understand the stuff it covers!  For example, I hate to say this, but
_honestly_, the chapter on regular expressions should be hanging in The Museum
of Bad Technical Writing.  (Sorry, Tom--but they tell me you have a thick
skin.)  I much prefer the story of The Little Engine Who Could!

=g2



------------------------------

Date: Mon, 17 Aug 1998 11:08:35 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Quickie encapsulation question
Message-Id: <35D84773.16CC@min.net>

nick@imationstudio.com wrote:
> 
> Let's say I have a package:
> 	package JobOrder;
> In that package, I have several other classes "used" and instantiated. 
> The one in question is my own class, called Validate. I go and do:
> 	$val = new Validate;
> I can assume this object now exists fully scoped as $main::JobOrder::val.

That's assuming that $val is a "global" variable in package JobOrder,
rather than a lexical ("my") variable in some subroutine or other block.
But I assume that's what you want.

And you really don't need the 'main::' part, it just adds clutter.


> I've got it working now so that if any method in my $val object needs to
> access a method in the JobOrder class, I can call it explicitly. But I don't
> want to do that. (no reuse payoff) What I want to do is have the caller pass
> name of the package it's in and have the method buried inside the class know
> how to call methods in the calling class at invocation time, which can change
> from invocation to invocation.  i.e.:
> 	$val->whatever("JobOrder", $whatnot, $foobar);
> and having the method in $val calling a method in JobOrder by having this:
>   whatever(@) {
>     my( $package, $param1, $param2 ) = @_; # (I rewrote this.)
>     # call a method in the upstream class
>     $$package::upstream_class_obj->upstream_class_meth();
>   }

You have a blessed object, $val, of package Validate.
And you call $val->whatever().  That means the first argument to
whatever() is going to be the object reference; but your code
ignores it.  The fact that you also left out the 'sub' keyword makes
me think you should have posted your actual code (with irrelevant
lines deleted).

Now you should remember that you can call "package methods" just
like object methods, but passing the name of the package as the
first argument. You can use the arrow syntax if you want.

	sub whatever {
	  my( $self, $package, $param1, $param2 ) = @_;
	  $package->upstream_package_method(); # PACKAGE method
	}

Part of your confusion is the distinction between methods of
objects -- which (big surprise) require an object reference --
and methods of packages, which require a package name.
If you only pass the name of a package, where do you expect to
get a reference to an object in that package from, let alone
call a method on that object?

Judging by the little bit of code you gave, you seem to have 
implemented JobOrder as a non-object package, i.e. providing
only package methods, not object methods.  You will probably
be better off making it use objects. If you do, then you will
pass an object reference to whatever(), rather than a package
name:

	sub whatever {
	  my( $self, $joborder, $param1, $param2 ) = @_;
	  $joborder->upstream_object_method(); # OBJECT method
	}

Next question?

-- 
John Porter


------------------------------

Date: Mon, 17 Aug 1998 15:08:24 GMT
From: Darren@introdesign.com (Darren Ferguson)
Subject: Random Number
Message-Id: <35d8473c.2260737@news.demon.co.uk>

Is there a random number command for Perl or in fact a routine.

Thanks

Darren
Darren@introdesign.com



------------------------------

Date: 17 Aug 1998 15:36:39 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Random Number
Message-Id: <6r9im7$jhd$9@info.uah.edu>

In article <35d8473c.2260737@news.demon.co.uk>,
	Darren@introdesign.com (Darren Ferguson) writes:
: Is there a random number command for Perl or in fact a routine.

Did you even bother to read the FAQ or the docs or some book on Perl?
I found 38 occurrences of `random' grepping through the FAQ and docs.

RTFM.

Greg
-- 
It has been discovered that C++ provides a remarkable facility for concealing
the trival details of a program--such as where its bugs are. 
    -- David Keppel


------------------------------

Date: Mon, 17 Aug 1998 13:03:43 -0400
From: Ruben I Safir <rs83@is7.nyu.edu>
To: David Epstein <dse4984@omicron.ACF.NYU.EDU>, Yelena <yqm6091@is.nyu.edu>
Subject: Re: Reference Confussion
Message-Id: <35D8626F.79C3FE93@is7.nyu.edu>

I'm not trying to dereference the hash.  

What I'm really trying to do is create/declared data structure which I
can
use to create select statments from SQL.

Prior to reading the replies to this message, I altered the code to the
following:

%build=( cols => [],
        tabs=>[],
        where=>[]->{ left_column =>{},
                     ops =>{},
                     right_values =>{},
                     bool =>{}
                   },
      'sort' => \$order
    );


The idea in my mind is that 
build{cols}[$i] will return column names. (build{col} is contains a
string)
build{tabs}[$i] will return a table name.
build{where}[$i]{left_column}{join1} will return a colum for joining
build{where}[$i]{ops}{operator} will return a conditional binary
operater
build{where}[$i]{right_value}{join2} returns the left side of the where
condition.
build{where}[$i]{bool} returns a logical operator like AND optionaly
 
build{where}[$i] is a set for one where section.
and 
where{sort} returns an order.

Then I will parse it from a UUENCODED post to create a statment

$statment = select tab1.col1, tab1.col2, tab2.col3 
            from tab1, tab2
            where( tab1.col1 = tab2.col3 )


The issue seems to be that something like

$build{where =>[] -> {}} needs to be initialized?

Ruben


------------------------------

Date: Mon, 17 Aug 1998 13:09:49 -0400
From: Ruben I Safir <rs83@is7.nyu.edu>
Subject: Re: Reference Confussion
Message-Id: <35D863DB.3C80129D@is7.nyu.edu>

> (Not sure
> what you were trying to do with that...is 'where' meant to be a reference
> to a hash (my guess) or a reference to an array of references to hashes?
> If the latter, the syntax is different...followup if you need that.)

The idea is for where to be a reference to an array of references to a
hashs.

If it wasn't a hash element I would make it

$where -> [] -> {}

But since it is a hash element which expects a string and anonymous
arrays return strings I thought I could do this
{
 where =>[] -> {}
}


------------------------------

Date: 17 Aug 1998 12:35:53 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Ruben I Safir <rs83@is7.nyu.edu>
Subject: Re: Reference Confussion
Message-Id: <1zqf5x52.fsf@mailhost.panix.com>

Ruben I Safir <rs83@is7.nyu.edu> writes:

> The idea is for where to be a reference to an array of references to a
> hashs.

   $where = [ {}, {}, {} ],

You sure that's what you want?

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


------------------------------

Date: Sat, 15 Aug 1998 21:37:08 GMT
From: theobald.john@mcleodusa.net
Subject: Spawning Perl script on NT
Message-Id: <35d5fe3e.8995414@news.mcleodusa.net>

Hello there!,

I have a perl script which i am using to provide an HTML screen full
of input options to be handed off to another Perl script on NT. 

Everything is working just fine, except that the process which I hand
all of this information off to takes a long time to run.  

I'd like to do the equivolent of a fork() and just give the child
process an e-mail address that it can send a message to when it is
done.

I have the e-mailing all up and working already too.  The question is,
how do i get NT to allow something like a fork so that the original
Perl CGI script can let the user get on to bigger and better things
while the big process is chugging away?  

Thanks in advance for any suggestions.  --> Jake


------------------------------

Date: Mon, 17 Aug 1998 12:03:03 -0400
From: John Porter <jdporter@min.net>
Subject: Re: taint checking seems to slow down my code
Message-Id: <35D85437.5F8B@min.net>

Mark-Jason Dominus wrote:
> Bill 'Sneex' Jones  <bill@fccj.org> wrote:
> >Who started this whole setuid thing anyways?
> 
> Dennis.

"I didn't know you were called Dennis!"

"Well you didn't bother to find out, did you."

-- 
John Porter


------------------------------

Date: Mon, 17 Aug 1998 12:22:13 -0400
From: Rich Bowen <rbowen@rcbowen.com>
Subject: Re: What is the purpose of Perl
Message-Id: <35D858B5.5EA7@rcbowen.com>

> In article <35D30FE9.1530@min.net>, John Porter  <jdporter@min.net> wrote:
> >for $him ( @crowd ) {
> >  unless ( defined $him->{'sin'} ) { # yes, you better quote it!
> >    $him->throw( $stone[0] );


You might also want to give them the chance to confess() before they
croak();

-- 
perl -e "eval  reverse '\'rekcaH lreP rehtonA tsuJ\' tnirp'"
http://www.rcbowen.com/


------------------------------

Date: Mon, 17 Aug 1998 10:53:31 -0400
From: "Kevin Genus" <kgenus@newbridge.com>
Subject: WIN32::NetAdmin User Management
Message-Id: <6r9fm6$ifh8@hernnews.us.newbridge.com>

I'm in the process of building a web based user management system for my
domain.  There is one problem, Win32::NetAdmin does not appear to support
the 'Full Name' feature of the user container.

How are people getting around this, or at least getting the full name added
to the user field?

Kevin Genus
Newbridge Networks Inc.
kgenus@newbridge.com




------------------------------

Date: Mon, 17 Aug 1998 14:43:23 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6r9fib$k8u$1@nnrp1.dejanews.com>

In article <6r5ne8$anr$1@client3.news.psi.net>,
  abigail@fnx.com wrote:
> Patrick Timmins (ptimmins@netserv.unmc.edu) wrote on MDCCCX September
> MCMXCIII in <URL: news:6r4siv$1r3$1@nnrp1.dejanews.com>:
> ++ In article <35D5A203.BC2852D5@shaw.wave.ca>,
> ++   Rick Delaney <rick.delaney@shaw.wave.ca> wrote:
> ++ > The part that is left out before this elegant explanation is
> ++ >
> ++ > Regex sees ''
> ++ >   Regex matches the null string at the first possible place.
> ++ >
> ++ > The part you fail to understand is that the first possible place is
> ++ > *between* the 'J' and the 'u'.  This is a special case with split that
> ++ > only applies to patterns that match the null string.
> ++
> ++ The part you fail to understand is that the first possible place is
> ++ *between* the first null and the 'J', as you can see here:
>
> No. The documentation says that if the regex matches the null string,
> the split is special cased, and the splits will only occur *between*
> characters where the regex matches.
[snip]

Understood ... finally. This thread is done. Thank you for your persistence.

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 3464
**************************************

home help back first fref pref prev next nref lref last post