[9281] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2876 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 15 15:17:12 1998

Date: Mon, 15 Jun 98 12:00:35 -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, 15 Jun 1998     Volume: 8 Number: 2876

Today's topics:
    Re: $a: numeric or NOT ? (Jack Ostroff)
    Re: access to a hash of lists (Tom Grydeland)
    Re: access to a hash of lists <bowlin@sirius.com>
    Re: Array trouble - severe newbie (Steve Linberg)
    Re: Certified Webmasters <romeyde@mc0115.mcclellan.af.mil>
    Re: Certified Webmasters (Chris Nandor)
    Re: CFV: comp.lang.perl.moderated moderated (Chip Salzenberg)
        CGI Perl Programming Problem. emery@wizweb.com
    Re: CGI Perl Programming Problem. (Bob Trieger)
        Curly braces in if elsif contructs <ask@netcetera.dk>
    Re: Curly braces in if elsif contructs (Bob Trieger)
    Re: Curly braces in if elsif contructs <bowlin@sirius.com>
        Forking, SIG handlers, etc. (Long) <gabriele@kollwitz.doit.wisc.edu>
    Re: ibm aix rs 6000 & Perl <jdporter@min.net>
    Re: Installing perl modules as a non sysadmin <barnett@houston.Geco-Prakla.slb.com>
    Re: Is this WEB-BASED mail script good? <mlx@total.net>
    Re: MODERATION: Time to Vote (Chip Salzenberg)
    Re: New module/pragma "enum.pm" (was "fields.pm") (M.J.T. Guy)
    Re: New module/pragma "enum.pm" (was "fields.pm") (Brendan O'Dea)
        Problems using GWPOP on a SUN system (SunOS 5.5.1) <a.suozzi@carpi.nettuno.it>
    Re: REVIEW: Perl CGI Programming - No Experience Requir <jdporter@min.net>
    Re: REVIEW: Perl CGI Programming - No Experience Requir <jdporter@min.net>
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Paul David Fardy)
        Script Help? lefkogt.xp@usafa.af.mil
    Re: Script Help? (Bob Trieger)
        Sending mail, can I set the $from ? (Christopher Soeffing)
    Re: Sending mail, can I set the $from ? (Bob Trieger)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 15 Jun 1998 17:37:52 GMT
From: ostroj@gsun150.pfizer.com (Jack Ostroff)
To: "Michael D. Schleif" <mike.schleif@aquila.com>
Subject: Re: $a: numeric or NOT ?
Message-Id: <6m3m5g$1324@mascagni.pfizer.com>

[posted and emailed]

> I will check out more recent versions of perldata.pod; but, if:
> 
>	if ($str == 0 && $str ne "0")  {
>	        warn "That doesn't look like a number";
>	}
>
> really should work, why NOT on my systems?  If it no longer works, but
> once did, what broke?  Nevertheless, if it does NOT work, it ought not
> be in perldata.pod.

"0.0" is not "eq" to 0, but it is "="


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

Date: 15 Jun 1998 16:27:07 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: access to a hash of lists
Message-Id: <slrn6oaiqr.1q4.Tom.Grydeland@mitra.phys.uit.no>

On Sun, 14 Jun 1998 19:47:16 -0600,
John Cartwright <jcartwright@wans.net> wrote:

> That's cool!  I have never used of the map function before, but it seems
> to be exactly what I was looking for.  Would it be possible to combine the
> two following lines, for instance if I wanted the max value from all the
> arrays in the hash:

> @b = sort (map { $$_[0] } values %HoL);
> $max = @b[-1];

You don't *sort* a list to get the maximum value!

Sorting is O(n log n), max is O(n).


> $max = @{sort (map { $$_[0] } values %HoL)}[-1];

# The maximum of the first value from all arrays
$max = max map { $$_[0] } values %HoL;

# A list of the maximum values of each array
@maxvals = map { max @$_ } values %HoL;

where the implementation of max is left as an exercise :-)


> --john

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>
      - Do radioactive cats have 18 half-lives? -


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

Date: Mon, 15 Jun 1998 10:06:59 -0700
From: Jim Bowlin <bowlin@sirius.com>
Subject: Re: access to a hash of lists
Message-Id: <358554B3.2960E9E1@sirius.com>

Tom Grydeland wrote:
> 
> On Sun, 14 Jun 1998 19:47:16 -0600,
> John Cartwright <jcartwright@wans.net> wrote:
> 
> > That's cool!  I have never used of the map function before, but it seems
> > to be exactly what I was looking for.  Would it be possible to combine the
> > two following lines, for instance if I wanted the max value from all the
> > arrays in the hash:
> 
> > @b = sort (map { $$_[0] } values %HoL);
> > $max = @b[-1];
> 
> You don't *sort* a list to get the maximum value!

This sounds a bit harsh to me.  My answer would instead be:

