[16035] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3447 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 21 21:08:14 2000

Date: Wed, 21 Jun 2000 18:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <961635915-v9-i3447@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 21 Jun 2000     Volume: 9 Number: 3447

Today's topics:
        ActiveState perl and cgi <nospam@nospam.com>
    Re: ActiveState perl and cgi <rootbeer@redcat.com>
    Re: And now, The Forehead Smack... <godzilla@stomp.stomp.tokyo>
    Re: Any website on Perl programming? fperkins@my-deja.com
    Re: bash script does not exec through cgi (David Efflandt)
    Re: BIG BUG in CGI.pm on Internet Explorer !! <makau@multimania.com>
    Re: BIG BUG in CGI.pm on Internet Explorer !! (Jerome O'Neil)
    Re: BIG BUG in CGI.pm on Internet Explorer !! <flavell@mail.cern.ch>
        Creating a cause from information. malverian@hotmail.com
        Editing text file...how? <edge@gecko.org>
    Re: Editing text file...how? <billy@arnis-bsl.com>
        Error checking with Getopts pmacadam@my-deja.com
    Re: help on perl format function <ldk006@email.mot.com>
    Re: help on perl format function <rootbeer@redcat.com>
        How to make a link gizmo work in Perl.. (Loans2001)
    Re: How to make a link gizmo work in Perl.. (David Efflandt)
    Re: I need to get better at Perl mark_f_edwards@my-deja.com
    Re: I need to get better at Perl (Steven Smolinski)
    Re: I need to get better at Perl (Eric Bohlman)
    Re: Looping through records in an array <rootbeer@redcat.com>
    Re: Need Help <mhc@Eng.Sun.COM>
        perl reference challenge: mark_f_edwards@my-deja.com
    Re: perl reference challenge: <aperrin@davis.DEMOG.Berkeley.EDU>
    Re: perl reference challenge: (Sean McAfee)
    Re: perl reference challenge: <abe@ztreet.demon.nl>
    Re: Perl Timer help malverian@hotmail.com
    Re: Programming Question <ab@cd.com>
    Re: Programming Question malverian@my-deja.com
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Jun 2000 16:08:38 -0700
From: "JB" <nospam@nospam.com>
Subject: ActiveState perl and cgi
Message-Id: <nSb45.467$QA1.30913@news.uswest.net>

Is this the write news group for perl win32 questions?  If not where?

I'm looking for examples and FAQs in addition to ActiveStates FAQ's  at
http://www.activestate.com/Products/ActivePerl/docs/index.html

For example how would one write even the simplest of cgi form data
retrievals on an NT IIS ActiveState win32 system in perl?  (not using CGI
module).

Here's an example of a simple bit of code that's hanging, note this is
normally effective on a Unix box.  Is it hanging because of the STDIN?  or
is the pack("C",hex($1)) function a problem... (Note: I commented out the
$value =~... pack()/eg;  and it still hangs...)

$forminfo = <STDIN>;
@key_value_pairs = split(/&/,$forminfo);
foreach $pair (@key_value_pairs){
  ($key,$value) = split(/=/,$pair);
  $value =~ s/\+/ /g;
  $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
  $FORM_DATA{$key} = $value;
}


TIA,

JB








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

Date: Wed, 21 Jun 2000 16:46:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: ActiveState perl and cgi
Message-Id: <Pine.GSO.4.10.10006211642100.4312-100000@user2.teleport.com>

On Wed, 21 Jun 2000, JB wrote:

> Is this the write news group for perl win32 questions?  If not where?

No, this is the "read" news group for Perl questions. :-)

Of course, if you have questions about other things (such as CGI
programming, or Win32 system issues) there are other newsgroups.

> I'm looking for examples and FAQs in addition to ActiveStates FAQ's  at
> http://www.activestate.com/Products/ActivePerl/docs/index.html

Have you tried the perldoc command on your system? Have you seen the
frequent posting in this newsgroup and c.l.p.announce about how to find
the FAQ?

