[6354] in Perl-Users-Digest
Perl-Users Digest, Issue: 976 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 19 22:18:40 1997
Date: Wed, 19 Feb 97 19:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 19 Feb 1997 Volume: 7 Number: 976
Today's topics:
Book excerpts from Effective Perl Programming <joseph@5sigma.com>
Re: Bulletin board in CGI/perl (David Richards)
compiling Perl on HPUX 9.x <"ben "@fshelby.chem.uidaho.edu>
Re: debugging perl & html (Andrew M. Langmead)
Dynaloader in PERL5 Win32 (does it work, or doesn't it) <ggl@qad.com>
failure of find.pl under root, where find works <drk@rpisun1.mdacc.tmc.edu>
Re: flock(2) Question <rootbeer@teleport.com>
Re: Get filename from variable-length path? (Carl Payne)
Re: Help:# Can't find string terminator "ending_print_t <nmljn@wombat.staff.ichange.com>
Re: How do you write to seperate frames? (Robert Gordon)
How to become a member ......? <baskaran@isi.com>
Re: How to convert tab delimited file to space delimite (Tad McClellan)
Re: html -> text (Tad McClellan)
Re: html -> text <merlyn@stonehenge.com>
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 19 Feb 1997 14:21:45 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Book excerpts from Effective Perl Programming
Message-Id: <330B6EE8.35DC@5sigma.com>
(Boy, this is a lot of work! %-})
Just added the 27 pp. chapter on Debugging.
http://www.5sigma.com/perl/book.html
As always, comments (good or bad) are welcome!
-joseph
--
Joseph N. Hall http://www.5sigma.com/joseph/ mailto:joseph@5sigma.com
Proprietor, 5 Sigma Productions P.O. Box 6250 Chandler AZ 85246
Perl training & software, C++/C/etc. software, web stuff, original music
*Effective Perl (A-W Spring '97) .. http://www.5sigma.com/perl/book.html
*Perl resources & instruction .............. http://www.5sigma.com/perl/
*Exploding groceries ................ http://www.5sigma.com/joseph/inan/
------------------------------
Date: 20 Feb 1997 00:02:27 GMT
From: dr@ripco.com (David Richards)
Subject: Re: Bulletin board in CGI/perl
Message-Id: <5eg4aj$doc$1@gail.ripco.com>
In article <Pine.OSF.3.95.970219111707.22829B-100000@uranus.ebi.ac.uk>,
Jean-Jack Riethoven <pow@embl-ebi.ac.uk> wrote:
>On Tue, 18 Feb 1997, Hongyu Zhang wrote:
>
>> I am going to creat a WWW bulletin board for our group, which, as I
>> know, in most cases is implemented in CGI/perl. Not to reinvent the
>> wheel, I'll be grateful to get your guys' help on the relevant
>> text/code.
>
>Check out the WWWBoard scripts from Matt Wright. You can find them at
>http://worldwidemart.com/scripts/
Or look at 'hypernews', a bit harder to install, but a lot more powerful:
http://union.ncsa.uiuc.edu/HyperNews/get/hypernews.html
--
David Richards Ripco, since Nineteen-Eighty-Three
My opinions are my own, Public Access in Chicago
But they are available for rental Shell/SLIP/PPP/UUCP/ISDN/Leased
dr@ripco.com (773) 665-0065 !Free Usenet/E-Mail!
------------------------------
Date: Wed, 19 Feb 1997 15:45:47 -0800
From: Ben Pressnall <"ben "@fshelby.chem.uidaho.edu>
Subject: compiling Perl on HPUX 9.x
Message-Id: <330B90AB.392E@fshelby.chem.uidaho.edu>
can anyone help me compile Perl on a HPUX 9.X system?
Thanks,
--
Ben Pressnall
University of Idaho
Chemistry Dept.
(208)885-7093 pressnal@uidaho.edu
------------------------------
Date: Wed, 19 Feb 1997 23:02:32 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: debugging perl & html
Message-Id: <E5vHC9.4F4@world.std.com>
cutt@netcom.com (Paul S. Cutt) writes:
>I wonder what people are using to debug perl scripts when called from an
>html page ? I know about perl debugger but this is run from the command
>line. If my html page calls my perl script how can I get the debugger at
>that point to execute so I can continue debugging ?
Although my CGI development experience is limited, I do have an idea
to share. If you use CGI.pm (or hack away at some nonsense to allow
easy input of paramters), and just want to be able to judge the
results easily, you could add something like this to your .perldb
initialization file:
$scratchfile = "/usr/tmp/aml/debug.out.html";
BEGIN{open STDOUT, "|tee $scratchfile" or die "Can't tee STDOUT\n"; }
END { system "lynx $scratchfile" }
After each run of the script, the browser shows the output of the
script.
--
Andrew Langmead
------------------------------
Date: Wed, 19 Feb 1997 14:05:59 -0800
From: Gail Long <ggl@qad.com>
Subject: Dynaloader in PERL5 Win32 (does it work, or doesn't it)
Message-Id: <330B7947.7910@qad.com>
I use perl on unix quite a bit. I'm having to port some of my scripts to
NT. I have build 110 of perl5 for NT. The faq says that dynaloader is
not supported, but all of the examples I have seen seem to require it
(the registry routines). None of the attempts I've made at nt scripting
to change the registry seem to work because of this limitation. Based
on the examples, I going to conclude that I'm doing something wrong.
--
###############################################################
Things are only difficult while you don't understand them.
Hang in there.
------------------------------
Date: Wed, 19 Feb 1997 15:18:03 -0600
From: Darrell Kachilla <drk@rpisun1.mdacc.tmc.edu>
Subject: failure of find.pl under root, where find works
Message-Id: <330B6E0A.1838@rpisun1.mdacc.tmc.edu>
hi
a peculiar problem on root account with find.pl:
find /home/recon -newer /var/adm/backupdate -print
works when executed as user or root
but
script generated by
find2perl /home/recon -newer /var/adm/backupdate -print
works under user
fails under root
????!!!!?????
i've tried with the user environment set under root, but that's not it.
OTHER INFO:
/home/recon is a nfs mounted filesystem
sunos 4.1.3u
perl 5
-----------------------------------
current fix is
$cmd = "find $dir -newer /var/adm/backupdate -print";
open(FIND,"$cmd |")||die "*****can not execute FIND\n";
and then scan the resulting text
but why does the standard
&find --> sub wanted
process for nfs fail ONLY FOR ROOT account???
and what can i do about it???
--
------------------------------------------------------------------------
Darrell Kachilla - working but not speaking for...
M.D. Anderson Cancer Center, Diagnostic Imaging -57
1515 Holcombe Blvd., Houston, Tx 77030
drk@rpisun1.mdacc.tmc.edu W: 713-745-2361 FAX: 713-745-0581
http://recon.mda.uth.tmc.edu
------------------------------
Date: Wed, 19 Feb 1997 18:34:49 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Boekhout <boekhout@azww.com>
Subject: Re: flock(2) Question
Message-Id: <Pine.GSO.3.95q.970219183218.18400H-100000@kelly.teleport.com>
On Wed, 19 Feb 1997, John Boekhout wrote:
> open(HANDLE,$path);
> if (!flock(HANDLE,2) { #get exclusive lock
> &error("couldn't get lock");
> }
> (I'm very certain that open file call was successful.)
I'm not so certain as you are. :-) Even if you're sure it worked, you
should always check for error returns from open before you post to the
newsgroup, if not sooner. (Also, I believe that most systems only let you
lock a file which you have open for output, since there's not much point
in locking if you can't change the file.) Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 19 Feb 1997 15:17:25 -0700
From: cpayne@xmission.xmission.com (Carl Payne)
Subject: Re: Get filename from variable-length path?
Message-Id: <5efu5l$scj@xmission.xmission.com>
nelson <nmljn@wombat.staff.ichange.com> wrote:
> use File::Basename "basename";
> ...which would solve the problem without reinventing the wheel. :-)
This works great; wish it were in my book. Thanks a million.
Carl
------------------------------
Date: 19 Feb 1997 19:11:18 -0500
From: nelson <nmljn@wombat.staff.ichange.com>
Subject: Re: Help:# Can't find string terminator "ending_print_tag" anywhere before EOF.
Message-Id: <w10ohdg9w0p.fsf@wombat.staff.ichange.com>
tadmc@flash.net (Tad McClellan) writes:
(Hi, Tad et al. Thought I'd give a bit of help to this newbie. I followed
up to your message because you explain here documents, which I thought
was useful. But this followup is really to the original poster,
<colvin@aloha.net>.)
> Keith Warner Colvin (colvin@aloha.net) wrote:
> : Aloha from Hawaii,
Lucky. :-)
> : I am trying to write my first .cgi:
(Note that CGI stands for Common Gateway Interface, which is not a (a)
programming language, (b) file type, or (c) any combination thereof.
Strictly speaking, one does not write *a* CGI, but a CGI-compliant
program. Okay, that latter one is 'cause I'm hopelessly uptight. You
can write a CGI program. But you cannot write a CGI, unless you're
the good folks at NCSA. :-))
You've got several problems with your program, which I correct below.
> : #! /usr/local/bin/perl
1. Oopsie. You didn't use the warning switch. Always open your perl
programs--CGI-compliant and otherwise--with the -w switch:
#!/usr/local/bin/perl -w
You can be really uptight (like me) and open all your perl programs
also by saying:
#!/usr/local/bin/perl -w
use strict; # turns on some cool uptight warnings
use diagnostics; # turns on some kinda helpful error explanations
Get in the habit now and you'll thank yourself later.
> : print "Content-type: text/html/n/n";
2. Erm, you mean backslash-n for a newline:
print "Content-type: text/html\n\n";
> : print <<"ending_print_tag";
> : <html>
> : <head>
> : <title>The First CGI</title>
> : <background="000000" text="#FF0000" >
> : </head>
> : <body>
3-4. Oook. Study your HTML. HEAD elements contain only TITLE, META, LINK
and BASE elements. What you mean is:
<HEAD>
<TITLE>The Output of My Second CGI-compliant Program</TITLE>
</HEAD>
<BODY BGCOLOR="#000000" TEXT="#FF000000">
> : <h1> My First CGI</h1>
> : <i> HELLO INTERNET</i>
> : <hr noshade>
> : Items of importance go here.....
> : <body>
5. Forgot to end your body tag:
</BODY>
> : </html>
> : ending_print_tag>>
> : and I get this response when I run the script:
> : # Can't find string terminator "ending_print_tag" anywhere before EOF.
> : What do I do next?
> ^^^^^^^^^^^^^^^^^
> You remove the >> ;-)
What he said. :-) That is, "here" documents--i.e. blocks of text
denoted with a "<<TOKEN" notation--don't have a "closing" character.
So you just say something like this (my code is indented for clarity
only):
print <<EOF; # note the semicolon!
Hi there. This is all data in the program.
It will be printed out verbatim, just as I
have it here.
EOF
# note: no semicolon after EOF!
So when you say "print <<EOF", you are saying something like "Print
the value of the stuff following this line until you encounter an EOF
as the first and only thing on its line." NOT "until you encounter an
EOF>> as the first and only thing on its line." Whatever you put
after the "<<" is the token name/character(s); if it appears later on
on a line by itself, where it's the first name/character(s) on that
line, then at that point the string--all the stuff in between--will be
terminated, and fed to the print operator. So in your code above, you
said (the '> :' sequence is the newsreader quoting):
> : print <<"ending_print_tag";
...and then the token "ending_print_tag" never showed up as the one
and only bit of text on a line by itself, so the error message you got
back was:
> : # Can't find string terminator "ending_print_tag" anywhere before EOF.
...because the string terminator, well, couldn't be found before the
perl compiler "ran off" the end of your source file.
You sound like you haven't read the manpages, available either from my
consolidated reference page (see my .sig) or from
http://www.perl.com/perl. You also sound like you could use a good
study of some HTML. If you've got Netscape Navigator, choose How To
Create Web Services from its Help menu and read up.
Cheers,
Laird
--
<laird.nelson@netsinc.com> perl FAQ: http://www.perl.com/perl/faq Perl manual:
http://www.perl.com/CPAN/doc/manual/html/frames.html. If CGI/web appears in
your comp.lang.perl.* post, see news:comp.infosystems.www.authoring.cgi. CGI
stands for Common Gateway *Interface*, not Language or Program or Script.
Consolidated perl reference page: http://www.amherst.edu/~ljnelson/perl.html
------------------------------
Date: Wed, 19 Feb 1997 22:38:38 GMT
From: rgordon@acpub.duke.edu (Robert Gordon)
Subject: Re: How do you write to seperate frames?
Message-Id: <330b7f59.32362214@news.duke.edu>
On Sat, 15 Feb 1997 14:53:20 GMT, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:
>On Tue, 11 Feb 1997, Joel D. Martinsen wrote:
>
>> I have a program that outputs some formated data from a database. I
>> want to know how I can send the output to a seperate frame in the
>> netscape window that the frame the cgi script was called from.
>
>Well, you'll do it by generating some HTML (strictly I should say NHTML)
>from your Perl script. This question is asked in one form or another
>about twice a day in the HTML authoring group, which is the most
>appropriate place for asking it. An answer can be found in the WDG's
>draft Frames FAQ, at http://www.htmlhelp.com/design/frames/faq/
>
>It always puzzles me why people think that when they use Perl to
>write HTML, they would have to ask their HTML questions in a Perl
>programming group.
>
>
I don't think this is strictly an HTML problem. I have been doing
static frames with no problem. I've recently tried to generate frames
from an Oracle Web Agent script (CGI-compliant and I assume a similar
thing in PERL/CGI) I have a procedure (PL/SQL script) that defines
the framesets and identifies the sources as other scripts that
dynamically generate the header, body and footer frames.
Unfortunately, only the header frame is displayed when I link to the
script defining the framesets.
I don't know if it is a Netscape browser limitation, a CGI limitation
or an Oracle Web Agent limitation that prevents the full frameset from
displaying - but it is NOT purely an HTML problem.
------------------------------
Date: Wed, 19 Feb 1997 15:15:12 -0800
From: Baskaran Tranquebar <baskaran@isi.com>
Subject: How to become a member ......?
Message-Id: <330B897F.41C67EA6@isi.com>
Hi ..
I would like to enroll myself in this news group. May I ask for your
advise in how should I do that?.
Thanks in advance.
Baskaran Tranquebar.
------------------------------
Date: Wed, 19 Feb 1997 15:22:26 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to convert tab delimited file to space delimited file
Message-Id: <iuqfe5.te3.ln@localhost>
Jack L. Owens (jlowens@ptconnect.infi.net) wrote:
: I have several tab delimited ASCII files that I need to convert to fixed
: length space delimited fields. Some of the fields consist of multiple
: words. Is there an easy way to do this using Perl?
@fields = split /\t/, $_;
printf("%-10s%-20s%20s%20s\n", @parts); # season to taste
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Wed, 19 Feb 1997 15:00:26 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: html -> text
Message-Id: <alpfe5.ua3.ln@localhost>
Dataweaver (traveler@io.com) wrote:
: Please email a copy of any responses to me.
: I am attempting to write a perl script that converts an html document into
: a plain-text document; I intend to do more than just strip out the tags;
: for example, i am using s/<hr\s*>/-----/i in the script.
: My two biggest problems right now have to do with the text layout; how
: would I tell the script to insert \n's after every seventy-ninth character
: in a line, and how would I go about formatting tables so that they're
: readable?
If this were _my_ task to do, then I would use 'lynx -dump',
and then process the output of _that_.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 19 Feb 1997 18:43:43 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: traveler@io.com
Subject: Re: html -> text
Message-Id: <8cvi7oxne8.fsf@gadget.cscaper.com>
>>>>> "Dataweaver" == Dataweaver <traveler@io.com> writes:
Dataweaver> Please email a copy of any responses to me. I am
Dataweaver> attempting to write a perl script that converts an html
Dataweaver> document into a plain-text document; I intend to do more
Dataweaver> than just strip out the tags; for example, i am using
Dataweaver> s/<hr\s*>/-----/i in the script.
Here's the guts of the "GET" command, distributed with LWP:
use LWP::Simple;
use HTML::TreeBuilder;
use HTML::FormatText;
$html = get "http://www.stonehenge.com/merlyn/";
$parsed = HTML::TreeBuilder->new->parse($html);
print HTML::FormatText->new->format($parsed);
$parsed->delete;
LWP is your friend. Use LWP.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 558 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 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.
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 V7 Issue 976
*************************************