Yes, you can do that to get the max value.  But for long lists it is
not as efficient as writing a little subroutine to find the max value
since sort requires O(N log N) comparisons while the following routine
requires only N comparisons.

sub max {
   my $max = shift;
   for (@_) { $_ > $max and $max = $_ }
   $max;
}
print max (6, 10, 9, 3, 7);


HTH -- Jim Bowlin


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

Date: Mon, 15 Jun 1998 14:47:20 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Array trouble - severe newbie
Message-Id: <linberg-1506981447200001@projdirc.literacy.upenn.edu>

In article <6lvubu$1k0$1@nnrp1.dejanews.com>, nheagy@my-dejanews.com wrote:

> The PERL documentation is too
> hard for me to understand.

Putting this as kindly as I can: if the documentation is too hard for you
to understand, what makes you think Perl itself will be any easier?

If you can't understand the ample free documentation, you probably
shouldn't be trying to program Perl.  Try reading it again, or pick up a
beginner's book like "Learning Perl."  It can be done.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Mon, 15 Jun 1998 18:20:30 +0000
From: Derek Romeyn <romeyde@mc0115.mcclellan.af.mil>
Subject: Re: Certified Webmasters
Message-Id: <358565ED.12649FA3@mc0115.mcclellan.af.mil>

In order to receive membership in the association, every person MUST: 
     NOT have a criminal record....


Does that mean Randall can't get certified?  Seems like a kind of silly
requirement.  Aren't there all kinds of little things that can give a
person a criminal record?

> I am a Certified Web Master. The organization is a reputable group determined to promote
> professionalism among it's members. The Association's web site is at
> <http://www.fog.nf.net/acwm/>. This certification was an important factor in getting the
> job that I have, and the salary I enjoy.

-- 
Derek W Romeyn romeyde@calweb.com

I wish I could say everything there was to say in one word.  I hate 
all the things that can happen between the beginning of a sentence 
and the end.  -- Leonard Cohen, The Favourite Game


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

Date: Mon, 15 Jun 1998 18:51:40 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Certified Webmasters
Message-Id: <pudge-1506981448550001@dynamic404.ply.adelphia.net>

In article <358565ED.12649FA3@mc0115.mcclellan.af.mil>, Derek Romeyn
<romeyde@mc0115.mcclellan.af.mil> wrote:

# In order to receive membership in the association, every person MUST: 
#      NOT have a criminal record....
# 
# 
# Does that mean Randall can't get certified?  Seems like a kind of silly
# requirement.  Aren't there all kinds of little things that can give a
# person a criminal record?

Not only that, Randal also does not meet the second criterion.  And
neither do I:

# have at least one certificate or degree (related to computer programming), 
#   from a post secondary education institution 

Of course, a "post secondary education institution" is a completely
irrelevant title.  I can declare myself a "post secondary education
institution" and give myself a degree.  I can make myself an accrediting
agency and accredit my institution.  And it is every bit as worthless as
the certification is, but it is still falls into their criteria as valid,
of course.

That's OK, I would never work at a place that would require such a
certification for anything, be it employment or increased salary.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Mon, 15 Jun 1998 18:40:18 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: CFV: comp.lang.perl.moderated moderated
Message-Id: <6m3ptf$h8o$1@cyprus.atlantic.net>

According to stanley@skyking.OCE.ORST.EDU (John Stanley):
>In article <6m22sp$g55$1@cyprus.atlantic.net>,
>Chip Salzenberg <chip@mail.atlantic.net> wrote:
>>Not all netiquette rules are created equal.  
>
>They are, however, all "netiquette rules".

So is anything anyone ever thought would be a good idea on Usenet.
Your point is vacuous.

>>But I must wonder why you now consider putative inexperience as
>>newsworthy.  Do you mean to imply more than you are willing to say?
>
>It was "newsworthy" enough to include as moderation criteria.

Experience is a continuum.  Where you place a mark is not relevant to
the question of where the proposers and other voters place it.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: Mon, 15 Jun 1998 17:45:41 GMT
From: emery@wizweb.com
Subject: CGI Perl Programming Problem.
Message-Id: <6m3mk5$v1r$1@nnrp1.dejanews.com>

I wrote this particular Perl program that is available to be used on
the Internet. Usually there is not a problem to put up a submit form
for querying by Perl.  In this case, however, there is a series of
steps to follow through and information needs to get to one form to
the next. I thought it may have been satisfactory to put the needed
info into the form by hidden types. Only the problem is that if
someone else at the same time is using the site the two users infos
will get mixed (the values in the form will change).

I could put the info into a file and name it by the value of the
$ENV{'REMOTE_ADDR'} gives. This will keep the clients info seperate.
Which is quite satisfactory a solution.

The problem that remains now is - Not knowing if the user has left
the site. When a client returns to the site and runs the form all of
the previous used info will show. If I knew when the client has left
I could unlink the file.

