[9940] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3533 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 25 06:02:01 1998

Date: Tue, 25 Aug 98 03: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           Tue, 25 Aug 1998     Volume: 8 Number: 3533

Today's topics:
    Re: (Simplest) way to convert string to array of chars? <b.d.low@unsw.edu.au>
        any module for rshell? (GEMINI)
    Re: Are $a and $b some special variables? <rra@stanford.edu>
    Re: Counting files in a directory in WinNT (Martin Vorlaender)
    Re: Detecting Socket Close <rra@stanford.edu>
        Exporting Methods <se96ms@english.iielr.dmu.ac.uk>
    Re: Exporting Methods (Honza Pazdziora)
    Re: Help with pattern matching... huntersean@hotmail.com
    Re: Help!..re: secure sendmail question (Marc Haber)
    Re: Help: How can I use full path of a *.pm file?? <wade@cs.ualberta.ca>
    Re: Help: How can I use full path of a *.pm file?? huntersean@hotmail.com
    Re: Help: How can I use full path of a *.pm file?? <rra@stanford.edu>
    Re: new and with a lot of questions <rra@stanford.edu>
        OO Question <se96ms@english.iielr.dmu.ac.uk>
    Re: Pattern match for filename extensions huntersean@hotmail.com
    Re: Perl compiler <ajohnson@gpu.srv.ualberta.ca>
    Re: Perl compiler (Craig Berry)
    Re: Perl compiler (Craig Berry)
    Re: Perl documentation <rra@stanford.edu>
    Re: Perl documentation huntersean@hotmail.com
        PERL environment/shell execution? <daphna@exlibris.co.il>
    Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFO no.unsoliciteds@dead.end.com
    Re: Perl Style <rra@stanford.edu>
    Re: PerlBots <leon@netcraft.com>
    Re: Prime numbers [was Re: here's an implementation of  (Ilya Zakharevich)
    Re: Question about calling Perl from Perl <rra@stanford.edu>
    Re: Referancing and dereferancing (Paddy Spencer)
        Setting DOS environment from PERL scripts <daphna@exlibris.co.il>
        Switching user id's in mid stream (Matt Roberds)
        Where to find Net::Domain? <versace@gianni.com>
    Re: Why dont people read the FAQs (Richard Clamp)
    Re: Y2K Date Support dave@mag-sol.com
    Re: Yes, someone else in need of PERL help <wade@cs.ualberta.ca>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Tue, 25 Aug 1998 19:26:19 +1000
From: Benjamin Low <b.d.low@unsw.edu.au>
Subject: Re: (Simplest) way to convert string to array of chars?
Message-Id: <35E2833B.FFFB468@unsw.edu.au>

Mark-Jason Dominus wrote:
> >@chars = split(/.??/, $string);
> 
> That's just bizarre.

That's me :-) Seriously, I arrived at .?? by playing with various
combinations of PATTERN, but didn't try the empty pattern (which of
course I should have if I'd thought much about what split does...)

Zenin wrote:
 ...
>         Which is why this thread begs the question, what exactly do
> you plan on doing with this array of char?

I came across a piece of code which had some "copy protection" in the
form of an encoded string which ultimately was printed as
a copyright notice. The actual split was like this:

@c = split(/X*/, '^&G^%7_ messed up string ,.T^&TR^&');

where '...messed up string...' was the "encoded" notice. After the
string was turned into an array it was joined via a slice with the
appropriate indices to "decode" the string. ('X' did not occur in the
string)

Basically I couldn't see why you'd pick 'X' and wondered what the best
way of splitting the string was...

NOTE I'm not ripping off the code, I have full permission from the
copyright holder to fiddle with it. He's just a bit busy for me to
hassle right now...

Thanks for the help!

-- 
 Benjamin Low
 Web Programmer, Communications Unit, University of New South Wales
 (02) 9385 1138  b.d.low@unsw.edu.au  b.d.low@ieee.org


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

Date: 25 Aug 1998 08:26:22 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: any module for rshell?
Message-Id: <6rtsfe$fmp$1@netnews.csie.NCTU.edu.tw>

hi all,

  is there any network module that can provide
remote shell function? I am under win95 system
and have no RSH program to use.
thanks.


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

Date: 25 Aug 1998 02:17:13 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Are $a and $b some special variables?
Message-Id: <m3af4t8lpi.fsf@windlord.Stanford.EDU>

Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
> karlon@bnr.ca wrote:

>> To paraphrase:  $a and $b are package globals exempt from "use strict"
>> restrictions.

> ...  which is a long-standing bug in the warn()er.  I wonder why nobody
> would fix it...

Because figuring out whether a routine could have been called from a sort
routine is impossible in the general case and adding more specific special
cases just makes the whole situation even more confusing.

And besides, like Larry said, it's rather rare for people to typo $a and
$b.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 09:07:39 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Counting files in a directory in WinNT
Message-Id: <35e262bb.524144494f47414741@radiogaga.harz.de>

npolonsk@hotmail.com wrote:
: I know that there is probably some simple way to do this, but I can't seem to
: find it for some reason:

: I want to count the number of files there are in a directory. I know that if
: I were under UNIX I could simply ready the results of "ls | wc -l". However,
: even with the NT ports of LS and WC I'm having problems.

: I'm using a foreach loop to go through an array of directory names.

: Can anyone help? There's probably some function that does it, but for some
: reason I can't find it in the FAQ's.

opendir DIR, $yourdir or die "Oops: $!";
my @files = grep { !/^\.\.?$/ } readdir DIR;
closedir DIR;
$count = scalar @files;

This gives you everything in the directory. If you only want files, add a
'&& -f $yourdir.'/'.$_' in the grep block.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 OpenVMS: Where do you    | work: mv@pdv-systeme.de
 want to BE today?        |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 25 Aug 1998 02:09:06 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Detecting Socket Close
Message-Id: <m3g1el8m31.fsf@windlord.Stanford.EDU>

Christopher M DiPierro <cdipierr@wam.umd.edu> writes:

> I am writing a small perl client that is designed to test some HTTP/1.1
> features. A problem I have is with persistent connections. I can easily
> make a socket connection, send a request, receive a response and close a
> connection. However, if I want to send another request on that same
> socket (HTTP/1.1 or 1.0 /w Keep-Alive allows this) I need to see if the
> server closed the socket. What's the best way to do this?

This may not be the *best* way, but it works:  set $SIG{PIPE} to 'IGNORE'
and then just try to reuse the socket by writing to it.  If your write to
the socket fails and $! gets set to EPIPE, then the server closed the
socket.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 09:52:44 +0100
From: Mark Simonetti <se96ms@english.iielr.dmu.ac.uk>
Subject: Exporting Methods
Message-Id: <Pine.OSF.3.96.980825095132.26215B-100000@english.iielr.dmu.ac.uk>

I'm currently writing a Perl script which uses classes.  Reading a book on
Perl tells me I need to export methods to use them.. yet I don't seem
to have to ?  Am I missunderstanding something ?  It says I need to use
"Exporter" !

Mark.
--
=================================
Mark Simonetti
se96ms@dmu.ac.uk
marks@webleicester.co.uk
http://www.cms.dmu.ac.uk/~se96ms/
=================================

"I used to be indecisive, but now I'm not so sure."



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

Date: Tue, 25 Aug 1998 09:13:36 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Exporting Methods
Message-Id: <slrn6u501v.dhd.adelton@aisa.fi.muni.cz>

On Tue, 25 Aug 1998 09:52:44 +0100, Mark Simonetti <se96ms@english.iielr.dmu.ac.uk> wrote:
> I'm currently writing a Perl script which uses classes.  Reading a book on
> Perl tells me I need to export methods to use them.. yet I don't seem
> to have to ?  Am I missunderstanding something ?  It says I need to use
> "Exporter" !

Well, this statement should read

	"use Exporter;"

If you use

	use Exporter;

in your module, your module will be capable of exporting the things
via @EXPORT, @EXPORT_OK and friends.

Hope this helps,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Tue, 25 Aug 1998 08:38:57 GMT
From: huntersean@hotmail.com
Subject: Re: Help with pattern matching...
Message-Id: <6rtt75$b0f$1@nnrp1.dejanews.com>

In article <35E199EC.62CE4CC@negia.net>,
  Dan Boorstein <danboo@negia.net> wrote:
> huntersean@hotmail.com wrote:
> >
> > In article <6rpn6o$g7i$1@nnrp1.dejanews.com>,
> >   kevin@zippy.tnet.com wrote:
> > > Looking for a bit of help...

> > mentioned:
> >
> > ($list, $archive, $article, $position, $length) =
> >         m|.*/(.*?)/(.*?)/(.*?): @(.*?)\((.*)\).*|;
>                                         ^^    ^^
>
> uhh, no it won't. i believe you need to change your escaped parens
> to curly brackets. it's also slower than either of the responses
> posted thus far, which is perhaps of little importance to the
> original poster.
>
> cheers,
>
> --
> Dan Boorstein   home: danboo@negia.net  work: danboo@y-dna.com
>

Hey, you're right (my eyesight's not too good & the monitor I'm on is a bit
flickery).  The disadvantage of the some of other ones is that they make some
assumptions about character classes which may not necessarily be true. 
Without more knowlege of the specific problem I'd hesitate to say which is
best.