> For example how would one write even the simplest of cgi form data
> retrievals on an NT IIS ActiveState win32 system in perl?  (not using CGI
> module).

No, by using the CGI module.

> Here's an example of a simple bit of code that's hanging, note this is
> normally effective on a Unix box.  Is it hanging because of the STDIN?  

> $forminfo = <STDIN>;
> @key_value_pairs = split(/&/,$forminfo);
> foreach $pair (@key_value_pairs){
>   ($key,$value) = split(/=/,$pair);
>   $value =~ s/\+/ /g;
>   $value =~ s/%([0-9a-fA-F][0-9a-fA-F])/pack("C", hex($1))/eg;
>   $FORM_DATA{$key} = $value;
> }

It's hanging because it doesn't follow the CGI specification - which is
one of many reasons that you shouldn't do this yourself and should use a
module instead. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 21 Jun 2000 16:18:08 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: And now, The Forehead Smack...
Message-Id: <39514D30.1894D3C8@stomp.stomp.tokyo>

Mark Badolato wrote:

(snipped)

> The submitted bios were edited, reworded, reduced etc, by someone who
> apparently Just Doesn't Get It.  Today we were sent the bio sheet to
> review for mistakes etc.  Mine contained this edited-down gem:
 
> "He was the first one to create and release modifications and
> enhancements on Perl scripts."
 
> Wow. Apparently I'm a pioneer.  Just out of curiosity, 
> what the hell...



Which is what I said. Yours ain't nothing. Early today
two men dumped a dead person on our land. I am being
dead serious. 

Maybe more modern methods such as modules will help
to clear up this day long mess up here on our hill,
and help you feel better about being a real programmer. 

Godzilla!


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

Date: Wed, 21 Jun 2000 23:45:33 GMT
From: fperkins@my-deja.com
Subject: Re: Any website on Perl programming?
Message-Id: <8irk2o$8u$1@nnrp1.deja.com>



> I have no book on Perl programming on hand. So I want to learn from
some web
> site on it (except that perl FAQ).

My Perl books are invaluable.  Take the time to go to the bookstore and
pick up the lama and camel books by ORA.  How I learned [and Im still
learning] is from example.  Check out http://www.cgi-resources.com



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 22 Jun 2000 00:36:54 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: bash script does not exec through cgi
Message-Id: <slrn8l2nsu.ef3.efflandt@efflandt.xnet.com>

On Wed, 21 Jun 2000 15:12:02 GMT, wmcn@my-deja.com <wmcn@my-deja.com> wrote:
>hi,
>
>  I've got a script that works from command line
>but not through the form (full execute/read permissions)
>The app the script should be launching is in the /sbin/
>of a debian system.  Is there something I'm missing.

Check $ENV{PATH} is from a CGI.
Is /sbin in your PATH on the server or are you using a full path to it?
Does it use any other programs not in your PATH?
Does the user that CGI runs as have permission to run it (testing -x $cmd
will tell you).

>Later,
>Bill
>wmcn@ireland.com
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Wed, 21 Jun 2000 22:29:13 GMT
From: Makau Divangamene <makau@multimania.com>
Subject: Re: BIG BUG in CGI.pm on Internet Explorer !!
Message-Id: <8irfja$spc$1@nnrp1.deja.com>


> > That thing is driving me crazy !!!
> >  What's weird is that ENV
> > {QUERY_STRING} is correct but as soon as I try retrieving variables
> > with the param($key) method of CGI.pm, it simply doesn't work
> > (sometimes) !!
>
> I'd be willing to bet the bug is in IE.  Can you post some code that
> demonstrates this behaviour?

Jerome,

Thanks for replying. Like I said, my code is divided into several
modules. What's more each module is many hundreds of lines long. So
finding which part of my code produces the "BUG" is mission impossible
for me.

However the good news is that I HAVE FOUND A WORK-AROUND !!!
True I haven't solved the soltuion effectively but I have done
something that (temporarily?) prevents the loss of parameters bug from
occuring on Internet Explorer.

Here is what I did :