Could you give me some suggestions. Is there and environment variable
that would tell me the history of the client (last location)? This
might help.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 15 Jun 1998 18:12:43 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: CGI Perl Programming Problem.
Message-Id: <6m3oa3$c2c$1@ligarius.ultra.net>

[ posted and mailed ]
emery@wizweb.com wrote:
-> I wrote this particular Perl program that is available to be used on
-> the Internet. Usually there is not a problem to put up a submit form
-> for querying by Perl.  In this case, however, there is a series of
-> steps to follow through and information needs to get to one form to
-> the next. I thought it may have been satisfactory to put the needed
-> info into the form by hidden types. Only the problem is that if
-> someone else at the same time is using the site the two users infos
-> will get mixed (the values in the form will change).

>>  Snipples <<

-> Could you give me some suggestions. Is there and environment variable
-> that would tell me the history of the client (last location)? This
-> might help.

You are asking this in the wrong newsgroup. You will get much more help in 

news:comp.infosystems.www.authoring.cgi

The simple answer is cookies.

HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: 15 Jun 1998 20:16:28 +0200
From: Ask Bjoern Hansen <ask@netcetera.dk>
Subject: Curly braces in if elsif contructs
Message-Id: <m3k96icyyr.fsf@balder.netcetera.dk>

Hi everybody,

I've just had a discussion with one of my colleagues about the ending
curly braces in if, elsif, else constructs.

I'm always writing simple if, elsif, else things like:

if ($gnuffelig eq "1" ) {
	print "test";
	my $tblasd = "232";
} elsif ($testset eq "esfs") {
 	print "lbsd!";
} else {
	print "fum!";
}
if (defined($gnyuffe)) {
	print $test;
} else {
	print $blaest;
}

He claims that this is better written as 

if ($gnuffelig eq "1" ) {
	print "test";
	my $tblasd = "232";
} 
elsif ($testset eq "esfs") {
 	print "lbsd!";
} 
else {
	print "fum!";
}

if (defined($gnyuffe)) {
	print $test;
}
else {
	print $blaest;
}

which I think is a ridiculous waste of space and doesn't give any
better readability.

What do you think?


kind regards,

ask


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

Date: Mon, 15 Jun 1998 18:27:15 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Curly braces in if elsif contructs
Message-Id: <6m3p5m$c2c$3@ligarius.ultra.net>

[ posted and mailed ]

Ask Bjoern Hansen <ask@netcetera.dk> wrote:
-> Hi everybody,
-> 
-> I've just had a discussion with one of my colleagues about the ending
-> curly braces in if, elsif, else constructs.
-> 
-> I'm always writing simple if, elsif, else things like:

-> if (defined($gnyuffe)) {
->         print $test;
-> } else {
->         print $blaest;
-> }
-> 
-> He claims that this is better written as 
-> 
-> if (defined($gnyuffe)) {
->         print $test;
-> }
-> else {
->         print $blaest;
-> }
-> 

Not that it really matters in the scheme of things but I'm with you. I just 
checked out perlstyle and didn't see the closing curly mentioned.

The Gecko and Llama books use our style while the Camel book uses your 
friends.

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: Mon, 15 Jun 1998 11:39:03 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Ask Bjoern Hansen <ask@netcetera.dk>
Subject: Re: Curly braces in if elsif contructs
Message-Id: <35856A47.4F54BD32@sirius.com>

Ask Bjoern Hansen wrote:
> 
> Hi everybody,
> 
> I've just had a discussion with one of my colleagues about the ending
> curly braces in if, elsif, else constructs.
> 
> I'm always writing simple if, elsif, else things like:
> 
> if ($gnuffelig eq "1" ) {
>         print "test";
>         my $tblasd = "232";
> } elsif ($testset eq "esfs") {
>         print "lbsd!";
> } else {
>         print "fum!";
> }

> He claims that this is better written as
> 
> if ($gnuffelig eq "1" ) {
>         print "test";
>         my $tblasd = "232";
> }
> elsif ($testset eq "esfs") {
>         print "lbsd!";
> }
> else {
>         print "fum!";
> }
> 

> which I think is a ridiculous waste of space and doesn't give any
> better readability.

I totally agree with your friend.  So does Larry, who says

   o Put a newline between a closing brace and 'else'.
                                             -- Camel p. 547
and,

   o Put blank lines between chunks of code that do different things.

You are able to maintain readability your way, only by using
an 8 column indent.  If you go down to a 4 column indent,
your friend's method is better IMHO.  The 4 column indent if very
useful if you want to keep your code under 80 columns, which
may seem old-fashioned but has sure made things easier for me.

TIMTOOTDI -- Jim Bowlin


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

Date: Mon, 15 Jun 1998 12:34:12 -0500
From: "Gabriele R. Fariello" <gabriele@kollwitz.doit.wisc.edu>
Subject: Forking, SIG handlers, etc. (Long)
Message-Id: <Pine.LNX.3.96.980615113835.6527B-100000@kollwitz.doit.wisc.edu>