Sean H.

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


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

Date: Tue, 25 Aug 1998 08:56:55 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Help!..re: secure sendmail question
Message-Id: <6rtuam$ojq$2@nz12.rz.uni-karlsruhe.de>

"Mr. mister" <leegala@nospam.ican.net> wrote:
>Where do you see it posted four times asshole?

<35DEEA72.64719364@nospam.ican.net>
<35DEEA73.64719334@nospam.ican.net>
<6rnem2$1au$67@elle.eunet.no>
<6rnels$1au$58@elle.eunet.no>

You posted twice. Both your articles were duped by a norwegian system
running wild.

Btw, you neither have a real name, nor a replyable return address and
a broken message ID.

>Even if I did, it would
>have been by accident. So go fuck yourself.

Not to mention missing manners. Plonk.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: 25 Aug 1998 02:22:22 -0600
From: Wade Holst <wade@cs.ualberta.ca>
Subject: Re: Help: How can I use full path of a *.pm file??
Message-Id: <r7af4tjwsh.fsf@rimbey.cs.ualberta.ca>


Abbas Imani <"abbas "@ikorn.ee.unsw.edu.au> writes:

Hi Abbas, 

> I am trying to use a file in a /usr/local/bin directory. I use the
> folloing format :
> use ::usr::local::bin::book_item;
> Perl5 compiler recognizes the file in the directory but it gives an
> error of
> 
> Can't call method "import" without a package or object reference at
> ./book line 3.
> BEGIN failed--compilation aborted at ./book line 3.
> 
> Please note that if I copy the book_item.pm file to Perl5 directory and
> just type
> use book_item;
> no error occures.

> I am wondering if anybody has any idea about how I can define a full
> path for a *.pm file when used in use command.

Simple answer: Don't :-)