First of all, I wrote two subroutines which more or less "emulate" the
behaviour of CGI.pm :

# --- Module.pm
sub cgiParam
{
	my $self = shift;
	my (%param,$key,$value);

	foreach my $keyvalue (split('&',$ENV{QUERY_STRING})) {
		($key,$value) = split('=',$keyvalue);
		$key   = UriToText($key);
		$value = UriToText($value);
		$param{$key} = $value;
	};

	return (%param);
};

sub UriToText
{
	my $uri = shift;
	$uri =~ tr/+/ /;
	$uri =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
	return $uri;
};
# ---

Then, instead of retrieving data through the param() method of CGI.pm,
I made it through Module.pm :

# --- script.pl

my %param = Module->new->cgiParam;
foreach my $key (keys %param) {
        print "$key = $param{$key}<BR>\n";
};
etc... etc...
# ---

I agree this is a very ugly solution. But it "just works" effectively
on Netscape or Internet Explorer and no bug has been found so far. The
only problem is when I try to retrieve checkboxes values that have the
same "NAME". Normally with CGI.pm I would just do :
--
foreach (CGI->new->param('checkboxes')) { ... };
--
but with my workaround, it wouldn't work since values of %param are
scalars, not arrays. So in this (very rare) case, I just keep using
CGI.pm ...

Hope this will help others ...

--
Makau


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 21 Jun 2000 22:53:42 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: BIG BUG in CGI.pm on Internet Explorer !!
Message-Id: <WHb45.370$ZR1.6882@news.uswest.net>

Makau Divangamene <makau@multimania.com> elucidates:

>> I'd be willing to bet the bug is in IE.  Can you post some code that
>> demonstrates this behaviour?
> 
> Jerome,
> 
> Thanks for replying. Like I said, my code is divided into several
> modules. What's more each module is many hundreds of lines long. So
> finding which part of my code produces the "BUG" is mission impossible
> for me.

Well, you shouldn't need to post *your* code, per se.  The alleged
bug is pretty straightforward.  If CGI handles IE differently, it
should be pretty easy to post code that prints query_string, and then
walks through the param() list.

That would be easy!


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

Date: Thu, 22 Jun 2000 01:08:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: BIG BUG in CGI.pm on Internet Explorer !!
Message-Id: <Pine.GHP.4.21.0006220047450.16419-100000@hpplus03.cern.ch>

On Wed, 21 Jun 2000, Makau Divangamene wrote:

> Thanks for replying. Like I said, my code is divided into several
> modules. What's more each module is many hundreds of lines long. So
> finding which part of my code produces the "BUG" is mission impossible
> for me.

Then you have a far more serious problem on your hands than a mere
browser incompatibility.  You are telling us that your application is
unserviceable.

> However the good news is that I HAVE FOUND A WORK-AROUND !!!

Does it fall to me to point out that the "Emperor isn't wearing any
clothes"?

> True I haven't solved the soltuion effectively but I have done
> something that (temporarily?) prevents the loss of parameters bug from
> occuring on Internet Explorer.
> 
> Here is what I did :

[fx: throwing out the baby with the bathwater]

> I agree this is a very ugly solution. But it "just works" effectively
> on Netscape or Internet Explorer and no bug has been found so far. 

But something is still fundamentally wrong, and you don't know what it
is.  In an application that is, in effect, an extension of your web
server, this is IMNSHO quite a serious matter, and should give you
pause for thought.

I would surmise that at some point you almost certainly have handled
either URL-escaping or HTML-escaping wrongly.  This is an area that
causes a lot of people confusion, there's only one way of doing it
correctly, but the wrong ways can give an impression of working in
many cases - differently from one browser/version to another.  Which
sounds like where you were at.

You _were_ using a relatively recent version of CGI.pm, yes? 

> Hope this will help others ...

I beg to differ, sorry.  I hope it will stimulate them to write
debuggable code, and settle down calmly to find the bugs in it by
instrumenting it with appropriate debugging code and reference to the
interworking specifications, rather than plastering the perl group
with lots of double exclamation marks and then applying make-up to
cover the blemishes.