I may very well end up showing far more ignorance than anything else in
this post, but I am stumped and would like to know what is going on. At
the bottom of this post I have included the code in question and some
sample output. Basically, I was trying to set up some code that would fork
children (that would then "do their own thing") and continue doing
something else. I wanted to rely on the SIGCHLD handler let me know when 
a child had finished and the I had to then to reap the now zombied child
and read its output. 

Alas, it seems that some SIGs get lost. This does not happen all the time,
but most of the time with the code below at least one SIGCHLD is missed
by the code. I know that the child has finished _before_ I give up
waiting because it shows up as a zombie with ps. My question is why
this is and is there something I can do about it?

I am guessing that the problem happens when the SIGs are too close
together and the parent is unable to process them, but because this
routine may not be "re-entrant" -- I don't really know what that means --
or something else like that there may be more to the story.

The PerlIPC man page (man perlipc) states that one shoudl do as little as
possible in a signal handler, but I do not know if I have overstepped the
bounds here.

Also I do not understand the examples in perlipc stating that some people
may run into problems with systems that behave in the bad "SysV" way. The
examples perplex me as opposed to enlighten me, so I may be doing
something wrong there as well. The POSIX module is more or less
incomprehensible to me, and so far I have not understood how the perlfaq8
might help me on this one, though I skimmed looking for "sig" so I might
have missed it.

I have tried re-declaring the $SIG{'SIGCHLD'} handler in the handler
routine itself, but I got identical results.

Basically I need help.

My apologies if this is an RTFM question, but I cannot seem to find which
FM to read, so RTFM responses with information about the FM are
appreciated.

-Gabriele

===SAMPLE CODE FOLLOWS===
#!/usr/local/bin/perl

use strict;
use FileHandle;

$SIG{'CHLD'} = \&read_child;

$| = 1; # Unbuffer output.

my %children = (); # Create hash where we store child info
my $max_children = 5; # Set a limit on how many children to create

my($i); # define a variable.

print "$$: Parent creating children\n"; # Tell us what you are doing

for ($i = 1; $i < ($max_children + 1); $i++)
  {
  my ($pid, $filehandle) = fork_child($i);
  $children{$pid} = $filehandle;
  }

print "$$: Parent done creating children now waiting.\n";

for ($i = 1; $i < 10; $i++)
  {
  print "$$: Waiting: ".($i*5)."\n";
  last unless (keys %children) + 0;
  sleep 5;
  }

print "$$: Gave up waiting.\n" if (keys %children) + 0;

my $pid;

while(defined($pid = wait()) && ($pid != -1))
  {
  print "$$: Child '$pid' SIGCHLD was MISSED!.\n";
  my $fh = $children{$pid};
  while (<$fh>)
    {
    print "$$: Got \"$_\" from child $pid\n";
    }
  }

print "$$: Parent exiting.\n";

exit;

sub read_child
  {
  my $pid;
  print "$$: SIGCHLD Caught.\n";
  $pid = wait();
  die "No childern!\n" if $pid == -1;
  print "$$: Child '$pid' passed away.\n";
  my $fh = $children{$pid};
  while (<$fh>)
    {
    print "$$: Got \"$_\" from child $pid\n";
    }
  delete $children{$pid};
  }


sub fork_child
  {
  my($arg) = @_;
  my $fh = new FileHandle;
  print "$$: Forking child $arg!\n";
  my $pid = $fh->open("-|"); # Does an implicit fork
 
  if (! defined $pid)
    {
    die "Couldn't fork: $!";
    }
  elsif ($pid == 0) # Child process
    {
    warn "$$: (warn) In child got '$arg'.\n";   
    sleep (int(rand(5)) + 6);
    print "$$: Hello, I got '$arg'.";   
    exit;
    }
  return ($pid, $fh);
  }

===END SAMPLE CODE===

===SAMPLE OUTPUT FOLLOWS===
6646: Parent creating children
6646: Forking child 1!
6646: Forking child 2!
6646: Forking child 3!
6647: (warn) In child got '1'.
6646: Forking child 4!
6648: (warn) In child got '2'.
6649: (warn) In child got '3'.
6646: Forking child 5!
6646: Parent done creating children now waiting.
6650: (warn) In child got '4'.
6646: Waiting: 5
6651: (warn) In child got '5'.
6646: Waiting: 10
6646: SIGCHLD Caught.
6646: Child '6651' passed away.
6646: Got "6651: Hello, I got '5'." from child 6651
6646: Waiting: 15
6646: SIGCHLD Caught.
6646: Child '6647' passed away.
6646: Got "6647: Hello, I got '1'." from child 6647
6646: Waiting: 20
6646: SIGCHLD Caught.
6646: Child '6650' passed away.
6646: Got "6650: Hello, I got '4'." from child 6650
6646: Waiting: 25
6646: SIGCHLD Caught.
6646: Child '6649' passed away.
6646: Got "6649: Hello, I got '3'." from child 6649
6646: Waiting: 30
6646: Waiting: 35
6646: Waiting: 40
6646: Waiting: 45
6646: Gave up waiting.
6646: Child '6648' SIGCHLD was MISSED!.
6646: Got "6648: Hello, I got '2'." from child 6648
6646: Parent exiting.
===END SAMPLE OUTPUT===



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