Add '/usr/local/bin' to your PERLLIB or PERL5LIB env. variable.  
Although .pm files really shouldn't be in /usr/local/bin (/usr/local/lib makes
more sense, and /usr/local/perl/lib is probably better :-)

And the 'import' error is probably because 'book_item' doesn't inherit from 
Exporter.

-- 
Wade Holst                       |------------------------------------------| 
wade@cs.ualberta.ca              | (setq Happiness '( "emacs" . "perl5" ) ) |
http://www.cs.ualberta.ca/~wade  |   @Happiness = ( "emacs" . "perl5" );    |
University of Alberta            |------------------------------------------|


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

Date: Tue, 25 Aug 1998 09:10:46 GMT
From: huntersean@hotmail.com
Subject: Re: Help: How can I use full path of a *.pm file??
Message-Id: <6rtv2l$d62$1@nnrp1.dejanews.com>

In article <35E23F2D.BDA5D980@ikorn.ee.unsw.edu.au>,
  Abbas Imani <"abbas "@ikorn.ee.unsw.edu.au> wrote:
> Hi folks,
> I am trying to use a file in a /usr/local/bin directory. I use the
> folloing format :
> use ::usr::local::bin::book_item;
> Perl5 compiler recognizes the file in the directory but it gives an
> error of
>
> Can't call method "import" without a package or object reference at
> ./book line 3.
> BEGIN failed--compilation aborted at ./book line 3.
>
> Please note that if I copy the book_item.pm file to Perl5 directory and
> just type
> use book_item;
> no error occures.
> I am wondering if anybody has any idea about how I can define a full
> path for a *.pm file when used in
> use command.
>
> Cheers,
> Abbas IMANI

[massively long .sig snipped]

The directory needs to be added to your @INC environment variable.  To include
modules in "/foo/bar", and "/bar/baz", just add the line..

use lib qw(/foo/bar /bar/baz);

 ...above where you use or require those modules.  This will prepend those
directories to @INC.

Regards

Sean Hunter

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


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

Date: 25 Aug 1998 02:20:21 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Help: How can I use full path of a *.pm file??
Message-Id: <m37lzx8lka.fsf@windlord.Stanford.EDU>

In comp.lang.perl.misc, Abbas Imani <"abbas "@ikorn.ee.unsw.edu.au> writes:

> I am trying to use a file in a /usr/local/bin directory. I use the
> folloing format : use ::usr::local::bin::book_item;

Wow.  I have to say that that's the first time I've *ever* seen anyone try
that, and I don't think I would have thought of it in a million years.

Um, well, the first question that I have is why you're putting a
non-executable file in a bin directory, but I suppose you must have your
own good reasons for doing that.  The way to tell Perl to read a module
out of an arbitrary directory is to add that directory to the search path
before loading the module.  You can do that with:

        use lib '/usr/local/bin';
        use book_item;

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 25 Aug 1998 02:39:31 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: new and with a lot of questions
Message-Id: <m34sv18koc.fsf@windlord.Stanford.EDU>

stacy wright <hopeandprayers@hotmail.com> writes:

> I've never used a usnet group before so beware fumbling steps. just got
> Linus v5, and perl 5 for dummies. i need some info to use group and my
> software,especially my perl v4 already resident in Linux and the perl 5
> that i've just aquired. help!!!!

Welcome!  You've got a *lot* of fun ahead of you!

The first thing is that we're all going to find it really hard to help
without more specific questions.  ;)  The closest that I could find to a
specific question in that is that you've not sure about the differences
between Perl 4 and Perl 5; my recommendation is to just not worry about
it, delete Perl 4, and install Perl 5.  Perl 4 is an older version of Perl
with a lot of bugs and much less functionality and you don't want to use
it.

Beyond that, I'd recommend that you get a better book about Perl;
_Learning Perl, 2nd Edition_ by Randal Schwartz and Tom Christiansen
(published by O'Reilly) is probably the best.

Good luck!

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 10:17:04 +0100
From: Mark Simonetti <se96ms@english.iielr.dmu.ac.uk>
Subject: OO Question
Message-Id: <Pine.OSF.3.96.980825100820.26215C-100000@english.iielr.dmu.ac.uk>

Say if I have the following classes:

Expression - Creates an expression tree and token list from a given
             regular expression, given as a string.

ExprTokens - Creates tokens from a given regular expression (given as a
             string)

ExprTree   - Creates an expression tree from a given regular Expression
             (given as a string).

ExprTree has to use ExprTokens to convert its given regular expression to
the expression tree.

Basically, I want to be able to do this:

$expr = new Expression ('10+30*40');  # for example..

and then be able to do this:

$expr->tree;   # would return the tree
$expr->tokens; # would return the tokens
$expr->expr;   # would return the original expression in string form.

Now, basically, I've been an impreretive programmer for some time and only
just started using object oriented style..  So I'm not sure of the best
way to do this.

Since ExprTree already uses ExprToken to create the tokens from its given
string.. Should I also include it in the "Expression" class ?

Let me illustrate (e&oe):

package Expression; 

sub new
{
  my($expr) = $_[1];
  my($tokens, $tree):
  my($this) = {};

  $tokens = new ExprTokens($expr); # works out the tokens
  $tree   = new ExprTree($expr);   # works out the tree
  
  $this{'expr'} = $expr;
  $this{'tokens'} = $tokens;
  $this{'tree'} = $tree;

  bless($this);
  return($this);
}

Now, the tokens are being calculated twice !  I basically don't think I've
done this right, even though it'd probably work.  Should I provide a
method in exprtree to get the tokens or something ?  Can someone good at
OO tell me how they'd do it please !?

Thanks, any input would be appreciated.  Please reply to the email address
if possible, if not just to the newsgroup :)  Its just kinda urgent, so
straight to my email address would be appreciated.