Your topic really would be more comfortable on c.i.w.authoring.cgi
though.  At the moment the only issue that is vaguely related to
perl.misc is the general theme of designing serviceable
implementations, and debugging them.  (Unless the Perl stalwarts know
of a better place for that!).




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

Date: Wed, 21 Jun 2000 23:04:27 GMT
From: malverian@hotmail.com
Subject: Creating a cause from information.
Message-Id: <8irhlh$u80$1@nnrp1.deja.com>

Sorry for the abstract subject, it was the best way I could think to
state it.

I have a Perl program that connects to a computer and recieves
information from it constantly.

while(<SOCK>)
{
   $data = <SOCK>;
   #etc...

In that while statement after it gets the $data variable, it goes
through multiple If's.

   if ($data =~ /^7$/i)
   {
      #do this...

Now.. when $data is a certain thing, it substr's that data into a small
section of this.

   if ($data =~ /^6 .+/i)
   {
      $thing = substr($data,1,-1);
      #etc...

This works fine, but, when I tell it to have an action of $thing, if it
contains a \, *, #, $, ), etc.. it crashes. Let me explain.

   if ($data =~ /^5 $thing/i)
   {
      #etc...

In this example, if  $thing = "144K*900\"  it would crash saying it had
a failure with * in regexp, or something similar. What is important is
that you understand the problem.. what can I do to fix this? Help is
greatly appreciated.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 21 Jun 2000 23:54:23 GMT
From: Edge <edge@gecko.org>
Subject: Editing text file...how?
Message-Id: <8irkj8$e0$1@nnrp1.deja.com>

I'm sure this is a much asked question, but I didn't see it on a cursory
scan of the group.  I have a small script (address book) that writes to
a text file in ':'deliminated form.  I want to add to the script the
ability to edit the file at a later date.  I know to use the "-i" option
for perl but how do I write the changed variable back to the file?

 ....code snippet begins....
        system("clear");
        ($name, $email, $homenum, $pagenum, $cellnum, $work, $addr,
$city, $state, $zip, $desc)=split(/:/,$item);
	print "\nEdit this entry? (y/n):  \n";
        chop($edit = <STDIN>);
        if ($edit eq "y") {
                system("clear");
                print "Edit which field?:\n\n";
                chop($desc);
                print "1\)  Name \($name\)\n";
                print "2\)  Email \($email\)\n";
                print "3\)  Home Phone \($homenum\)\n";
                print "4\)  Pager \($pagenum\)\n";
                print "5\)  Cell Phone \($cellnum\)\n";
                print "6\)  Work Phone \($work\)\n";
                print "7\)  Address \($addr\)\n";
                print "8\)  City \($city\)\n";
                print "9\)  State \($state\)\n";
                print "10\) Zipcode \($zip\)\n";
                print "11\) Description \($desc\)\n\n";
                chop($line = <STDIN>);
 ...snippet ends...
followed by (ugly, I know) if $line="x" then $variable="new info"

Now, how do I take the new info and replace the old info?


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 00:30:42 GMT
From: Ilja Tabachnik <billy@arnis-bsl.com>
Subject: Re: Editing text file...how?
Message-Id: <8irmnj$204$1@nnrp1.deja.com>

In article <8irkj8$e0$1@nnrp1.deja.com>,
  Edge <edge@gecko.org> wrote:
> I'm sure this is a much asked question, but I didn't see it on a
cursory
> scan of the group.  I have a small script (address book) that writes
to
> a text file in ':'deliminated form.  I want to add to the script the
> ability to edit the file at a later date.  I know to use the "-i"
option
> for perl but how do I write the changed variable back to the file?
>
> ....code snippet begins....

 ...code snippet skipped...

Reading the FAQ may help:
"How do I change one line in a file/delete a line in a file/insert
a line in the middle of a file/append to the beginning of a file?"

The answer may be found in 'perldoc perlfaq5'
or at http://www.cpan.org/doc/manual/html/pod/perlfaq5.html.

Hope this helps.
Ilja.



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 00:33:38 GMT
From: pmacadam@my-deja.com
Subject: Error checking with Getopts
Message-Id: <8irmt2$21d$1@nnrp1.deja.com>

I'm using the Getopt:Std module to parse command-line arguments.
It all works great -- except in handling erroneous user input.

For instance:

use Getopt::Std;

getopts("u:p:", \%opts);

There's no problem if the user does the right thing and types:

myprog.pl -u me -p XXX

However, if they type myprog.pl -u -p xxx, then $opts{'u'} equals -p,
and $opts{'p'} never gets set.

Am I missing something?

Thanks in advance.

P


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 21 Jun 2000 18:10:33 -0400
From: David Kowal <ldk006@email.mot.com>
Subject: Re: help on perl format function
Message-Id: <39513D59.D08D0049@email.mot.com>

I did review the perl format documentation and did NOT come away thinking it
could be done. I am however still hopeful there is a possible workaround.

Drew Simonis wrote:

> David Kowal wrote:
> >
> > I'm relatively new with respect to perl and the formatting of reports.
> >
> > I currently have a perl script which queries a db for particular fields
> > and outputs a html report. I'd like to be able to display a graphic
> > using the perl format function rather than the current  text. Can this
> > be done? If so, please point me to some reference material on the web or
> > better still some examples if possible.
> >
>
> Have you read the perlform documentation?
>
> $ perldoc perlform

--
-
*****************************************
           David E. Kowal
Software Tools Engineering/Administration
 Motorola Internet and Networking Group
  LDK006@email.mot.com (508) 261-5649
*****************************************




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

Date: Wed, 21 Jun 2000 16:39:23 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: help on perl format function
Message-Id: <Pine.GSO.4.10.10006211637210.4312-100000@user2.teleport.com>

On Wed, 21 Jun 2000, David Kowal wrote:

> I did review the perl format documentation and did NOT come away thinking it
> could be done. I am however still hopeful there is a possible workaround.

> > > and outputs a html report. I'd like to be able to display a graphic
> > > using the perl format function rather than the current  text. Can this

A graphic? No; formats produce text. But maybe you could write the text to
a file, then post-process it to make it part of an HTML page. (Is that
what you're thinking?) If you're especially tricky, you may be able to
avoid the temporary file, but I wouldn't bother with that.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 21 Jun 2000 23:39:17 GMT
From: loans2001@aol.com (Loans2001)
Subject: How to make a link gizmo work in Perl..
Message-Id: <20000621193917.26903.00000345@ng-fl1.aol.com>

Hello,

On my website I have a form which people may fill out if they are interested,
and it uses a simple email script to email me the form. 

My question is, I'm having people link to me with my web graphic, and embedded
in the hyperlink (e.g. http://www.mortgage-pros.com?1234 ) is the website
owners unique affiliate code (1234), and I'd like to be able to grab this piece
of information immediately when the surfer hits my site. And then, if the
surfer fills out the form on the site, then I would like to have the affiliate
code included in my email.  Is this possible?  Is it server side includes? How
does the index.html page,  the first page the server serves up, do this number
grab and store it for future use? How would I access this information later to
get it included in my email?

Thanks for your ideas.

Scot King
Primary Capital, Inc.

"Buy a Home for No Money Down"



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

Date: 22 Jun 2000 00:53:19 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to make a link gizmo work in Perl..
Message-Id: <slrn8l2orm.ef3.efflandt@efflandt.xnet.com>

On 21 Jun 2000 23:39:17 GMT, Loans2001 <loans2001@aol.com> wrote:
>
>On my website I have a form which people may fill out if they are interested,
>and it uses a simple email script to email me the form. 
>
>My question is, I'm having people link to me with my web graphic, and embedded
>in the hyperlink (e.g. http://www.mortgage-pros.com?1234 ) is the website
>owners unique affiliate code (1234), and I'd like to be able to grab this piece
>of information immediately when the surfer hits my site. And then, if the
>surfer fills out the form on the site, then I would like to have the affiliate
>code included in my email.  Is this possible?  Is it server side includes? How
>does the index.html page,  the first page the server serves up, do this number
>grab and store it for future use? How would I access this information later to
>get it included in my email?

And what is your Perl question?  Your question would be better answered in
a newsgroup about your webserver.

You may be able to configure your server (possibly in apache with
 .htaccess) to alternatively use other filenames as a default index:

DirectoryIndex index.html index.htm index.shtml index.cgi

Then you could grab the QUERY_STRING from SSI or CGI.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Wed, 21 Jun 2000 23:09:26 GMT
From: mark_f_edwards@my-deja.com
Subject: Re: I need to get better at Perl
Message-Id: <8irhuq$uin$1@nnrp1.deja.com>



two excellent sources:

1-
'learning perl' by schwartz/christianson
       (how 'bout an "advanced learning perl", guys??)

2-
http://www.netcat.co.uk/rob/perl/win32perltut.html


mark_f_edwards@excite.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 22 Jun 2000 00:16:19 GMT
From: sjs@yorku.ca (Steven Smolinski)
Subject: Re: I need to get better at Perl
Message-Id: <slrn8l2mlj.4fh.sjs@john.sympatico.ca>

mark_f_edwards@my-deja.com <mark_f_edwards@my-deja.com> wrote:
>'learning perl' by schwartz/christianson
>       (how 'bout an "advanced learning perl", guys??)

You mean "Programming Perl" (O'Reilly) by Wall, Christiansen, Schwartz?
Or, perhaps "Advanced Perl Programming" (O'Reilly) by Sriram Srinivasan?

Steve


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

Date: 22 Jun 2000 00:39:35 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: I need to get better at Perl
Message-Id: <8irn87$ler$1@nntp9.atl.mindspring.net>

Jim (j@iforgot.net) wrote:
: Both PERL and Linux seem to be fairly eliteist.  It's most obvious in IRC
: channels...

Could you clarify what you mean by "elitist"?  To the extent that there's 
a Perl elite, it's hardly exclusive; it's an elite that anyone can join 
simply by cluing themselves in.  All I had to do to get an author ID on 
CPAN was to ask for one in a way that showed that I had read the 
procedures for getting one.

I think what a lot of people are forgetting is that when you acquire some 
software that you don't have to pay for, you haven't contributed anything 
to the salary of someone who gets paid to answer all your questions, even 
ones that are plainly covered in the documentation.  A number of 
companies offer that kind of support for Perl; one of the nice things 
about open source software is that the support doesn't have to be 
provided by the same organization as the developers.  But reading the 
manual to people who won't read it themselves is boring, tedious and 
frustrating work, and that means it's the type of work most people won't 
do unless they get paid for it, like the poor shlub at the help desk does.

Instead, Perl's developers have put a lot of work into writing 
documentation (something that the stereotypical programmer is supposed to 
hate doing) that is sufficient to enable anybody to become part of the 
"Perl elite" *if they want to*.  It doesn't demand anything more of the 
reader than a basic familiarity with programming concepts that are in no 
way Perl-specific and a basic familiarity with one's computer.  For most 
other programming languages, you'd have to pay hundreds or thousands of 
dollars to get that kind of documentation.  For a lot of people, the 
value of this more than makes up for the lack of a help desk.

I've basically explained why "read the manual to me" posts tend to get an
icy reception here, but there are a few other classes of "obnoxious" 
posts.  One is the post, unwelcome practically anywhere, in which the
poster effectively asks someone to write a complete program for them. 
That's just too "gimme"-ish for most people to stand (in some cases it
leaks out that the person who wants the program written for free needs it
for something that they're expecting to get paid for).  The other major
class of annoying posts is those that have nothing specific to do with
Perl;  they almost always involve some aspect of the WWW, and the usual
excuse for posting them in a Perl group is that the WWW uses a lot of
Perl, even when Perl has nothing to do with the problem at hand.  For
those who dislike the idea of topics having their own separate groups,
there's always Stephen Boursy's earth.general group. 

P.S. One of the first steps to joining the Perl elite is learning that 
Perl is the language, perl is the interpreter and PERL isn't the name of 
anything.



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

Date: Wed, 21 Jun 2000 17:22:29 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Looping through records in an array
Message-Id: <Pine.GSO.4.10.10006211717120.4312-100000@user2.teleport.com>

On Wed, 21 Jun 2000 scarey_man@my-deja.com wrote:

> How can I easily loop through the number of rows checking whether the
> value of the same element in the next row is different or not, and
> displaying it if it is different?

The general idiom for this sort of thing in Perl (trying to adapt to
resemble your attempt) looks somewhat like this:

    my $previous;
    for my $cntr (0..5) {
	my $current = &whatever($cntr);
	if (!defined $previous or $previous ne $current) {
	    # We haven't seen it before
	    print "$current\n";
	    $previous = $current; # so we'll know it when we see it again
	}
    }

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 21 Jun 2000 15:04:14 -0700
From: Mike Coffin <mhc@Eng.Sun.COM>
Subject: Re: Need Help
Message-Id: <8p6itv28zdt.fsf@Eng.Sun.COM>

"Dean Q. Tran" <deqtran@hns.com> writes:

> hi,
> 
> please help.
> 
> I have file contains following line:
> 
> // Welcome home
> // date: Tuesday April 5, 2000; 07:44:52
> //
> $$library( "/user/cat/read.catalog",,,,,,, @Keep );
> $$library( "/user/dog/misc.catalog",,,,,,, @Keep );
> $$library( "/user/frog/bye.catalog",,,,,,, @Keep );
> 
> I like to read this above file and have the variables assigned as:
> $file1="/user/cat/read.catalog";
> $file2="/user/dog/misc.catalog";
> $file3="/user/frog/bye.catalog";

my @files = ();
while (<>) {
  next unless /^\$\$library\(\s+"([^"]+)"/;
  push @files, $1;
}
my $file1=$files[0];
my $file2=$files[1];
my $file3=$files[2];


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

Date: Wed, 21 Jun 2000 23:02:33 GMT
From: mark_f_edwards@my-deja.com
Subject: perl reference challenge:
Message-Id: <8irhhu$u79$1@nnrp1.deja.com>

hello all -

the following reference works from, from the www.perl.com webpage:

perl -e  ' $ref = \"howdy";   print $$ref;   '
howdy


and so does the following example:

perl -e  ' @x = (1,2,3,4) ; $i=\@x ; print $i->[1] ; '
2


so can anyone please tell me why the following gives no output:

perl -e  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '


i would think the last one would work exactly as the one above, but
obviously, i am wrong (and that is difficult to admit).


thank you!
mark_f_edwards@excite.com


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 21 Jun 2000 16:49:14 -0700
From: Andrew Perrin - Demography <aperrin@davis.DEMOG.Berkeley.EDU>
Subject: Re: perl reference challenge:
Message-Id: <u5klmzyzjb9.fsf@davis.DEMOG.Berkeley.EDU>

mark_f_edwards@my-deja.com writes:


> so can anyone please tell me why the following gives no output:
> 
> perl -e  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '
> 

Your own computer can:

perldoc perlref

         Note that taking a reference to an enumerated list is
         not the same as using square brackets--instead it's the
         same as creating a list of references!

             @list = (\$a, \@b, \%c);
             @list = \($a, @b, %c);      # same thing!


-- 
---------------------------------------------------------------------
Andrew J. Perrin - aperrin@demog.berkeley.edu - NT/Unix Admin/Support
Department of Demography    -    University of California at Berkeley
2232 Piedmont Avenue #2120  -    Berkeley, California, 94720-2120 USA
http://demog.berkeley.edu/~aperrin --------------------------SEIU1199


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

Date: Wed, 21 Jun 2000 23:54:23 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: perl reference challenge:
Message-Id: <PAc45.171$GA3.4090@news.itd.umich.edu>

In article <8irhhu$u79$1@nnrp1.deja.com>,  <mark_f_edwards@my-deja.com> wrote:
>so can anyone please tell me why the following gives no output:

>perl -e  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '

Here's a hint:  Try putting the statement

@4 = (5, 6, 7, 8);

 ...before your print statement.

"use strict" would have caught your problem.

To construct an anonymous array, use square brackets:

$i = [ 1, 2, 3, 4 ];



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

Date: Thu, 22 Jun 2000 02:00:09 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: perl reference challenge:
Message-Id: <s3l2ls07sml8u3beg4sm1uttj3dfjuihov@4ax.com>

On Wed, 21 Jun 2000 23:02:33 GMT, mark_f_edwards@my-deja.com wrote:

> hello all -
> 
> the following reference works from, from the www.perl.com webpage:
> 
> perl -e  ' $ref = \"howdy";   print $$ref;   '
> howdy
> 
> 
> and so does the following example:
> 
> perl -e  ' @x = (1,2,3,4) ; $i=\@x ; print $i->[1] ; '
> 2
> 
> 
> so can anyone please tell me why the following gives no output:
> 
> perl -e  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '

(linux-gnu) ~/clpmisc$perl -we  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '
Useless use of a constant in void context at -e line 1.
Useless use of a constant in void context at -e line 1.
Use of uninitialized value at -e line 1.

try:
	perl -Mdiagnostics -we  ' $i=\@{(1,2,3,4)} ; print $i->[1] ; '

What did you want?

	perl -we '$i=[1,2,3,4]; print $i->[1];'

or 
	perl -we '$i={1,2,3,4}; print $i->{1};'

 :-)

-- 
Good luck,
Abe


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

Date: Wed, 21 Jun 2000 23:47:41 GMT
From: malverian@hotmail.com
Subject: Re: Perl Timer help
Message-Id: <8irk6n$9s$1@nnrp1.deja.com>

In article <8ioplm$un9$1@nnrp1.deja.com>,
  Ilja Tabachnik <billy@arnis-bsl.com> wrote:
> In article <8ioh0m$o19$1@nnrp1.deja.com>,
>   felrodian@my-deja.com wrote:

> > Yes! An infinite loop.. that's what I want. I want an infinite loop
> that
> > will run a subroutine every x seconds or x minutes. Any suggestions
> > greatly appreciated.
> >
>
> If that's really all you want, then:
>
> while (1)
> {
>
>      sleep $for_some_seconds;
>
>      # do something usefull here
>
> }
>

I think this isn't what he wants.. I believe sleep pauses the whole
program, correct? He wants everything else to still go on, but for this
certain thing to happen every so often.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 21 Jun 2000 23:09:06 GMT
From: "Blair Heuer" <ab@cd.com>
Subject: Re: Programming Question
Message-Id: <mWb45.19254$ds.538895@newsread2.prod.itd.earthlink.net>

> You just need to print a \n after priting the email address. If this
> doesn't help go ahead and email the script to me and I'll take a look.

There might already be a \n there, but if its going out to an html document,
then it would make no difference, since a newline in an html document does
not mean a newline in the browser.

Add '<br>' at the end of the first line outputted by the code:
        name -- Roger Ranger<br>
and '<br><br>' at the end of the second line outputted by the code:
        email -- rranger@hotmail.com<br><br>

Not knowing your code, I can't say exactly what to do, but just find where
it prints to the file and add that too it. Hope that helps.




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

Date: Wed, 21 Jun 2000 23:04:52 GMT
From: malverian@my-deja.com
Subject: Re: Programming Question
Message-Id: <8irhm9$uf4$1@nnrp1.deja.com>

In article <15690460.5acac8de@usw-ex0101-008.remarq.com>,
  Bob <blumbjNOblSPAM@hotmail.com.invalid> wrote:

> Then, when they submit the form, it should be written to an HTML
> file

This means you'll have to use <br> breakline in the print of it... that
way it will format it correctly?
If you were printing to a plain document you'd use \n obviously.. I
don't understand your question, possibly. Try posting the script
itself, or the part that does this part of it.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3447
**************************************


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