Date: Mon, 15 Jun 1998 17:09:23 GMT
From: John Porter <jdporter@min.net>
Subject: Re: ibm aix rs 6000 & Perl
Message-Id: <35855713.6BE1@min.net>

Tad McClellan wrote:
> 
> ELSS Admin (elssa09@callisto.si.usherb.ca) wrote:
> : I was told I could program my own system messages,
> 
>    *Some* people can program their own system messages.
>    I think you have to hack at the kernel for that though...

Actually, isn't that one of the uses of the locale?
In "modern" unices, locales are defined externally to the kernel.

John Porter


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

Date: Mon, 15 Jun 1998 13:13:53 -0500
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Installing perl modules as a non sysadmin
Message-Id: <35856461.6419635@houston.Geco-Prakla.slb.com>

Christoph Berendes wrote:
> 
> To run the w3mir spider, I've been trying to install the MIME and libwww
> modules but can't get the libwww module to see the MIME module.
> I'm not the sysadmin, so am stuck with an already installed perl 5.003
> So I'm trying to install MIME-Base64-2.05 and libwww-perl-5.10
> I start with MIME, since libwww needs that:
>         Makefile.PL PREFIX=/homeb/berendes/pl
>         make test
> work fine
> and
>         make install
> works once I create the necessary subdirectories by hand to allow creation
> of
>  /homeb/berendes/pl/lib/perl5/sun4-sunos/5.003/perllocal.pod
>  (So I've run make install twice)
> but then I can not get the libwww process to find the Mime module for love
> or money:
<snip>
Have a look at perldoc perlfaq8, specifically the section:
How do I keep my own module/library directory?

Become familiar with the PERL5LIB variable as well.  It might come in
handy.

Cheers,
Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

----------------------------------------------------------------------
Dave Barnett                 U.S.: barnett@houston.Geco-Prakla.slb.com
DAPD Software Support Eng    U.K.: barnett@gatwick.Geco-Prakla.slb.com
----------------------------------------------------------------------


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

Date: Mon, 15 Jun 1998 14:07:10 -0400
From: Marc Lamoureux <mlx@total.net>
Subject: Re: Is this WEB-BASED mail script good?
Message-Id: <358562CE.8EAE5542@total.net>

What only 80$/hour... what kind of cheap laber are you ?!

Aaron Baugher wrote:

> "David A. Lyons" <lyonsd@atl.hp.com> writes:
>
> > Ala Qumsieh wrote:
> > >
> > > Paul van der Pan wrote:
> > >
> > > > I found this perl cgi-script for Web based email
> > > > (should work on Linux) on the net,
> > > > can somebody tell me if there are big security holes
> > > > in this script?
> > > >
> > >
> > >  I will ... if you pay me $100/hr ;-)
> >
> > Paul, don't let this guy rip you off!  I'll do it for $90/hr!  ;^)
>
> Bob, I'll say $80/hr!  [applause, applause]
>
> --
> Aaron Baugher
> Extreme Systems Consulting
> CGI, Perl, Java, and Unix Administration
> http://haruchai.rnet.com/esc/





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

Date: Mon, 15 Jun 1998 18:37:57 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: MODERATION: Time to Vote
Message-Id: <6m3pp0$h84$1@cyprus.atlantic.net>

According to stanley@skyking.OCE.ORST.EDU (John Stanley):
>In article <6m231p$g5r$1@cyprus.atlantic.net>,
>Chip Salzenberg <chip@mail.atlantic.net> wrote:
>>Can you say, "opportunity cost"?
>
>Sure. Or do you mean to imply more than you are willing to say? Maybe
>"it's a GOOD thing to let other people tell you what your opinions should
>be"?

Hardly.  And putting words in my mouth is not the mark of an able
and honest debater.  But I digress.

The concept of 'opportunity cost' leads only to the conclusion that it
is not intrinsically bad to leave evaluation of unimportant issues to
appropriately trusted sources.

Your arguments are relatively unimportant -- but don't take that
personally, as most of Usenet is also relatively unimportant -- so
leaving evaluation of your arguments to appropriately trusted sources
(trusted by individuals, at their choosing) is not bad.  It's a
tradeoff, based on the relative availability of time on any given
day/week/etc.
-- 
Chip Salzenberg                - a.k.a. -               <chip@pobox.com>
"I brought the atom bomb.  I think it's a good time to use it."  //MST3K
           ->  Ask me about Perl training and consulting  <-
     Like Perl?  Want to help out?  The Perl Institute: www.perl.org


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