Mark.
--
=================================
Mark Simonetti
se96ms@dmu.ac.uk
marks@webleicester.co.uk
http://www.cms.dmu.ac.uk/~se96ms/
=================================

"I used to be indecisive, but now I'm not so sure."



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

Date: Tue, 25 Aug 1998 08:32:53 GMT
From: huntersean@hotmail.com
Subject: Re: Pattern match for filename extensions
Message-Id: <6rtsrl$ato$1@nnrp1.dejanews.com>

In article <346B48D4AE18D11181FB00609762664D6055C8@atlantis.stnc.co.uk>,
  "Ryan Cook" <rcook@stnc.com> wrote:
> Thanks everyone for the solutions!
>
> Now can anyone tell me how to do a regex which will match a pattern at the
> end of a string. What I really need to know is how to use Assertions,
> particularly \Z which "..matches at the end of the string."
> (Larry Wall's "Programming Perl" 2nd edition Page 62; I'm reading it as I
> type this stuff in...).
>
> Again, Your help greatly appreciated, in advance!!!
>
> Thanks, Ryan
> rcook@stnc.com

$a = "bar";
$b = "foobar";
$c = "barfly";

for ($a, $b, $c) {
	if (/bar\Z/) {
		print "$_ matches\n";
	}
	else {
		print "$_ doesn't match\n";
	}
}

Produces...

bar matches
foobar matches
barfly doesn't match

In other words /bar\Z/ matches "bar" at the end of a string but not anywhere
else.  Pg 62 (which you say you're reading) makes this pretty clear IMHO.
Perhaps you need to develop the skill of writing small test programs like the
one above to try things out.

Sean Hunter

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


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

Date: Tue, 25 Aug 1998 03:29:46 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Perl compiler
Message-Id: <35E275FA.601FDAB7@gpu.srv.ualberta.ca>

Craig Berry wrote:
! 
! [comp.lang.perl.modules trimmed from followups]
! 
! Andrew Johnson (ajohnson@gpu.srv.ualberta.ca) wrote:
! : Craig Berry wrote:

[snip]
! Very good analogy to the proprietary vs. free-software schools in
! our own profession.  Note, however, that (even though they love
! doing it!) the 'pure', non-proprietary scientists are in fact
! getting paid for their work.  Everybody's got to eat.  
! Deny even the most enthusiastic astrophysicist *any* route to
! putting bread on the table, and he'll find a day job (and
! probably continue astrophysics as a hobby, but with far less
! time, energy, and resources to devote to it).

of course ... but if he loved to contribute to the Science of
astrophysics he'd likely hate working for a company which did
advanced research and kept important scientific findings to
themselves in order to profit in some way or another ... in fact,
it might be so against his world-view that he couldn't stomach
the job...he may even experience 'some sort' of dilemma...

