[8014] in Perl-Users-Digest
Perl-Users Digest, Issue: 1640 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 14 17:07:25 1998
Date: Wed, 14 Jan 98 14:01:34 -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, 14 Jan 1998 Volume: 8 Number: 1640
Today's topics:
Perl running under Linus - #!/bin/usr grsshpper@feedME
Re: Perl running under Linus - #!/bin/usr (brian d foy)
Re: Perl Script Not Receiving Parameters (brian d foy)
Re: Perl to Binary? (brian d foy)
Re: Problem calling a cgi from cgi (brian d foy)
Re: Query on Uncaught Exception (Mick Farmer)
Questions about Win32::Shortcut (Steve Riddle)
Reloading to cause form to function (Emery Szasz)
Re: simple Perl question <joseph@5sigma.com>
Re: Sorting a textfile (Tad McClellan)
Speaking of Looping through hashes... (Kenneth Herron)
Re: Syntax coloring for POD format <jay@rgrs.com>
Re: Testing for valid numeric values (brian d foy)
Re: truncating <gold@media-network.com>
using htpasswd from within a perl program (S.B.)
Re: using htpasswd from within a perl program (brian d foy)
Re: Webmasters???? (brian d foy)
Re: Would this code be right (brian d foy)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Jan 98 21:28:05 GMT
From: grsshpper@feedME
Subject: Perl running under Linus - #!/bin/usr
Message-Id: <34bd2de5.0@lightning.ica.net>
I have a question that relates to Perl running under Linux.
As I understand things, the first line in a perl program
in Linux should be #!/bin/usr/perl so that when the perl
script is called, Linux knows it has to direct the lines
following to the perl program at /bin/usr
If this setup is functioning correctly, then if I have a
perl script called say "testpl.pl" for example, then all
I have to do is type in testpl.pl at the prompt, and the
perl program at /bin/usr will execute it.
The only problem is... it's not working, at least not on
my Linux system. Please note that I CAN execute perl
programs by typing perl testpl.pl
However shouldn't I be able to execute scripts without
specifically invoking perl ?
Note that I do have the location /usr/bin on my $PATH
variable, so the system should be able to find perl.
In fact it DOES find it because perl testpl.pl works ...
Am I wrong about the effect of the #!/bin/usr/perl
statement ?
Is there a setting in my profile or somewhere else I
should add or change ? or is there something else I am
doing wrong ?
regards,
Bernard Doyle
------------------------------------------------------------------
Hungry for NEWSGROUPS??? USE feedME.ORG
Read and Post to 30,000 groups through feedME.ORG
FREE FREE FREE http://www.feedME.ORG FREE FREE FREE
------------------------------------------------------------------
------------------------------
Date: Wed, 14 Jan 1998 16:49:56 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl running under Linus - #!/bin/usr
Message-Id: <comdog-ya02408000R1401981649560001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34bd2de5.0@lightning.ica.net>, grsshpper@feedME posted:
>As I understand things, the first line in a perl program
>in Linux should be #!/bin/usr/perl so that when the perl
>script is called, Linux knows it has to direct the lines
>following to the perl program at /bin/usr
the shebang line should be the path to the perl interpreter,
which is not required to be in any particular spot. however,
it's often something like
/usr/bin/perl
/usr/local/bin/perl
make sure that you have the correct path. for instance, you could
try
/path/to/perl -v
to get the version of the interpreter. if you get something like
"command not found", you don't have the right path. your shell
might have utilities for searching your path for executables as well.
good luck :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:10:27 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl Script Not Receiving Parameters
Message-Id: <comdog-ya02408000R1401981610270001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BCFB3F.2C2F1B0B@ipa.net>, Shane Hill <shill@ipa.net> posted:
>I am using Windows NT with IIS 3.0. Somehow my HTML form is not passing
>my PERL script values. I can for example type in the URL in IE 3.0 bar:
>
>http://local_host/cgi-bin/db_search.pl?setup_file=poretrieve.setup&submit_value=yes&custno=1045
sounds like a problem before it ever gets to CGI. since that would
have nothing to do with Perl, you might get a better response in an
HTML or CGI newsgroup.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:37:14 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Perl to Binary?
Message-Id: <comdog-ya02408000R1401981637140001@news.panix.com>
Keywords: from just another new york perl hacker
In article <8cwwg37xhe.fsf@gadget.cscaper.com>, Randal Schwartz <merlyn@stonehenge.com> posted:
>>>>>> "John" == John Porter <jdporter@min.net> writes:
>
>John> J. Bacon wrote:
>>>
>>> ... merlyn@stonehenge.com is (as
>>> near as I can determine) COMPLETELY correct ...
>
>John> Heh heh. I tend to agree.
>
>Ugh. I don't. There's plenty of evidence for my back-cover bio that
>says "... occasionally INCORRECT spatterings on Usenet...".
perhaps you can add an X-header to those so we can filter them? ;)
perhaps it's time for a newsreader with a perl interpreter built
in.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:20:00 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem calling a cgi from cgi
Message-Id: <comdog-ya02408000R1401981620000001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34B9F527.164C9850@dereligion.com>, Maxwell Smart <dereligion@dereligion.com> posted:
> I have a cgi generated from an user consult sent in the url, the the
>page in the screen have many word tha have to b linked with other cgi. I
>tried to do using the next
>
> <a href="04.cgi">$A,</a>
>
> where $A is the word that have to be linked with the next cgi that
>will present mor info about the word.
>
> Well my dear friends, this is my problem, I really need your help so
>I4ll be waiting for you... Thanks
what goes wrong? with which part are you stuck?
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 17:58:19 GMT
From: mick@picus.dcs.bbk.ac.uk (Mick Farmer)
Subject: Re: Query on Uncaught Exception
Message-Id: <EMsCL7.LIv@mail2.ccs.bbk.ac.uk>
Dear Simon,
Where have you caught an exception? You've supplied a
switch, not an argument.
Regards,
Mick
------------------------------
Date: Wed, 14 Jan 1998 14:06:29 GMT
From: Steve.Riddle@NetSpace.Bentley.com (Steve Riddle)
Subject: Questions about Win32::Shortcut
Message-Id: <34bcc453.399941455@news.integrityonline2.com>
I just installed the Win32::Shortcut object and it should be quite
useful in creating and maintaining shortcuts in NT4.0 and Windows95. I
am having some problems with a couple of the methods though. In the
test.pl script and also in the ln32.bat sample, the Path() method does
not work if the full path is not included. The sample script creates a
dummy file and creates a shortcut to it using only the "dummy.txt"
path. The resulting shortcut has an empty target. If I put a full
path, it works fine. The Set() method works with only the name but you
must put in all the shortcut properties.
Also, the Resolve() method does not appear to work at all. If the
target is correct, Resolve returns True but if the target is
incorrect, it doesn't appear to try to resolve the displaced file.
I tried this on both NT4.0 and Windows95 with similar results.
--
Steve Riddle
sriddle@HiWAAY.net
- or -
Steve.Riddle@NetSpace.Bentley.com
------------------------------
Date: 14 Jan 1998 20:39:33 GMT
From: emery@adept.wizweb.com (Emery Szasz)
Subject: Reloading to cause form to function
Message-Id: <69j7q5$5te9@mirage.connect.net>
I have a search program in my music theory site which is
written in perl. The programming seems to be correct because it does
give the correct responses. But in my Netscape browser when I enter
info into the form for the pl to search - it gives no response -
often times untill after I reload the page. What is the cause of this
dilema?
This is the form location:
http://www.wizweb.com/~emery/mus-theor/search/search.html
and this is the perl programming:
http://www.wizweb.com/~emery/perl/srch.txt
Please tell me if you get the same effects and what is the solution.
--
The Righteous shall Live by Faith,
-------Emery Szasz
-------------------------------
-----------| A Theory on Open Modality |------------
| http://www.wizweb.com/~emery/mus-theor/home.html |
----| Now with Inter-Related Chords Generator |-----
---------------------------------------------
------------------------------
Date: Wed, 14 Jan 1998 02:20:59 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: simple Perl question
Message-Id: <34BC8366.A25CF234@5sigma.com>
[God, if this is any indication, please don't let too many other
people buy this book.]
Adam, Perl is great for CGI programming, but you should really
be using the CGI module. All you need is a new copy of Perl 5
and a book that talks about the CGI module. Lincoln Stein's
big thick Web site book comes to mind, but I'm sure there are
others.
Also, the best thing that a would-be Perl CGI programmer can do to
improve his scripts is to spend a weekend or two working through
a good Perl book like Learning Perl. There's now a Windows
version available. For more books, see:
http://language.perl.com/critiques/index.html
-joseph
Adam wrote:
>
> Hi All,
> I am new to Perl programming and need some help!
> I am learning from a book by Erik Strom called:
> "Perl-CGI Programming..No Experience Necessary"
>
> When I try to run the program - listed below - I get the error message:
> htmlend.pl did not return a true value at hellowww.pl at line 5
------------------------------
Date: Wed, 14 Jan 1998 11:08:08 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Sorting a textfile
Message-Id: <odri96.2p2.ln@localhost>
Franziskus Geeb (fge@elsamprojekt.dk) wrote:
: I want to sort a textfile on a number, which is on position "two" in
: this ::-sperated textfile:
: xxxxx::number_here::xxxx::xxxxx:: ...
: My idea was to put the textfile in an array with the number in the first
: position; like:
: number_here::xxxxxxx::xxxx::...
: That works fine, but sorting the array causes problems in the sortorder
: which ended like 1 13 2 25 3 4 5 etc.
That _is_ sorted order. It's just sorted "alphabetically" (ASCII order,
really), which is the default behavior for sort().
: Any help/suggestions?
Don't go with the default behavior for sort() if you want it
sorted numerically ;-)
@num_sorted = sort { $a <=> $b } @records; # sort numerically
With a more complicated sort routine you could get them sorted
based on their original "number two" location in the data record too.
There is info about sorting in the Perl FAQ, part 4,
and in the description for sort() in 'perlfunc'.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Jan 1998 20:46:24 GMT
From: kherron@campus.mci.net (Kenneth Herron)
Subject: Speaking of Looping through hashes...
Message-Id: <69j870$lle$1@news.campus.mci.net>
It'd be nice to have a way to iterate over the keys without reading
values as well. I'm talking about something like:
while ($key = eachkey %hash) {
...
}
One could of course do
while ($key = (each %hash)[0]) {
...
}
or
foreach $key (keys %hash) {
...
}
but each of these involves extra work--maybe significantly extra, in
the case of tied hashes: The each version probably still looks up
values, and the keys version takes time and memory to iterate over the
hash at "startup", building a temporary array (which may be tossed out
if you break out of the loop).
--
Kenneth Herron -- kherron@campus.mci.net
No animals were harmed during the production of this message.
------------------------------
Date: 14 Jan 1998 14:45:06 -0500
From: Jay Rogers <jay@rgrs.com>
To: ken@forum.swarthmore.edu (Ken)
Subject: Re: Syntax coloring for POD format
Message-Id: <82n2gyj0vx.fsf@shell2.shore.net>
ken@forum.swarthmore.edu (Ken) writes:
> The change, I guess, amounts to this - anytime BBEdit saw one of
> these pod directives, it would color the following text as a
> fill-style comment:
Well, since you asked for our opinion - I'd argue against coloring POD
text as a comment. Since POD is just plain ole documentation, I'd say
it should be "colored" like plain text.
My own opinion is that too much hi-lighting is hideous.
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Wed, 14 Jan 1998 16:35:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Testing for valid numeric values
Message-Id: <comdog-ya02408000R1401981635090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BCC75B.7E99@min.net>, jdporter@min.net posted:
>Eli the Bearded wrote:
>>
>> No "Brian" participated in this thread. Maybe you meant brian?
>Oh, how precious.
and if i were "cute" as well as precious, i could be a puppy. :)
if the New York Times could print it correctly, let's see if i can
leverage Jon Orwant into doing the same :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 13 Jan 1998 21:05:24 -0800
From: "Christopher D. Goldman" <gold@media-network.com>
Subject: Re: truncating
Message-Id: <34BC4794.8C6691C7@media-network.com>
Tad McClellan wrote:
>
> Aaron C. Paulley (aaronp@weirdness.com) wrote:
> : >
> : >File::Basename module would be best. It will work across different
> : >Operating Systems.
> : >
> : >
> : >To do it non-portably:
> : >
> : > $filename = $1 if m#.*/(.*)$#;
> : >
>
> : So the line:
>
> : $filename = $fullfilename if m#.*/(.*)$#;
>
> : would take the variable $fullfinename which = "/usr/bin/local/filename.txt"
> : and create a new variable ($filename) that would = "filename.txt" ?
>
> No. You want:
>
> $filename = $1 if $fullfilename =~ m#.*/(.*)$#;
How about...
$filename =~ s#.*/##;
Yah?
--
Christopher D. Goldman
gold@media-network.com
'They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety.' -- Benjamin Franklin (1759)
------------------------------
Date: 14 Jan 1998 14:21:00 -0700
From: that1guy@primenet.com (S.B.)
Subject: using htpasswd from within a perl program
Message-Id: <34bd2a35.229754189@news.primenet.com>
Using BSD/OS 3.0
Is there anyway I can run a complete htpasswd command line from
withing a perl program so no interaction is required from the user.
Normally, when htpasswd is run, it expects the command line with
username and then you have to enter the password manually (twice)
I would like this to be handled completely from within the program,
any help would be appreciated.
thanks :)
SB
------------------------------
Date: Wed, 14 Jan 1998 16:45:38 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: using htpasswd from within a perl program
Message-Id: <comdog-ya02408000R1401981645380001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34bd2a35.229754189@news.primenet.com>, that1guy@primenet.com (S.B.) posted:
>Is there anyway I can run a complete htpasswd command line from
>withing a perl program so no interaction is required from the user.
why use htpasswd when the entire task can be handled with Perl? it's
trivial to write a module to do this, or you can check out CPAN [1] for
the HTTPD::UserAdmin module.
good luck :)
[1]
Comprehensive Perl Archive Network
find one near you at <URL:http://www.perl.com>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Wed, 14 Jan 1998 16:09:09 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Webmasters????
Message-Id: <comdog-ya02408000R1401981609090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <34BCF980.982D2003@bayou.uh.edu>, Rishi Bhattacharya <rbhattac@bayou.uh.edu> posted:
> I am currently starting a new project (a website) and am looking for
>an experienced Perl/CGI programmer to head the Perl/CGI department of
>the site. The responsibilities of the hired person will be very simple
>- you will be required (contractually obligated) to write three to four
>articles on Perl/CGI (topic will be at your discretion) per month.
weren't you currently starting this same project half a year ago?
let's remember that "contractually" involves some contigency (i.e.
payment), although a close read of your post indicates that you are
only offering the promise of possible future revenue. maybe you
are on the up and up, but i see lots of these scams every day.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Silicon Alley snake oil
------------------------------
Date: Wed, 14 Jan 1998 16:25:53 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Would this code be right
Message-Id: <comdog-ya02408000R1401981625530001@news.panix.com>
Keywords: from just another new york perl hacker
Please check this information on how to choose a good subject for a post:
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
In article <34BAABD1.7805@builders-connection.com>, Webmaster@builders-connection.com posted:
>#!/user/bin/perl
hmmmm....
># Program to do the obvious
maybe it's obvious to you...
>$hello = "Hello, World";
>$Goodbye = "Goodbye, World";
>@H = "$hello,$Goodbye";
i think you wanted that to be
my @H = ($hello, $Goodbye);
>open(FILE, ">> hello.txt")|| die "I can't open: Database\n";
part of checking for return values is finding out what went wrong:
... or die "I can't open: Database: $!";
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 1640
**************************************