Date: 15 Jun 1998 17:38:30 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <6m3m6m$8b1$1@pegasus.csx.cam.ac.uk>

Martin Schwartz  <schwartz@cs.tu-berlin.de> wrote:
>
>A little bit faster runs:
>
>sub is_power_of_2 {
>   !($_[0] & ($_[0]-1));
>}

Depending on whether you regard 0 as a power of 2 or not, you may want
to make that

    $_[0] && !($_[0] & ($_[0]-1));


Mike Guy


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

Date: 16 Jun 1998 03:38:23 +1000
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <6m3m6f$ns4$1@duende.compusol.com.au>

In article <897871737.535143@thrush.omix.com>,
Zenin  <zenin@bawdycaste.org> wrote:
>Brendan O'Dea <bod@compusol.com.au> wrote:
[snip]
>: Really?  K&R says:
>:
>:   ``Enumerations provide a convenient way to associate constant values
>:     with names, an alternative to #define ...''
>: and provides examples including:
>:     enum escapes { BELL = '\a', BACKSPACE = '\b', TAB = '\t',
>: 	NEWLINE = '\n', VTAB = '\v', RETURN = '\r' };
>
>	Blgh...ok...  Well, this wouldn't be the first time I've disagreed
>	with K&R and won't be the last. :-)
>
>	This is a little different however, then what enum.pm can offer.
>	C enum can have a name, where this really isn't possible or useful
>	in Perl.  There wouldn't be an "escapes" name used in Perl as the
>	language doesn't have any ability to do type checking with it.

It seems unlikely that in this case any variable of type `enum escapes'
would be declared--`escapes' is only there since the C language requires
it (C++ permits anonymous enumerations).

>: This is also a common idiom in C++ (these examples are taken from
>: include files in the standard library):
>:     enum {ALIGN = 8};
>:     enum {MAX_BYTES = 128};
>:     enum {NFREELISTS = MAX_BYTES/ALIGN};
>
>	Hmm...but why?  It's very non-intuitive in my book.  If you want
>	a single constant one should use a sigle constant.

And in mine for that matter.  While I personally agree that this doesn't
really buy much over:

    int const ALIGN = 8;

etc., I included these to show an idiom which is in common use.

>:     enum {
>: 	skipws   = 01,
>: 	left     = 02,
>: 	right    = 04,
>: 	/* ... */
>:     };
>
>	Blagh, same thing.  The constant module should have this support,
>	not an enum module.

Not quite the same--in this case I think that there can be a documentary
advantage in grouping a set of related names together.

[snip]
>	Hmm, what about a constants.pm (extra 's') module that works like this?

It's really not that important.