! : Viewed in that light, your attempt at belittling how Tom C might
! : choose to earn a living with your accusation that he is as guilty of
! : not sharing or "stopping others from learning" as those who hide
! : their code rings a little hollow.
! 
! I understand your point, though *please* note that I'm not
! attempting to belittle Tom C! The man's a demigod of free
! software, a fountain of purest perlessence, and I thank him most
! humbly for his labors on my (and others') behalf.  I merely
! wished to make clear that Tom's path of "distribute free
! software, live off teaching and consulting" has no *inherent*
! moral superiority over "sell proprietary software, live off
! revenues." They are merely two different ways to make a living.

the thing about morals is that there isn't any *inherency* about
them ... but, I don't find any 'inherent' hypocricism(?) in Tom
making a living teaching and consulting; and also giving away software 
and documentation; and also stating that he's morally opposed to
proprietary sources ... and hypocracy seemed to be the accusation
you were making.

regards
andrew


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

Date: 25 Aug 1998 08:28:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl compiler
Message-Id: <6rtsjd$59r$1@marina.cinenet.net>

Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote:
[snipped: Many good comments, boiled down to:}
: How does people seeing the source code reduce the income you generate
: from it? 

The idea is that, if I come up with a better mousetrap (say, an order
log(n) qsort variant, never mind that it can't be done) which I use as the
core of my Perl FooDB app, which is thereby screamingly faster on large
datasets than any other similar app, I have many choices how to proceed:

1. Give it away GNU style, free in both monetary and hack-away-at-it
   senses.
2. Give it away under a more restrictive license (no mods, no commercial
   use, whatever).
3. Sell it with source, under a restrictive license.
4. Sell it without source.

The analysis is that only option 4 protects my innovation, my trade
secret, whereby I gain my competitive advantage.  (Options 2
through 4 provide *legal* protection, but small businesses
frequently don't have the resources to pursue IP issues
succesffully.)  

Admittedly, most apps don't contain a breakthrough of that magnitude, but
there are people (and comapnies) that would object to spending hundreds of
hours of 'work time' (the time they expect to yield bread on the table)
and then see others benefitting from their labor without paying for it. 
As I said, different business model; such people want to get money at the
front end, not the back.

: I can just as easily copy a binary and illegaly use it as I can source
: code... 

Yes, but you can't just as easily reapply pieces of it in your own apps. 

: You can license the code so that it can not be copied or redistributed in 
: exactly the same way as you license the executable. Of course there may be
: some who break the law, but that applies to both the source and the
: executable.

The law also says that nobody is allowed to enter my home and take my
possessions without my permission.  I also know that even good home
security can be overcome by a determined thief.  Nonetheless, I keep my
doors locked, on the theory that not everyone obeys the law, and that it's
harder to steal from my home if the doors are locked.  The case for binary
distributions is exactly analogous. 

: I don't understand this whole 'hide-the-source' mentality. OK some people
: might steal from you by illegaly redistributing or using the source, but
: a simple licensing agreement will stop all but those who would steal
: your executable version anyway.

A stolen/license-violated executable is one lost sale, or a competitor
expending very significant effort to disassemble and reverse-engineer my
code.  Stolen source is potential loss of *all* my sales, if some
unscrupulous person makes insignificant changes and undercuts my price.
Knowing that I can recover from bankruptcy, possibly, in five years when
the resulting IP infringement case reaches court is a small consolation.

: Look at the GPL it is based on the assumption that people will honour the
: license and not use GPL code without following the agreement and putting
: there code under GPL as well. Of course I'm sure some people have broken
: the agreement and broken the law - but that is on their conscience...

GNU's world, and the Net before the Great Invasion, seem much like a
small, isolated, communist-leaning village.  Doors unlocked, work done for
the common good, wealth distributed evenly, and idealism ruling the daily
lives of its citizens.  It's a lovely picture, and I enjoy visiting on
occasion.  But I don't find that it is *always* a practical approach to
solving real-world problems.  Like how to put bread on my table. 

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 25 Aug 1998 08:37:05 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl compiler
Message-Id: <6rtt3h$59r$2@marina.cinenet.net>

Abigail (abigail@fnx.com) wrote:
: Craig Berry (cberry@cinenet.net) wrote on MDCCCXX September MCMXCIII in
: <URL: news:6rt1jv$9fu$1@marina.cinenet.net>:
: ++ Science is not a fair comparison.  Science is (in the ideal sense) about
: ++ the quest for Truth, for the secrets of the world in which we live.  It
: ++ strives toward a culture of openness and sharing.  Perl is a tool used (by
: ++ many -- or most -- of us) in our daily, grubby quest for money.  We happen
: ++ to love it, and enjoy using it, but money drives the process, by and
: ++ large. 
: 
: Then don't come here for free advice on hiding your petty source code.
: That makes you into a selfish person.

Note that I never asked for such advice, nor would I do so; I understand
the consensus ethic of this community well.  I'm merely attempting to
inject a note of realisim into all the high-flown 'morality' rhetoric
being flung wildly about by some zealots.  Providing a balancing
perspective, as it were.

You might notice (Deja me if you need to) that I give away far more than I
get on clpm.  I find it both practically and spiritually worthwhile to do
so.  But that's my decision, and the time I spend answering questions is
time I'm not making money to pay for food and shelter for my family.  I
suppose I'm doing that well enough that I have time to be in the Perl
'free software' community as a hobby of sorts, a desirable way to spend a
few free minutes (or sometimes hours) a day.  But, like most hobbies, it's
a revenue sink, not source. :) 

: ++ In my daily work and play, I use both freeware and proprietary, paid-for
: ++ software.  I find that both have useful roles.  I've yet to find a word
: ++ processor that suits my needs better than Microsoft Word on WinNT; I've
: ++ yet to find a C++ development toolset I like better than Gnu's.  I've seen
: ++ plenty of bad freeware and good payware.  The correlation between quality
: ++ and freeness is slight if it exists, and I'd hesitate to guess on its
: ++ sign.
: 
: The question isn't how much free software do you use, the question is,
: what do you contribute to the free software world? Tom's contribution
: is enormous, only a hand ful of people match his contribution.

My meager contribution is the examples and answers I post on clpm.  My
work *and* one of my hobby projects are proprietary.  Though I'm very
strongly considering GPLing the latter next month, for my own reasons,
sufficient in my own case to convince me that it's best to do so.  My only
point in continuing this argument is to convince its readers that the
choice of free vs. proprietary distribution is not an absolute moral
issue, but a personal, relative one, strongly dependent on circumstances,
personality, intent, and context.

: ++ : I do not wish you luck, because I am morally opposed to the choice you
: ++ : are attempting to make.
: ++ 
: ++ I'll be interested to see the moral system that leads to this extreme a
: ++ position...
: 
: It's called "common sense".

If it were that common, we wouldn't need a name for it. :)

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 25 Aug 1998 01:52:59 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl documentation
Message-Id: <m3lnod8mtw.fsf@windlord.Stanford.EDU>

no unsoliciteds <no.unsoliciteds@dead.end.com> writes:

> I don't know about Tom, but on the past occasions I posted to a NG and I
> DIDN'T munge my addresses I got deluged spam trying to sell me stuff,
> resulting in me having to change email addresses to get away from it and
> whoever else went to look at Deja News to get suckers to mass mail from.

Could you define "deluged" for me?  I'm extremely curious.  I get, on the
average, about 10-20 spam messages a week, which is so far below the event
horizon for the amount of mail that I get that I don't even notice it, and
I'm curious how much of that is due to our local spam blocking and due to
the fact that I'm using a .edu address.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 09:25:35 GMT
From: huntersean@hotmail.com
Subject: Re: Perl documentation
Message-Id: <6rtvue$e7c$1@nnrp1.dejanews.com>

In article <35e4325a.11528910@news.cableol.net>,
  david.hawker@cableol.co.uk wrote:
> On Mon, 24 Aug 1998 02:29:42 -0400, "John Mason Jr" <masonj@erols.com> felt
> the need to post:
>
> >David,
> >  You might find the new version of perl from Activestate useful it has all
> >the docs in one place.
>
> What about the docs for UNIX system calls? All the UNIX functions that
> aren't documented in the perl docs?
>

What about all the other UNIX things that aren't in the perl docs?  After
all, you could call them all inside backticks?	Give us a break.  Pick up a
set of manpages if you want UNIX system call docs.  Pick up a copy of Plauger
and Brodie if you need C standard library documentation.  If you're using
unix, you'll already have manpages.  If you're not, there's no guarrantee
what your system will do when you execute those functions, but you could get
a set of linux or bsd manpages from sunsite.unc.edu or one of its many
mirrors worldwide. Either way, the perl docs are unwieldy enough without
including a load of redundant information.

> --
> dhawker@bigfoot.com | ICQ 7222349
> http://dhawker.home.ml.org
>

Regards
Sean Hunter

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


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

Date: Tue, 25 Aug 1998 11:04:14 +0300
From: Daphna <daphna@exlibris.co.il>
Subject: PERL environment/shell execution?
Message-Id: <35E26FFE.FA1AC2A@exlibris.co.il>

Hi all,

I was wondering if it is possible to run PERL as an "environment"
much like CShell on UNIX.  Can I enter a PERL "session" and from
that point on proceed to enter PERL commands/statements interactively ?

Thanks in advance,

Daphna
Ex Libris.



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

Date: Tue, 25 Aug 1998 17:35:54 +0900
From: no.unsoliciteds@dead.end.com
Subject: Re: Perl FAR version 1.1.1 MAKE SURE YOU READ THIS BEFORE POSTING
Message-Id: <35E2776B.AB2B96F7@dead.end.com>

Honza Pazdziora wrote:

> This is a good question. What do you think: why on earth are they
> coming here now?

Ummm you started well, I mean you actually seemed to consider the question


> The answer in most cases is: to get quick answer. Not to learn
> something, not to talk with others, not to create a comunity a better world.
 
O right, so by being misogenist towards new member to the comunity you create
a sense of belonging? Sort of like the rites of a Frat house? I mean do you
feel close to someone that breates you in public? Do you feel like discussing
anything with them?


> This would be OK with commercial support, but is  a Bad Thing[tm] in the newsgroup.

Trouble is the majority of users of the net want to make web pages, and that
means they want to have cgis and that means they hear about perl, but hey wait
a minute - wasn't this why comp.lang.perl.moderated was set up - to filter out
this kind of element which is severly depreciated? If you walk into water- you
get wet, doesn't matter if you stand still and the water comes to you, you
still get wet. Perl attracts new people because it is used on the web, it is
no longer a purely intellectual pursuit for a select bunch of purists, and
guess what a lot of those new users don't even know how to programme. But this
isn't news , I know this, you know, this the whole NG knows this (except the
ones who haven't read the FAQ). By being abusive to these people you won't
make them go away, because the internet is still expanding, therefor the pool
of potential FAQ  askers, script demanders, read the manuals foe me's, will
keep replenishing itself.  So it seems rather pointless to stand there like
"the Saucerer's Apprentice" chopping away with a hatchet at the broomstcks
carrying the water, and unlike that story nobody will turn up in the near
fututre to put everything back the way it was - perhaps you'd be better served
by dropping the hatchet and learning to swim.


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

Date: 25 Aug 1998 02:14:29 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Perl Style
Message-Id: <m3d89p8lu2.fsf@windlord.Stanford.EDU>

Scott Erickson <Scott.L.Erickson@HealthPartners.com> writes:

> Also, I use the English module in just about every program I write, so
> that I can use English like words for the punctuation variables. I am
> sure some will take issue with that also, but I, for one, tire of
> looking at lines with lots of punctuation chars. Maybe it has to do with
> the fact that I have not programmed much in C, but I consider that
> irrelevant because Perl provides those mechanisms and those mechanisms
> do not, in my mind, detract from the utility of the programs I write.

I'm not exactly taking issue with this, but I submit that as an
experienced Perl programmer, I immediately recognize $? when I see it and
know exactly what it does.  On the other hand, it takes me some time and
some mental processing to figure out what $CHILD_ERROR is.

That's the fundamental problem with use English; it makes your programs
slightly more readable to the newcomer to Perl (but they'll probably still
have to look up the details of the variable) at the cost of making them
less readable for the Perl expert.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 09:58:43 +0100
From: Leon Brocard <leon@netcraft.com>
Subject: Re: PerlBots
Message-Id: <35E27CC3.FFD24548@netcraft.com>

Harry McGreggor wrote:

> Well done on dabot, I've taken a look at your site and I'm very
> impressed!

/me grins...

> It's the first robot I have seen which uses msql to query a database.
> How long did it take you to develop dabot?

mysql, actually. Took about 4 hours of coding. An evening, really.
Most of that was finding interesting things to put in the database,
such as the Jargon File, FOLDOC, and Wordnet.

dabot, when it was an irc bot, also parsed news.com, slashdot.org, 
and freshmeat.net headlines, and so was fairly useful.

dabot, <URL:http://www.astray.com/dabot.cgi> if anyone missed it,
can actually learn too, but I'm not giving out the syntax *just
yet*. Okay, so it's kinda inflexible and doesn't like some english,
but otherwise I'm proud.
 
> I've been toying around with the Eliza module this past week - I'm
> still to produce something 'useful' though :-)

