[18394] in Perl-Users-Digest
Perl-Users Digest, Issue: 562 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 25 11:05:42 2001
Date: Sun, 25 Mar 2001 08:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985536314-v10-i562@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 25 Mar 2001 Volume: 10 Number: 562
Today's topics:
Re: "perldoc" broken in Solaris 8 (Eric Bohlman)
Re: array vs. array question <tinamue@zedat.fu-berlin.de>
Re: CGI style - CGI vs "here is" vs ?? <gtoomey@usa.net>
Re: CGI style - CGI vs "here is" vs ?? egwong@netcom.com
Re: CGI style - CGI vs "here is" vs ?? <gtoomey@usa.net>
Re: CGI style - CGI vs "here is" vs ?? <uri@sysarch.com>
Re: CGI style - CGI vs "here is" vs ?? <flavell@mail.cern.ch>
Re: every 15 seconds <bigrich318@yahoo.com>
Re: every 15 seconds (Randal L. Schwartz)
Good Perl Code Syntax Highlighting Editor for Linux?? <acline@okstateREMOVECAPS.edu>
Re: Good Perl Code Syntax Highlighting Editor for Linux (Martien Verbruggen)
Re: Good Perl Code Syntax Highlighting Editor for Linux <acline@okstateREMOVECAPS.edu>
Re: Good Perl Code Syntax Highlighting Editor for Linux obscuremu@riftsmux.dhs.org
Re: Good Perl Code Syntax Highlighting Editor for Linux (Randal L. Schwartz)
Re: Good Perl Code Syntax Highlighting Editor for Linux (Michael P. Soulier)
Re: Help needed: simulating a browser to download web-b <iltzu@sci.invalid>
Re: Help with syntax error <uri@sysarch.com>
Re: Help with syntax error <uri@sysarch.com>
Re: Hmmm... Which PERL Book Is Best Suited For This??? (---Pete---)
Re: Hmmm... Which PERL Book Is Best Suited For This??? <bowman@montana.com>
How to post to a newsgroup from a script? <waverley2000@hotmail.com>
Problem running 'traceroute' command from perl script. (Mark Johnson)
Re: Problem running 'traceroute' command from perl scri (Garry Williams)
Re: Problem running 'traceroute' command from perl scri (Abigail)
putting code online <todd@designsouth.net>
Re: putting code online <todd@designsouth.net>
Re: putting code online <tinamue@zedat.fu-berlin.de>
Re: require'ing OO modules on the fly - any danger? <djberg96@hotmail.com>
Re: Script mysteriously erases file it's supposed to ap (Mark Jason Dominus)
Re: the space (cljlk)
Re: the space (Abigail)
Using Web Frontend to make Config file <acline@okstateREMOVECAPS.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Mar 2001 07:46:24 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: "perldoc" broken in Solaris 8
Message-Id: <99k7og$npa$1@bob.news.rcn.net>
Abigail <abigail@foad.org> wrote:
> Eric Bohlman (ebohlman@omsdev.com) wrote on MMDCCLXI September MCMXCIII
> in <URL:news:99fg1g$6vm$1@bob.news.rcn.net>:
> %% -q was added in the perldoc that came with, IIRC, perl 5.004. Your site
> %% has 5.003 installed, so its perldoc wouldn't have had -q.
> Eh, since when is 5.005_03 a release of perl 5.003?
Psychological set strikes again.
------------------------------
Date: 25 Mar 2001 09:48:40 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: array vs. array question
Message-Id: <99keto$1dch6$2@fu-berlin.de>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "TM" == Tina Mueller <tinamue@zedat.fu-berlin.de> writes:
> TM> hi,
> >> >> @fields{ @a } = (0..@a);
> TM> ^^
> TM> that should be @a-1, of course
> >> better to make it $#a
> TM> why?
> TM> if this code should work integrated in larger programs
> TM> I would not rely on $[ being 0...
> setting $[ is deprecated and now is only file scoped and not truly
> global. i would not worry about someone setting it. if they do, they
> better know what they are doing and deal with any $#a values they have
> around.
well, I've seen a lot of things in perl programs (although
I just have 3 years of experience with perl).
there are people inintializing all their
arrays with
my @array1 = (undef);
my @array2 = (undef);
and then they're iterating over
(1..@array1).
I know it's deprecated to set $[ but there are a lot of things
deprecated and you'll still find them in old programs.
charles' solution ($[..$#a) looks nice.
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Sun, 25 Mar 2001 15:13:34 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: CGI style - CGI vs "here is" vs ??
Message-Id: <FXev6.2858$45.13501@newsfeeds.bigpond.com>
The easiest way is to read a file (e.g. xxx.htm) into a list and print.
It only takes a few lines of code and separates code and content.
open(INFILE, 'file.htm');
my @html=<INFILE>;
print @html;
gtoomey
------------
"pt" <mnemotronic@mind\no-spam/spring.com> wrote in message
news:3ABCE6ED.71E9EC0B@mindspring.com...
> A basic CGI style question : are there any Widely Accepted Practices
> for creating the "static" sections of a web page which don't require the
> services of a CGI? It seems that lots of calls to CGI would be less
> efficient than a "here is" document with the HTML, or slurping an
> external file, or other methods (do tell). Nothing in perlstyle, and
> the style section in CGI only discusses OO vs. function calls.
>
>
>
> Remove the obvious anti-spam to reply.
------------------------------
Date: Sun, 25 Mar 2001 05:34:52 -0000
From: egwong@netcom.com
Subject: Re: CGI style - CGI vs "here is" vs ??
Message-Id: <tbr0rso7cbj714@corp.supernews.com>
pt <mnemotronic@mind\no-spam/spring.com> wrote:
> The Perl scripts I've seen in books appear to contain many calls to
> functions (or invocation of methods) in CGI.pm. These functions (or methods)
> emit HTML, or so I understand. For example, a script with calls to CGI::p(),
> CGI::ol(), CGI::ul(), CGI::li(), would appear to be calls to CGI.pm. Maybe
> I'm confused and these are actually calling the Vatican. Maybe "call" is the
> wrong term. I don't understand how a Perl script with many references to
> CGI::p() would only be calling CGI::pm once per generated document.
It doesn't matter how many different "calls" to a module you make in a
program, the module will only be loaded once, so don't worry about that.
It is true, though, that there is a certain small overhead for *any*
subroutine call in perl, but if you have to worry about that fine of an
optimization, then perl's probably the wrong solution for you.
Eric
------------------------------
Date: Sun, 25 Mar 2001 15:37:29 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: CGI style - CGI vs "here is" vs ??
Message-Id: <4ifv6.2878$45.13834@newsfeeds.bigpond.com>
At the risk of appearing schitzophrenic replying to my own posts,
the following code will read a file and expand any variable or function
references
before sending them to the browser.
e.g. home.htm could have a line
The date is $date and function is @{[myfunc()]}
This would case the variable $date and the value returned by myfunc()
to be included in the web content.
This gives us the best of both worlds
1. HTML and Perl are seperated
2. HTML is "dynamic" in that variable or function values can be added
-------------------
open(INFILE, 'home.htm');
my @html=<INFILE>;
my $str= "<<EOF;\n".join("\n",@html)."\nEOF\n";
print eval $str;
-------------------
gtoomey
------------------------------
Date: Sun, 25 Mar 2001 09:06:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: CGI style - CGI vs "here is" vs ??
Message-Id: <x73dc21akz.fsf@home.sysarch.com>
>>>>> "GT" == Gregory Toomey <gtoomey@usa.net> writes:
GT> open(INFILE, 'home.htm');
GT> my @html=<INFILE>;
why read it into an array only to join it? slurp it in as a single
string by using $/
$text = do{ local $/ ; <INFILE> } ;
GT> my $str= "<<EOF;\n".join("\n",@html)."\nEOF\n";
why the join with \n? the lines already have \n on them.
you could have just done a slurp and
$str = "<<EOF;\n$text\nEOF\n" ;
GT> print eval $str;
that is slow. use a simple s/// or a template module. and this is an FAQ
as well.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 25 Mar 2001 12:55:01 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI style - CGI vs "here is" vs ??
Message-Id: <Pine.LNX.4.30.0103251243001.11567-100000@lxplus003.cern.ch>
On Sat, 24 Mar 2001, pt wrote:
> > > A basic CGI style question : are there any Widely Accepted Practices
> > > for creating the "static" sections of a web page which don't require the
> > > services of a CGI?
> >
> > Do you have a Perl question?
> CGI. As in "use CGI;". As in "CGI.pm", which is (I think) a Perl module.
Well, the fact that you're programming in Perl doesn't make every
possible question about your program into a Perl language question -
that's an important general principle that would stand you in good
stead not only on usenet but in any kind of problem solving situation.
However, in this particular case it seems that your question was
rather a different one than what it initially seemed. I think quite a
number of people reading your question about "the services of a CGI"
would have interpreted it as I did, about the invocation of a CGI
program or script, rather than merely about a call to the CGI.pm
module.
> > I don't quite get your point. There is only one call to a CGI per
> > generated document.
[i.e "one invocation of a program across the Common Gateway
Interface"]
> The Perl scripts I've seen in books appear to contain many calls to
> functions (or invocation of methods) in CGI.pm. These functions (or methods)
> emit HTML, or so I understand.
You are not compelled to use those calls for generating
straightforward HTML if you don't want to. They can be helpful in a
number of ways, but if you simply have some correct boiler-plate HTML
that you want to emit, then just go right ahead and use a
here-document or any other way you find convenient, to emit the HTML
at the appropriate point of the program.
> For example, a script with calls to CGI::p(),
> CGI::ol(), CGI::ul(), CGI::li(), would appear to be calls to CGI.pm.
Indeed they are, but one wouldn't refer to that as "calling a CGI",
which is usually taken to mean "invoking a program or script across
the Common Gateway Interface".
> Maybe
> I'm confused and these are actually calling the Vatican.
Oh, right, so you don't actually want to learn anything.
------------------------------
Date: Sun, 25 Mar 2001 08:34:34 -0600
From: "Rich" <bigrich318@yahoo.com>
Subject: Re: every 15 seconds
Message-Id: <tbs0aim7dph253@corp.supernews.com>
"Randal L. Schwartz" <merlyn@stonehenge.com> wrote in message
news:m1puf7teid.fsf@halfdome.holdit.com...
> >>>>> "Rich" == Rich <bigrich318@yahoo.com> writes:
>
> Rich> I figured it out after I posted, Randal's psuedocode threw me off.
>
> Ahem! Perl is *not* pseudocode. Nothing false about the way I did
> that.
>
> :-)
I wasn't referring to your example as a whole. I was referring to the
pseudocode ("... do task here ..") in your example as being misleading. If
I am incorrect, please correct me and post an example with "... do task
here .." replaced with working code so that it meets the challenge of
outputting information every 15 seconds regardless of how long it took for
the information to be collected (0 -15 seconds).
while (1) {
sleep 15 - time % 15;
... do task here ... <------ This isn't pseudocode?
}
and, in order for it to meet the requirements of the challenge, shouldn't
it have been:
while (1) {
... do task here ... <---- pseudocode?
sleep 15 - time % 15;
..print output here.. <---- pseudocode?
}
If the above examples do not contain pseudocode, then I have been
incorrectly referring to that mock-code as pseudocode and I'm prepared to
make a public apology to all mock-code that I have insulted by doing so.
I anxiously await enlightenment :^)
Rich
------------------------------
Date: 25 Mar 2001 06:48:40 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: every 15 seconds
Message-Id: <m1snk1q4zb.fsf@halfdome.holdit.com>
>>>>> "Rich" == Rich <bigrich318@yahoo.com> writes:
Rich> I wasn't referring to your example as a whole. I was referring to the
Rich> pseudocode ("... do task here ..") in your example as being misleading. If
Rich> I am incorrect, please correct me and post an example with "... do task
Rich> here .." replaced with working code so that it meets the challenge of
Rich> outputting information every 15 seconds regardless of how long it took for
Rich> the information to be collected (0 -15 seconds).
Ahh. Sorry. In my haste, I thought the problem was to "do something
every 15 seconds", not "generate output every 15 seconds". Oops.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 25 Mar 2001 00:00:15 -0600
From: Aaron Cline <acline@okstateREMOVECAPS.edu>
Subject: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <EJgv6.283$Rx.2844@news.onenet.net>
Well, the title says most of what I mean. I need a good Perl syntax
highlighting editor for Linux (glibc-2.1, i386). I like to use Vim, and I
have found that supposedly it has syntax highlighting capabilities but I
can't figure out how to get them to work. If anyone has instructions on
how to do this, I would be very grateful, or if you have a favorite editor,
please enlighten me.
Thanks,
Aaron Cline
------------------------------
Date: Sun, 25 Mar 2001 17:26:09 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <slrn9br7ch.ugg.mgjv@martien.heliotrope.home>
On Sun, 25 Mar 2001 00:00:15 -0600,
Aaron Cline <acline@okstateREMOVECAPS.edu> wrote:
> Well, the title says most of what I mean. I need a good Perl syntax
> highlighting editor for Linux (glibc-2.1, i386). I like to use Vim, and I
> have found that supposedly it has syntax highlighting capabilities but I
> can't figure out how to get them to work. If anyone has instructions on
> how to do this, I would be very grateful, or if you have a favorite editor,
> please enlighten me.
Vim does a pretty good job, all you need to do is enable it.
Somewhere in your .vimrc:
source $VIMRUNTIME/syntax/syntax.vim
and everything should happen more or less automagically.
To force Perl syntax highlighting:
:syntax on
:set syn=perl
Also:
:help syntax
Read the quick start section
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, Dave here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Sun, 25 Mar 2001 00:53:46 -0600
From: Aaron Cline <acline@okstateREMOVECAPS.edu>
Subject: Re: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <Pvhv6.285$Rx.3131@news.onenet.net>
Thanks, I also found that I needed to use vimx as my executable instead of
vi
Thanks again.
Aaron
Martien Verbruggen wrote:
> On Sun, 25 Mar 2001 00:00:15 -0600,
> Aaron Cline <acline@okstateREMOVECAPS.edu> wrote:
>> Well, the title says most of what I mean. I need a good Perl syntax
>> highlighting editor for Linux (glibc-2.1ed to do is enable it.
>
> Somewhere in your .vimrc:
>
> source $VIMRUNTIME/syntax/syntax.vim
>
> and everything should happen more or, i386). I like to use Vim, and
>> I have found that supposedly it has syntax highlighting capabilities but
>> I
>> can't figure out how to get them to work. If anyone has instructions on
>> how to do this, I would be very grateful, or if you have a favorite
>> editor, please enlighten me.
>
> Vim does a pretty good job, all you need to do is enable it.
>
> Somewhere in your .vimrc:
>
> source $VIMRUNTIME/syntax/syntax.vim
>
> and everything should happen more or less automagically.
>
> To force Perl syntax highlighting:
>
> :syntax on
> :set syn=perl
>
> Also:
>
> :help syntax
>
> Read the quick start section
>
> Martien
------------------------------
Date: Sun, 25 Mar 2001 11:02:02 GMT
From: obscuremu@riftsmux.dhs.org
Subject: Re: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <3abdcfee.108614177@news.inreach.com>
On Sun, 25 Mar 2001 00:00:15 -0600, Aaron Cline <acline@okstateREMOVECAPS.edu>
wrote:
>Well, the title says most of what I mean. I need a good Perl syntax
>highlighting editor for Linux (glibc-2.1, i386). I like to use Vim, and I
>have found that supposedly it has syntax highlighting capabilities but I
>can't figure out how to get them to work. If anyone has instructions on
>how to do this, I would be very grateful, or if you have a favorite editor,
>please enlighten me.
Emacs in cperl-mode + hilight is the best for me. And it works on many OSes.
------------------------------
Date: 25 Mar 2001 06:20:10 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <m1k85eq6at.fsf@halfdome.holdit.com>
>>>>> "obscuremu" == obscuremu <obscuremu@riftsmux.dhs.org> writes:
obscuremu> Emacs in cperl-mode + hilight is the best for me. And it
obscuremu> works on many OSes.
Yeah, emacs 20.7 even ships "out of the box" on MacOS X! Whee!
(So does apache with mod_ssl and mod_perl, and Perl 5.6.)
Just another guy standing in line friday at midnight, :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Sun, 25 Mar 2001 15:35:41 GMT
From: msoulier@storm.ca (Michael P. Soulier)
Subject: Re: Good Perl Code Syntax Highlighting Editor for Linux??
Message-Id: <hfov6.77244$A6.17187454@news4.rdc1.on.home.com>
On Sun, 25 Mar 2001 00:00:15 -0600, Aaron Cline <acline@okstateREMOVECAPS.edu>
wrote:
>Well, the title says most of what I mean. I need a good Perl syntax
>highlighting editor for Linux (glibc-2.1, i386). I like to use Vim, and I
>have found that supposedly it has syntax highlighting capabilities but I
>can't figure out how to get them to work. If anyone has instructions on
>how to do this, I would be very grateful, or if you have a favorite editor,
>please enlighten me.
I started using Vim when Emacs failed to parse my Perl correctly and kept
moving my code around on me. I haven't looked back.
Make sure that you installed the runtime libraries as well as the
executable. On the ftp site, these are vimrt* packages. On my Debian box, it's
a vim-rt package.
Once that's installed, simply loading your perl script should do it, but
if it does not, the following should:
:set filetype=perl
:syntax on
GVim also has a pull-down menu where you can select the syntax.
Happy Vimming.
Mike, composed in Vim of course...
--
Michael P. Soulier <msoulier@storm.ca>
"With sufficient thrust, pigs fly just fine. However, this is not necessarily a
good idea. It is hard to be sure where they are going to land, and it could be
dangerous sitting under them as they fly overhead." -- RFC 1925
------------------------------
Date: 25 Mar 2001 11:02:35 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Help needed: simulating a browser to download web-based mail
Message-Id: <985517809.7935@itz.pp.sci.fi>
[Newsgroups trimmed to clpm only. Comp.lang.perl is a dead group.]
In article <3ABCE4C2.9BE06CAE@def.ghi>, CSW wrote:
>
>I have many messages in a free web-based mail account that I want to
>back up. The problem: the server is very slow (& the banner ads don't
>make it any faster). It will be quite painful to use a browser to
>retrieve and save/forward the messages one by one.
How many messages? Sure, you could do it with LWP, but tweaking it to
work just like you want it to may take longer than doing it by hand,
unless "many" means "at least several hundreds of".
If the banner ads etc. are slowing things down, why not try turning off
image loading in your browser?
Of course, if you want to do this with a script because you *like* doing
it that way, then have fun. Just don't expect it to be the fastest way.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Sun, 25 Mar 2001 07:13:43 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help with syntax error
Message-Id: <x78zlu1ftk.fsf@home.sysarch.com>
>>>>> "n" == newuser <newuser@nospam.slip.net> writes:
n> I am trying to add a command to last line of my close mail in my
n> new sub routine but everytime I run the cgi I get a sytax
n> error. Can someone help me out and tell me what is wrong and how to
n> correct it.
you should always post the error message so we can see it.
n> print MAIL "From: $host\n";
did you know you can print more than one thing to a handle?
did you know you can print this entire email with one here doc?
<snip of multiple prints>
n> if ($followup == 1) && ($origemail) && ($FORM{'reply_to') eq 'yes') {
n> mailerposter($num);
n> }
have you studied perlsyn at all? an if statement takes a conditional in
(). that conditional can be as complex as you want but it all has to be
inside the top level () of the if. does that help?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 25 Mar 2001 07:22:44 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Help with syntax error
Message-Id: <x766gy1fei.fsf@home.sysarch.com>
>>>>> "n" == newuser <newuser@nospam.slip.net> writes:
n> Sorry for the double post I think my news server is going a little crazy.
n> newuser wrote in message ...
so WHY did you quote your own post for a THIRD time?
<snip of stupid quote of his own post>
i can forgive an accidental double posting, but not apologizing for that
and NOT editing your own quote is STUPID.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 25 Mar 2001 14:41:29 GMT
From: bogus@erol.com (---Pete---)
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <3abe038a.104390085@news.earthlink.net>
Ok, everyone I'm here to summarize and report how I made out.
First off, below is the list of books that people in the
PERL & PERL/CGI newsgroups recommended.
** = Books I had opportunity to review.
* = Books I did not review/not available at local bookstore.
PERL BOOKS:
** "Mastering Perl 5"
** "Programming Perl 3rd Edition" by Wall, Christiansen, Orwant
** Camel book by Wall (NOTE: Suspect this is the same as above)
** "Network Programming with Perl", by Dr. Lincoln Stein, PhD, MD
* "Object Oriented Perl" Damian Conway (Manning)
* "Elements of Programming with Perl" Andrew Johnson (Manning)
* "Effective Perl Programming" Joseph Hall (Addison-Wesley)
* "Perl: The Programmer's Companion" Chapman (John Wiley & Sons)
* "Effective Perl Programming" by Joseph N. Hall
PERL/CGI BOOKS:
** "Official Guide to Programming with CGI.pm" by Lincoln Stein
** "CGI Programming with Perl" by O'Reilly
** "CGI Programming on the WWW" by Shishir Gundavaram
Ok, after several hours of careful review, I purchased these 2 books:
1.) "Programming Perl 3rd Edition" an O'Reily book -
by Wall, Christiansen, Orwant
2.) "CGI Programming with Perl 2nd edition" an O'Reilly book -
by Guelich, Gundavaram, Birznieks
Thanks everyone for your recommendations on what
PERL/CGI books to purchase; it helped a lot!
PS: Save this posting for the next one who
asks the same question <grin>.
---pete---
------------------------------
Date: Sun, 25 Mar 2001 09:12:16 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Hmmm... Which PERL Book Is Best Suited For This???
Message-Id: <U8ov6.2080$oI5.1945@newsfeed.slurp.net>
---Pete--- <bogus@erol.com> wrote in message
news:3abe038a.104390085@news.earthlink.net...
>
> PS: Save this posting for the next one who
> asks the same question <grin>.
http://www.perl.com/reference/query.cgi?books
would you believe this link addresses this question, with notes by a person
who might know a little about Perl books?
------------------------------
Date: Sun, 25 Mar 2001 09:41:49 +0100
From: "Chris Thompson" <waverley2000@hotmail.com>
Subject: How to post to a newsgroup from a script?
Message-Id: <985509659.29220.0.nnrp-02.c1ed3545@news.demon.co.uk>
Hi! I am currently trying to build a script which will post details of job
vacancies to relevant jobs newsgroups. I have a suspicion a newsgroup
posting could be done using the Net::NNTP module, but despite my best
efforts I haven't been able to get this to work.
Any advice or examples of similar scripts would be much appreciated.
Chris Thompson
http://www.waverley-internet.co.uk
------------------------------
Date: Sun, 25 Mar 2001 05:25:07 GMT
From: crvmp3@hotmail.com (Mark Johnson)
Subject: Problem running 'traceroute' command from perl script.
Message-Id: <906F74A86markjohnsononfiberco@24.28.95.186>
When I try to run the following perl script I get the following error:
traceroute: icmp socket: Operation not permitted
I figure this has to do with permissions since traceroute is only usable by
root. How can I adjust it so the web server can run the command?
this is the script:
#!/usr/bin/perl
use CGI;
$|=1;
$q = new CGI;
print $q->header();
print $q->start_html(-title=>'Penguin TraceRoute v1.0',
-author=>'asbjorn@linux-directory.com',
-BGCOLOR=>'#806dfb');
$host = $q->param('host');
print $q->h3("<font color=#ffffe8>Taceroute to $host</font>");
print "<font color=#ffffe8><b>";
open(TR,"./traceroute $host 2>&1|") || die "Error";
while(<TR>) {
if ( $_ !~ /interface/i ) {
print;
print "<br>";
}
}
print "</font></b>";
print "<p><a href=/trace.shtml><font color=#ffffeb><b>Back</b></font></a>";
dd
~
------------------------------
Date: Sun, 25 Mar 2001 12:21:02 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <slrn9brole.eqc.garry@zfw.zvolve.net>
On Sun, 25 Mar 2001 05:25:07 GMT, Mark Johnson <crvmp3@hotmail.com> wrote:
> When I try to run the following perl script I get the following error:
>
> traceroute: icmp socket: Operation not permitted
The ICMP protocol cannot be used by a non-privileged user on most
operating systems.
> I figure this has to do with permissions since traceroute is only
> usable by root.
Yes, it's the ICMP protocol that traceroute uses.
> How can I adjust it so the web server can run the command?
Most traceroute programs are intended to be installed as setuid root.
Unless you have root access, you cannot do what you want, unless...
> this is the script:
[snip]
> open(TR,"./traceroute $host 2>&1|") || die "Error";
It looks like you have copied the traceroute program to your
directory. If it's already installed correctly on the system, run it
from that location and all will be well. From a command prompt, do
"which traceroute" to get the full path to use.
--
Garry Williams
------------------------------
Date: Sun, 25 Mar 2001 13:19:20 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Problem running 'traceroute' command from perl script.
Message-Id: <slrn9brs2o.i8b.abigail@tsathoggua.rlyeh.net>
Garry Williams (garry@ifr.zvolve.net) wrote on MMDCCLXIII September
MCMXCIII in <URL:news:slrn9brole.eqc.garry@zfw.zvolve.net>:
``
`` It looks like you have copied the traceroute program to your
`` directory. If it's already installed correctly on the system, run it
`` from that location and all will be well. From a command prompt, do
`` "which traceroute" to get the full path to use.
That doesn't always help you. /sbin, /usr/sbin, and /usr/local/sbin
are common places you find traceroute in, and uncommon entries for
a default PATH.
Abigail
--
@_=map{[$!++,$_^$/]}split$²,"\@\x7Fy~*kde~box*Zoxf*Bkiaox";$\="\r";
$|=++$*;do{($#,$=)=(rand@_,rand@_);@_[$#,$=]=@_[$=,$#]}for($*..@_);
for$:($|..@_-$|){for($|..@_-$:){@_[$_-$|,$_]=@_[$_=>$_-$*]if$_[$_][
$¼]<$_[$_-$*][$®];print+map{$_->[$|]}@_;select$·,$°,$½,0.1}}print$/
------------------------------
Date: Sun, 25 Mar 2001 06:32:46 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: putting code online
Message-Id: <iigv6.36653$Q47.10254458@news1.rdc1.tn.home.com>
I making a resume site of all the code I've written, and I was wondering
what the best way is to show a block of code, and make sure everyone sees it
in his or her browser correctly. The problem is that some of the code has
html in it, and I don't want the code to be interpreted as html by their
browser. I was going to put this in the html newsgroup, but I thought those
people would know what I was talking about, and you guys have probably done
this before.
Thanks!
Todd Smith
------------------------------
Date: Sun, 25 Mar 2001 09:17:46 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: putting code online
Message-Id: <_Iiv6.36991$Q47.10339535@news1.rdc1.tn.home.com>
i meant "those people would NOT know what I was talking about"
"Todd Smith" <todd@designsouth.net> wrote in message
news:iigv6.36653$Q47.10254458@news1.rdc1.tn.home.com...
> I making a resume site of all the code I've written, and I was wondering
> what the best way is to show a block of code, and make sure everyone sees
it
> in his or her browser correctly. The problem is that some of the code has
> html in it, and I don't want the code to be interpreted as html by their
> browser. I was going to put this in the html newsgroup, but I thought
those
> people would know what I was talking about, and you guys have probably
done
> this before.
>
> Thanks!
>
> Todd Smith
>
>
>
>
------------------------------
Date: 25 Mar 2001 10:52:14 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: putting code online
Message-Id: <99kiku$1ffj9$1@fu-berlin.de>
hi,
Todd Smith <todd@designsouth.net> wrote:
> I making a resume site of all the code I've written, and I was wondering
> what the best way is to show a block of code, and make sure everyone sees it
> in his or her browser correctly. The problem is that some of the code has
> html in it, and I don't want the code to be interpreted as html by their
> browser. I was going to put this in the html newsgroup, but I thought those
> people would know what I was talking about, and you guys have probably done
> this before.
well, either send a plain/text header or say:
print '<pre>', CGI:escape $code, '</pre>';
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Sun, 25 Mar 2001 13:53:18 GMT
From: "Daniel Berger" <djberg96@hotmail.com>
Subject: Re: require'ing OO modules on the fly - any danger?
Message-Id: <iLmv6.3968$pS2.192874@typhoon.mn.mediaone.net>
<previous text snipped - see original post>
> Wouldn't it be preferable to do $mod = "AllowedModules::" . $1; for even
> more security?
Good point. I will adopt that.
> >
> > # From here to end of loop - is this bad code?
> > eval "require $mod";
>
> I'm not sure, but is it possible to do either just require $mod (with no
> eval), or perhaps eval { require $mod }; (with braces, not quotes?)
I'll need to look up the difference between eval "something" vs eval{
something }. I honestly don't know the difference off the top of my head.
Bad programmer....
> > die if $@;
> > #$mod->import; # No import needed - we're assuming an OO module
> > $mod->new; # Create object
>
> It creates an object, but what do you do with it? ie, shouldn't it be
> $moduleinstance = $mod->new;
>
> > $mod->interact; # Do stuff
>
> And this would be $moduleinstance->interact;
>
> Of course, you could combine the above two: $mod->new->interact;
Er, that's what I meant. :)
> Also, shouldn't you pass $clientSock as a parameter to interact or new?
> Otherwise, how would it write back to the client?
Ok, yes you would. Consider the example code incomplete.
> Sounds too flexible. Suppose someone tries to connect as a client, and
> does a request for a module he knows is broken/buggy, or which does
> dangerous things in it's new subroutine?
> You should restrict it to only those subroutines which are in a
> particular subdirectory, and who have a particular prefix.
Point taken, though I think that in order to pull off anything particularly
damaging, they would have to have access to the system, know in advance
which modules were installed and take advantage of it. To me that means
that there is already a security breach, though I suppose I can do my bit to
help. Perhaps even changing the "new" method to something else would be a
good idea, since most modules use that as a constructor.
> Without putting a tighter restriction on what modules are available to
> clients, it is dangerously unsafe, and the doom and gloom warnings are
> perfectly valid. If you are very careful, so that only those modules
> designed to work with this setup will be used, then it might be safe.
Thanks for your input - much appreciated!
> --
> The difference between theory and practice is that in theory, theory and
> practice are identical, but in practice, they are not.
Great sig line - I laughed out loud on this one!
Sincerely,
Dan
------------------------------
Date: Sun, 25 Mar 2001 15:40:06 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Script mysteriously erases file it's supposed to append to
Message-Id: <3abe1156.2d11$75@news.op.net>
Keywords: Pitt, craftsperson, fantod, paperback
In article <3ABD5B3F.AF54B612@earthlink.net>,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>nobull@mail.com wrote:
>> It should be noted that what Bernie (and the flock() manapage) is
>> presenting here is a work-round for an OS bug. On the OP's code would
>> work properly because O_APPEND is properly implemented.
>
>Not necessarily.
> [much yak yak snipped]
Did you try it? Apparently not. It seems that you didn't read the
article to which you were responding. either.
OK, let's run through this one more time for the people who weren't
paying attention:
On most Unix system,s including all modern Unix systems, opening with
O_APPEND (which ">> file" in Perl does do) implies special writing
semantics. If the handle was opened with O_APPEND, then the OS
effectively does the seek to the end of the file immediately before
*every* write, automatically.
If the file gets longer after the lock, the OS will automatically seek
to the new end before it writes. If the file gets shorter after the
lock, the OS will automatically seek to the new end before it writes.
Now, some versions of Unix do not have this semantics, and perhaps
other OSes don't do this. The programmer might want to put in the
explicit call to seek(), but leaving it out is not necessarily an
error, because the programmer might now that the OS will take care of
it automatically.
>Here's an pseudocode example which might demonstrate what the seek is
>there for.
Pseudocode is nice, but realcode is better. Try this:
#!/usr/bin/perl
open STDOUT, ">> /tmp/Z" or die;
$| = 1;
print STDOUT "BLAH BLAH BLAH This will ALL be erased by the truncate().\n" or die;
# The STDOUT handle is now positioned far into the file
open Z2, "+< /tmp/Z" or die;
truncate Z2, 0 or die;
close Z2 or die;
print STDOUT "Foo!\n" or die;
close STDOUT or die;
print STDERR "Now look in Z and what do you see? Where is the 'Foo!'?\n"
>The difference between theory and practice is that in theory, theory and
>practice are identical, but in practice, they are not.
How ironic. Perhaps you should meditate on what this actually means.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: 25 Mar 2001 09:50:39 GMT
From: cljlk@hotmail.com (cljlk)
Subject: Re: the space
Message-Id: <99kf1f$h8e$1@bob.news.rcn.net>
thanks, the perl man pages are really handy.
In article <slrn9bqo1o.ugg.mgjv@martien.heliotrope.home>,
mgjv@tradingpost.com.au says...
>
>On 25 Mar 2001 00:40:44 GMT,
> cljlk <cljlk@hotmail.com> wrote:
>>
>> $line = "xx yy a bb cc";
>>
>> ($xx,$yy,$a,$bb,$cc) = split(/ /,$line);
>> ^
>> |
>> How to handle this white space?
>
>If you want to split on multiple spaces, real spaces, use
>
>split / +/, $line;
>
>The first argument to split is always, yes, always, a regular
>expression, except in one special case. That special case is when the
>first argument is ' ', in which case it will split on any amount of
>whitespace:
>
>split ' ', $line;
>
>and whitespace includes tabs and such. The above is more or less
>equivalent to
>
>split /\s+/, $line;
>
>The single space will remove leading and trailing empty fields, while
>the /\s+/ will not.
>
>All of this is in the documentation for split() in perlfunc, and the
>documentation for regular expressions in perlre. Please, take this
>opportunity to read them.
>
>$ perldoc perlfunc
>$ perldoc -f split
>$ perldoc perlre
>
>$ perldoc perldoc
>$ perldoc perl
>
>Martien
>--
>Martien Verbruggen |
>Interactive Media Division | Think of the average person. Half of
>Commercial Dynamics Pty. Ltd. | the people out there are dumber.
>NSW, Australia |
------------------------------
Date: Sun, 25 Mar 2001 13:22:07 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: the space
Message-Id: <slrn9brs7v.i8b.abigail@tsathoggua.rlyeh.net>
Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCLXIII
September MCMXCIII in <URL:news:slrn9bqo1o.ugg.mgjv@martien.heliotrope.home>:
``
`` split ' ', $line;
``
`` and whitespace includes tabs and such. The above is more or less
`` equivalent to
``
`` split /\s+/, $line;
``
`` The single space will remove leading and trailing empty fields, while
`` the /\s+/ will not.
/\s+/ will remove trailing empty fields. That is, after all, the default
behaviour of split.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Sun, 25 Mar 2001 00:05:25 -0600
From: Aaron Cline <acline@okstateREMOVECAPS.edu>
Subject: Using Web Frontend to make Config file
Message-Id: <uOgv6.284$Rx.3215@news.onenet.net>
Hello:
I am going to have a perl program that will have a HTML frontend which will
add or change variables of said perl program. How do I include this config
file of variables into any given program? Also, what kind of permissions
are involved. Should the config file be owned by the webserver? What kind
of security issues are involved. If more info is needed, please tell me
what info would be helpful.
Thanks
Aaron Cline
------------------------------
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 V10 Issue 562
**************************************