My point is simply that if you create a module called `enum' then it is
highly likely that people will use it as they do the C/C++ equivalent.

Regards,
-- 
Brendan O'Dea                                        bod@compusol.com.au
Compusol Pty. Limited                  (NSW, Australia)  +61 2 9809 0133


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

Date: Mon, 15 Jun 1998 19:06:07 +0200
From: Andrea Suozzi <a.suozzi@carpi.nettuno.it>
Subject: Problems using GWPOP on a SUN system (SunOS 5.5.1)
Message-Id: <3585547F.43B34015@carpi.nettuno.it>


--------------A25314E5623F8FE9E3BCE81B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I used  perl written GWPOP on a Linux  system to read mail on a  remote
server  and it works without problems.

When I try  to use  it  on a Sun machine  (SunOS 5.5.1)  I always get
the messages :

********************

Cannot open POP port to "my mail host": Protocol not supported
Cannot open POP port to "my mail host": Protocol not supported
Cannot open POP port to "my mail host": Protocol not supported
Cannot open POP port to "my mail host": Protocol not supported
Cannot open POP port to  "my mail host" after 4 trials: Interrupted
system call
Quitting; the server said: ""

********************

It isn't able to open the port on the localhost  as needed in the gwpop
perl code :

********************
 $closed = 0;
   undef $trials;
   undef $connected;
   sleep 1; # It seems we cannot always connect right now?
   while ((! $connected) && $trials < 4) {

      $handle = &chat'open_port ($localhost, $local_port);
<--------------

      if (! $handle) {
    &info ("Cannot open POP port to $mailhost: $!");
    sleep 3; # It seems we cannot always connect right now?
    $trials++;
      }
      else {
          $connected = 1;
      }
   }
   if (! $connected) {
    &warning ("Cannot open POP port to $mailhost after $trials trials:
$!");
    return;
   }

********************

Does anyone know  why ?????


                Bye and thanks  !!
                                                                Andrea

--
                         ~~~~~
                        (o)-(o)
                          (_)
------------------o00o--- \_/ ---o00o-----------------
|                Andrea         Suozzi               |
| e-mail     : a.suozzi@carpi.nettuno.it             |
| snail-mail : Via Manzoni 63 Carpi (MO) 41012 Italy |
| phone      : +39 59 680019                         |
------------------------------------------------------



--------------A25314E5623F8FE9E3BCE81B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>


<P>I used&nbsp; perl written GWPOP on a Linux&nbsp; system to read mail
on a&nbsp; remote server&nbsp; and it works without problems.

<P>When I try&nbsp; to use&nbsp; it&nbsp; on a Sun machine&nbsp; (SunOS
5.5.1)&nbsp; I always get&nbsp; the messages :

<P>********************

<P>Cannot open POP port to "my mail host": Protocol not supported
<BR>Cannot open POP port to "my mail host": Protocol not supported
<BR>Cannot open POP port to "my mail host": Protocol not supported
<BR>Cannot open POP port to "my mail host": Protocol not supported
<BR>Cannot open POP port to&nbsp; "my mail host" after 4 trials: Interrupted
system call
<BR>Quitting; the server said: ""

<P>********************

<P>It isn't able to open the port on the localhost&nbsp; as needed in the
gwpop perl code :

<P>********************
<BR>&nbsp;$closed = 0;
<BR>&nbsp;&nbsp; undef $trials;
<BR>&nbsp;&nbsp; undef $connected;
<BR>&nbsp;&nbsp; sleep 1; # It seems we cannot always connect right now?
<BR>&nbsp;&nbsp; while ((! $connected) &amp;&amp; $trials &lt; 4) {

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $handle = &amp;chat'open_port ($localhost,
$local_port);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;--------------

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (! $handle) {
<BR>&nbsp;&nbsp;&nbsp; &amp;info ("Cannot open POP port to $mailhost: $!");
<BR>&nbsp;&nbsp;&nbsp; sleep 3; # It seems we cannot always connect right
now?
<BR>&nbsp;&nbsp;&nbsp; $trials++;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $connected =
1;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<BR>&nbsp;&nbsp; }
<BR>&nbsp;&nbsp; if (! $connected) {
<BR>&nbsp;&nbsp;&nbsp; &amp;warning ("Cannot open POP port to $mailhost
after $trials trials: $!");
<BR>&nbsp;&nbsp;&nbsp; return;
<BR>&nbsp;&nbsp; }

<P>********************

<P>Does anyone know&nbsp; why ?????
<BR>&nbsp;

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Bye and thanks&nbsp; !!
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Andrea
<PRE>--&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ~~~~~&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (o)-(o)&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (_)&nbsp;
------------------o00o--- \_/ ---o00o-----------------
|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Andrea&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Suozzi&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
| e-mail&nbsp;&nbsp;&nbsp;&nbsp; : a.suozzi@carpi.nettuno.it&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
| snail-mail : Via Manzoni 63 Carpi (MO) 41012 Italy |
| phone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : +39 59 680019&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
------------------------------------------------------</PRE>
&nbsp;</HTML>

--------------A25314E5623F8FE9E3BCE81B--



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

Date: Mon, 15 Jun 1998 16:08:52 GMT
From: John Porter <jdporter@min.net>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <358548E4.5B57@min.net>

Tom Christiansen wrote:
> Let he who calls an array a list, or vice versa, explain these.

Rather, "let him..."

John Porter


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

Date: Mon, 15 Jun 1998 16:06:05 GMT
From: John Porter <jdporter@min.net>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <3585483D.4735@min.net>

Tom Christiansen wrote:
>      I'm not talking about bugs.

Um, actually you are, right?

John Porter


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

Date: 15 Jun 1998 15:45:31 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6m3fir$c8m$1@coranto.ucs.mun.ca>


Rahul Dhesi <c.c.eiftj@54.usenet.us.com> writes:
> Is it fair to say that if you can use a list as an lvalue, then the list
> is an array, otherwise it's not?  But that's more a distinction between
> lvalues and rvalues, than between arrays and lists.    Both seem to me
> to be ordered sequences of items.


Tom Christiansen <tchrist@mox.perl.com> writes:
>No.  Behold a list as an lvalue:

>    ($a, $b, $c) = fred();

Oh,well, I thought I had things straight, but maybe I don't.  That
doesn't look "a list as an lvalue"; it looks like a list of lvalues.


>An array has an AV associated with it.  A list is merely
>SVs sitting on a stack somewhere.  

>I wish I understood why no one understands this.

I thought your "++i vs ++128" argument would elucidate things, but
there seems to be some confusion about "variable vs value (vs
literal)".  Adding the concept of "scalar vs list context" can't
help matters.

In the Camel, pages. 47 through 49 lay it out pretty clearly.
Two examples distinguish list from array:

	$stuff = ("one", "two", "three");     # $stuff = "three"

	@stuff = ("one", "two", "three");
	$stuff = @stuff;                      # $stuff = 3

Isn't that clear enough?


However, is it ever explicitly said that "an array is a variable"?
Page 36 "Built-in Data Types" says that "An array is an ordered
list of scalars that you access with a numeric subscript."
An array contains a list.  An array evaluates as a list only in
a list context or an array ISA list only in a list context.

There is one feature where a list looks a little like an array.
"List assignment in a scalar context returns the number
of elements produced by the expression on the right side of the
assignment[.]" (p. 48)  This isn't a list evaluating to a length,
it's the result of the assignment; perhaps the distinction isn't
obvious.  But this is exceptional, documented, and a weak argument
for the fallacy that a list ISA array.

Paul Fardy
-- 
Paul David Fardy                      |  pdf@morgan.ucs.mun.ca
Computing and Communications          |  pdf@InfoNET.st-johns.nf.ca
Memorial University of Newfoundland   |
St. John's, NF  A1C 5S7               |


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

Date: Mon, 15 Jun 1998 16:38:30 GMT
From: lefkogt.xp@usafa.af.mil
Subject: Script Help?
Message-Id: <6m3im6$p8c$1@nnrp1.dejanews.com>

The following code writes and extra line in the datafile anyone know why?

Code:

#!/usr/bin/perl

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);

foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/~!/ ~!/g;
$FORM{$name} = $value;
}
open(OUTF,">>../data.txt");
# remove the $ sign on the price, if any
#$FORM{'price'} =~ s/\$//g;

print OUTF "$FORM{'status'}|$FORM{'price'}|$FORM{'name'}|$FORM{'stock'}|$FORM
{'check1'}|$FORM{'check2'}|$FORM{'check3'}|$FORM{'radio1'}|$FORM{'flavor'}|$F
ORM {'comments'}\n"; close(OUTF); #print
"Location:http://www.io.com/~kira/form7.cgi\n\n"; print
"Content-type:text/html\n\n"; print <<HTMLHead;
<html><head><title>Test</title></head> <body> HTMLHead ;

print "<font size=10>Done</font>";
print "</body></html>";

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Mon, 15 Jun 1998 17:26:20 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Script Help?
Message-Id: <6m3lj4$9b3$2@ligarius.ultra.net>

[ posted and mailed ]

lefkogt.xp@usafa.af.mil wrote:
-> The following code writes and extra line in the datafile anyone know why?
-> 
-> Code:
-> 
-> #!/usr/bin/perl
-> 
>> Snipperino <<

Use CGI.pm, it is a lot easier than having all that crap at the beginning of 
every script.

it's as simple as:
        use CGI;
        CGI::ReadParse;

-> print OUTF "$FORM{'status'}|$FORM{'price'}|$FORM{'name'}|$FORM{'stock'}|$FORM
-> {'check1'}|$FORM{'check2'}|$FORM{'check3'}|$FORM{'radio1'}|$FORM{'flavor'}|$F
-> ORM {'comments'}\n"; close(OUTF); #print
-> "Location:http://www.io.com/~kira/form7.cgi\n\n"; print
-> "Content-type:text/html\n\n"; print <<HTMLHead;
-> <html><head><title>Test</title></head> <body> HTMLHead ;

I don't know what is causing this jumbled mess, I suspect that it doesn't look 
like this before you cut and pasted it to the newsreader. After unscrambling 
it, I don't see anywhere that it would insert an extra linefeed, unless there 
is a line feed in one of the input variables.

-> print "<font size=10>Done</font>";

What's with this line? HTML font sizes are 1-7.

HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

Date: Mon, 15 Jun 1998 13:50:54 -0400
From: dolph6@jersey.net (Christopher Soeffing)
Subject: Sending mail, can I set the $from ?
Message-Id: <dolph6-1506981350540001@209.66.12.229>

I am using the following call . . .

open (MAIL, "|/bin/mail -s '$subject' $towho 2> /dev/null > /dev/null");

which I don't really understand all that much, and the email I get says it
is from a name that is associated with where I sent the email from.  I was
wondering if I can set the actual "from field" of the message that gets
sent.  

Also if anyone could explain the options that are available when I open a
file for mail, I would really appreciate it.  I assume -s is for setting
the subject, but what else is there ?

Thanks.  I would really appreciate replies via email to dolph6@jersey.net


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

Date: Mon, 15 Jun 1998 18:18:13 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Sending mail, can I set the $from ?
Message-Id: <6m3okd$c2c$2@ligarius.ultra.net>

[ posted and mailed ]

dolph6@jersey.net (Christopher Soeffing) wrote:
-> I am using the following call . . .
-> 
-> open (MAIL, "|/bin/mail -s '$subject' $towho 2> /dev/null > /dev/null");
-> 
-> which I don't really understand all that much, and the email I get says it
-> is from a name that is associated with where I sent the email from.  I was
-> wondering if I can set the actual "from field" of the message that gets
-> sent.  

Use the Net::SMTP module and your life will become much easier. It is well 
documented so that you won't have to worry about not really understanding what 
it is doing.


HTH

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-239-0341
    and hang up when the recording starts. "


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

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


Administrivia:

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

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