I still can't grok the datafiles it used to produce conversation,
but I haven't worked *too* hard on it.

> Do you read TPJ? There was quiet a good article regarding perl bots in
> the latest issue - I've spoken to the editor and he is going to start
> up an AI column (the editor once stuided AI at MIT, so he's pretty
> happy publishing AI related material)

Yeah, that's where I got my idea from, basically.

> I'm still to find any decent web-sites which contain tutorials/example
> code for perl bots, do you know of any?

No. Wanna start up one? (+ some more searching for related sites).
Have you seen www.botspot.com?

> Is the source code for dabot available? I'm very keen to have a look
> at the source code for your bot, it looks quiet advanced and I
> especially like how you use msql to query a database.

Not yet. But it *could* be...

> Well, nice chatting to you Leon! If I find any good information
> regarding perl bots I'll be sure to pass it onto you.

Hmm. Well, if we get together with the creator of purl, I'm sure
we can get a funky thing going. What kind of use for bots were
you interested in?

obPerl: 
use strict; my($coded, $uncoded); $coded = unpack('b*', unpack('u*',
q|ME,>*44PBD8RT8HD3(\V8(DDD^8R<LB(?Y<C$*9)$$C&;31I1*E*1MFVC2+:M
<6)J(%2/-)DUQ8A2+6!I%2JRX6)$4CQ6C6)&()|)); $uncoded .= 
(qw(10 11 00 01))[length $1] while ($coded =~ s|^(0*)1||);
print pack('b*', $uncoded); # JAPH (clean code!)

Leon.

-- 
Leon Brocard...............................................Perl Hacker
leon@netcraft.com.............................http://www.netcraft.com/

 ... Some people are, through no fault of their own, sane.


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

Date: 25 Aug 1998 08:35:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Prime numbers [was Re: here's an implementation of diff in perl]
Message-Id: <6rtt0p$n4b$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Abigail
<abigail@fnx.com>],
who wrote in article <6rsiti$qj4$2@client3.news.psi.net>:
> Ilya Zakharevich (ilya@math.ohio-state.edu) wrote on MDCCCXIX September
> MCMXCIII in <URL: news:6rseb4$6nr$1@mathserv.mps.ohio-state.edu>:
> ++ 
> ++ Witness the following (which is infinitely faster than Abigail's,
> ++ though prints only one half of the primes)

> Yeah, but mine makes for better .sigs.

The signature below requires a patch to Perl I sent a couple of minutes ago,
otherwise one needs to replace -lwall by -l.

-- 
#! perl -lwall				# -w requires a patch to 5.005
BEGIN{$^H=3<<16;$^H{qr}=sub{$_[1]=~s/([abc])(\d+)/&{$1}/ge;$_[1]}}use 5.005;sub
a{"(?!\\$2)"}sub b{&d.'+)'}sub c{&d.'{2,})'}sub d{"(((?($2)\\$2..|.))"}$_='x';/
^(?=b2a1b4$)(?!b6a5(?!\3$)b8$)(?!c10\9*$)/x&&print length while$_.='xx'


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

Date: 25 Aug 1998 02:41:16 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Question about calling Perl from Perl
Message-Id: <m31zq58klf.fsf@windlord.Stanford.EDU>

Phil Taylor <phil@ackltd.demon.co.uk> writes:

> I want to separate my perl program into separate files and have a single
> controlling program. There seems to be a few different ways of doing
> this that I have read about from books and previous posts for example
> system() or Do().

> I am developing on WIN95 OS but the application will run run for real on
> Solaris, so I'm looking for a portable solution.

In order of rough preference:

  * Figure out how to break your program functionalty into separate
    modules, each in their own namespace, and create modules for your
    program.  See man perlmod.

  * Make the parts of your program Perl libraries and load them with
    require.

  * Just break your program out into multiple files and use do.

system means that the system has to start a shell, find your other part of
your program, and execute it, which is both more overhead and subject to
more potential portability problems.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Tue, 25 Aug 1998 09:49:02 GMT
From: paddy.spencer@parallax.co.uk (Paddy Spencer)
Subject: Re: Referancing and dereferancing
Message-Id: <904038542.703441@red.parallax.co.uk>

Kello Wed, 12 Aug 1998 21:34:30 +0800, "Doug Paice"
<dougp@global.net.au> kirjoittanut:

: $var = \%hash1;
: ...
: foreach $key, keys($var) {...} # fails

I did this just the other week :-)

Your mistake is:

%hash is a hash
$var is a reference to a hash BUT is not a hash itself
%$var is the underlying hash.

so keys(%hash), keys(%$var) will both work but keys($var) won't.





-- 
Paddy Spencer        
Parallax Solutions Ltd (http://www.parallax.co.uk/)



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

Date: Tue, 25 Aug 1998 11:07:43 +0300
From: Daphna <daphna@exlibris.co.il>
Subject: Setting DOS environment from PERL scripts
Message-Id: <35E270CF.9F7EE075@exlibris.co.il>

Hi all,

I have been trying unsuccessfully to change environment
variables of a DOS window using PERL scripts.
When the PERL scripts terminate, the environment variables
return to their previous values (the values they had when the
father process ran the script).

My question -
Can I set these variables to new values which will be
saved when I leave the script?
Or -
Can I run the PERL script in the same "process" -
so that a new environment is not opened for it ?

Clarification -
I do not wish to work through the registry.

Thanks in advance,

Daphna
Ex Libris.




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

Date: 25 Aug 1998 08:04:51 GMT
From: mroberds@worldnet.att.net (Matt Roberds)
Subject: Switching user id's in mid stream
Message-Id: <6rtr73$qg3@bgtnsc02.worldnet.att.net>
Keywords: setuid user id change system pipe tty

Hello all!

I am expanding on a Perl script I wrote for work.  Background:  We 
sell large equipment that has a Unix box as part of the control 
system.  Whenever we start working on a new piece of equipment, 
there are several "standard" program files, databases, and scripts 
that have to be copied to various places on the new Unix machine.  
Also, while it is in the plant, it is plugged into the plant's NIS 
server, so everybody can use their "own" logins -- the same ones
they use on the development machines that always stay in the plant.
When the machine is shipped, the files are chown'd to "generic"
user id's for ease of maintenance on site.

OK.  So far I have a Perl script that does most of what I want it
to do as far as copying files.  The user who is going to work on
a particular piece of equipment runs the script when they start 
the job, so the files it copies end up being owned by that user
(the Perl script is not setuid.)  For most of the files, that's 
not a problem.  However, some of the files need to start out
being owned by the "generic" user ID (which we know ahead of time).

I have tried various things to make this happen.  Basically what
I want to do is start the script normally, then when the user
wants to copy these special files, "switch" to the generic user
ID.  I have tried opening a pipe to an "rlogin" that comes back
to the same machine with the generic user ID.  This starts to
work, but breaks whenever rlogin asks for the password.  It
seems like rlogin is smart enough to go back and get the controlling
terminal of the Perl interpreter, and send its "password:" prompt
to that.  Perl never sees it and it comes back to the terminal
of the user who started the Perl script.  I am fairly sure from
tests I have made that rlogin is not just writing to standard error
(which I am then failing to capture) but I could be wrong about that.
If I could get the rlogin to work, I would then copy the files to
their final destination (so they would be owned by the generic
user) and then close the rlogin session.

I know this could probably be implemented with a setuid Perl script,
but for many reasons I'd prefer to avoid this if at all possible.
I hope this isn't too obvious of a question; I have written several
text-mangling-type Perl scripts before but I haven't worked much with
the system-interaction features.  Any advice or comments would be
appreciated.  Thanks!

Matt Roberds
mroberds@worldnet.att.net
Tulsa, Oklahoma     USA



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

Date: Tue, 25 Aug 1998 16:57:20 +0800
From: 8\(F&@ <versace@gianni.com>
Subject: Where to find Net::Domain?
Message-Id: <35E27C70.2CF@gianni.com>

Tried CPAN but no luck.  Help Please!


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

Date: Tue, 25 Aug 1998 09:57:46 GMT
From: richardc@tw2.com (Richard Clamp)
Subject: Re: Why dont people read the FAQs
Message-Id: <35e1d4a2.2795137@192.168.2.1>

On Mon, 24 Aug 1998 11:29:23 -0500, fl_aggie@thepentagon.com (I R A
Aggie) wrote:

>What's wrong with comp.infosystems.www.authoring.cgi?

Probably the name/hierachy it's under.

If only we could symlink newsgroups. Hmmmn

Richard

-- 
Richard Clamp         richardc@tw2.com
Frisbeetarianism, n.:
        The belief that when you die, your soul goes up on the roof and gets stuck


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

Date: Tue, 25 Aug 1998 08:57:32 GMT
From: dave@mag-sol.com
Subject: Re: Y2K Date Support
Message-Id: <6rtu9s$cci$1@nnrp1.dejanews.com>

It only goes to 1999 because there is a bug in your program. Reread the docs
for localtime and see if you can spot it.

Dave...

In article <35E21BF4.6B46@arrowweb.com>,
  mhanson@arrowweb.com wrote:
> How do you get the date and allow it to support the Year 2000? I have
> been using the following code but it only goes to 1999.
>
> @days =
> ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
> @months =
>
('January','February','March','April','May','June','July','August','September','
October','November','December');
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> if ($hour < 10) { $hour = "0$hour"; }
> if ($min < 10) { $min = "0$min"; }
> if ($sec < 10) { $sec = "0$sec"; }
> $date = "$days[$wday], $months[$mon] $mday, 19$year at
> $hour\:$min\:$sec";
>


--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

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


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

Date: 25 Aug 1998 02:17:10 -0600
From: Wade Holst <wade@cs.ualberta.ca>
Subject: Re: Yes, someone else in need of PERL help
Message-Id: <r7d89pjx15.fsf@rimbey.cs.ualberta.ca>

GREGORY GILLELAND <gregory@bit.csc.lsu.edu> writes:

> Ok, 
> I would have thought this very easy but it isn't working out that way.
> I want to perform the following task using PERL:
> 
> --open up a predefined file, read in the 3rd line, close the file.
> --check that string to another predefined string
> --if the strings ARE equal then <do something... (i can do this)>
> 
> Everything is properly working. No server errors. I got the file to open
> and close, I have read in the predefined string from a FORM (and tested it
> by printing to file), but I cant get the reading of the third line to work
> or subsequently the string comparison. If you need more info, please
> email.
> Thanks in Advance,
> Gregory Gilleland

Hmmm.  Without seeing the code you are testing, it is difficult to 
guess at the problem.   Here is my crack at it (although your particular 
setup may make this invalid)

#!/usr/local/bin/perl5 -w--                    -*-Perl-*-  

use strict;
use FileHandle;

my $file = 'blah';
my $predefString = 'some predefined string';

my $fp = FileHandle->new();
$fp->open("<$file") || die("Failed to open '$file' for reading");

if ( <$fp> && <$fp> && ($_ = <$fp>) && chomp() && ( $_ eq $predefString ) ) {
    # Do something
    print "Hello\n";
}
$fp->close();

exit 0;

-- 
Wade Holst                       |------------------------------------------| 
wade@cs.ualberta.ca              | (setq Happiness '( "emacs" . "perl5" ) ) |
http://www.cs.ualberta.ca/~wade  |   @Happiness = ( "emacs" . "perl5" );    |
University of Alberta            |------------------------------------------|


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

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 3533
**************************************

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