[13138] in Perl-Users-Digest
Perl-Users Digest, Issue: 548 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 15 23:07:52 1999
Date: Sun, 15 Aug 1999 20:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Aug 1999 Volume: 9 Number: 548
Today's topics:
Re: Creating hotlinks out of plain URLs in Perl. (Abigail)
FREE PERL HELP!!! <director@removethisitem.allexperts.com>
Help Parsing a line akhtara@erols.com
Re: Help Parsing a line <rick.delaney@home.com>
Re: How to LOCK files with perl on Windows systems? (William Herrera)
Re: HTTP redirect..not working (Anno Siegel)
Re: i cann't read and write at the sametime (David Efflandt)
Re: Performance difference printing single vs double qu <uri@sysarch.com>
Re: Performance difference printing single vs double qu <uri@sysarch.com>
Perl data type size (max and min values) <steve@nomail.com>
Re: problem printing ("html") (elephant)
Re: problem printing ("html") (elephant)
Re: problem printing ("html") (elephant)
Re: problem printing ("html") <rick.delaney@home.com>
Re: search script in need of help <purchase9@hotmail.com>
Why It's Cool To Make Fun Of Bad Code (Chris)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 Aug 1999 21:59:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Creating hotlinks out of plain URLs in Perl.
Message-Id: <slrn7revll.8e5.abigail@alexandra.delanet.com>
Sunfox (sunfox@sunwerx.com) wrote on MMCLXXV September MCMXCIII in
<URL:news:evIt3.105906$U42.135154@news1.rdc1.bc.home.com>:
\\
\\ Wow, that's quite impressive... and it works! Amazing! Now, one further
\\ question: is there any way to detect if the <A HREF= part is already in a
\\ particular URL and not do anything in that case? Lastly, is there a
\\ formatted version of this anywhere? I'm trying to remove those that I don't
\\ really need (what's vemmi:// or prospero://?) but as it's all run together
\\ it's a tad hard.
You would need to parse the HTML if you want to exclude URL in HREFs.
(I guess you want to exclude them from <IMG>, <LINK>, <OBJECT> and
everything else that can contain URLs as well.)
As for a formatted version, no, not really. But here's the code that
created the regex:
#!/usr/local/bin/perl -wT
use Carp;
use strict;
# Be paranoid about using grouping!
my $nz_digit = '[1-9]';
my $nz_digits = "(?:$nz_digit\\d*)";
my $digits = '(?:\d+)';
my $space = '(?:%20)';
my $nl = '(?:%0[Aa])';
my $dot = '\.';
my $plus = '\+';
my $qm = '\?';
my $ast = '\*';
my $hex = '[a-fA-F\d]';
my $alpha = '[a-zA-Z]'; # No, no locale.
my $alphas = "(?:${alpha}+)";
my $alphanum = '[a-zA-Z\d]'; # Letter or digit.
my $xalphanum = "(?:${alphanum}|%(?:3\\d|[46]$hex|[57][Aa\\d]))";
# Letter or digit, or hex escaped letter/digit.
my $alphanums = "(?:${alphanum}+)";
my $escape = "(?:%$hex\{2})";
my $safe = '[$\-_.+]';
my $extra = "[!*'(),]";
my $national = '[{}|\\^~[\]`]';
my $punctuation = '[<>#%"]';
my $reserved = '[;/?:@&=]';
my $uchar = "(?:${alphanum}|${safe}|${extra}|${escape})";
my $xchar = "(?:${alphanum}|${safe}|${extra}|${reserved}|${escape})";
$uchar =~ s/\Q]|[\E//g; # Make string smaller, and speed up regex.
$xchar =~ s/\Q]|[\E//g; # Make string smaller, and speed up regex.
# URL schemeparts for ip based protocols:
my $user = "(?:(?:${uchar}|[;?&=])*)";
my $password = "(?:(?:${uchar}|[;?&=])*)";
my $hostnumber = "(?:${digits}(?:${dot}${digits}){3})";
my $toplabel = "(?:${alpha}(?:(?:${alphanum}|-)*${alphanum})?)";
my $domainlabel = "(?:${alphanum}(?:(?:${alphanum}|-)*${alphanum})?)";
my $hostname = "(?:(?:${domainlabel}${dot})*${toplabel})";
my $host = "(?:${hostname}|${hostnumber})";
my $hostport = "(?:${host}(?::${digits})?)";
my $login = "(?:(?:${user}(?::${password})?\@)?${hostport})";
# The predefined schemes:
# FTP (see also RFC959)
my $fsegment = "(?:(?:${uchar}|[?:\@&=])*)";
my $fpath = "(?:${fsegment}(?:/${fsegment})*)";
my $ftpurl = "(?:ftp://${login}(?:/${fpath}(?:;type=[AIDaid])?)?)";
# FILE
my $fileurl = "(?:file://(?:${host}|localhost)?/${fpath})";
# HTTP
my $hsegment = "(?:(?:${uchar}|[;:\@&=])*)";
my $search = "(?:(?:${uchar}|[;:\@&=])*)";
my $hpath = "(?:${hsegment}(?:/${hsegment})*)";
my $httpurl = "(?:http://${hostport}(?:/${hpath}(?:${qm}${search})?)?)";
# GOPHER (see also RFC1436)
my $gopher_plus = "(?:${xchar}*)";
my $selector = "(?:${xchar}*)";
my $gtype = ${xchar}; # Omitted parens!
my $gopherurl = "(?:gopher://${hostport}(?:/${gtype}(?:${selector}" .
"(?:%09${search}(?:%09${gopher_plus})?)?)?)?)";
# MAILTO (see also RFC822)
my $encoded822addr = "(?:$xchar+)";
my $mailtourl = "(?:mailto:$encoded822addr)";
# NEWS (see also RFC1036)
my $article = "(?:(?:${uchar}|[;/?:&=])+\@${host})";
my $group = "(?:${alpha}(?:${alphanum}|[_.+-])*)";
my $grouppart = "(?:${article}|${group}|${ast})";
my $newsurl = "(?:news:${grouppart})";
# NNTP (see also RFC977)
my $nntpurl = "(?:nntp://${hostport}/${group}(?:/${digits})?)";
# TELNET
my $telneturl = "(?:telnet://${login}/?)";
# WAIS (see also RFC1625)
my $wpath = "(?:${uchar}*)";
my $wtype = "(?:${uchar}*)";
my $database = "(?:${uchar}*)";
my $waisdoc = "(?:wais://${hostport}/${database}/${wtype}/${wpath})";
my $waisindex = "(?:wais://${hostport}/${database}${qm}${search})";
my $waisdatabase = "(?:wais://${hostport}/${database})";
# my $waisurl = "(?:${waisdatabase}|${waisindex}|${waisdoc})";
# Speed up: the 3 types share a common prefix.
my $waisurl = "(?:wais://${hostport}/${database}" .
"(?:(?:/${wtype}/${wpath})|${qm}${search})?)";
# PROSPERO
my $fieldvalue = "(?:(?:${uchar}|[?:\@&])*)";
my $fieldname = "(?:(?:${uchar}|[?:\@&])*)";
my $fieldspec = "(?:;${fieldname}=${fieldvalue})";
my $psegment = "(?:(?:${uchar}|[?:\@&=])*)";
my $ppath = "(?:${psegment}(?:/${psegment})*)";
my $prosperourl = "(?:prospero://${hostport}/${ppath}(?:${fieldspec})*)";
# LDAP (see also RFC1959)
# First. import stuff from RFC 1779 (Distinguished Names).
# We've modified things a bit.
my $dn_separator = "(?:[;,])";
my $dn_optional_space = "(?:${nl}?${space}*)";
my $dn_spaced_separator = "(?:${dn_optional_space}${dn_separator}" .
"${dn_optional_space})";
my $dn_oid = "(?:${digits}(?:${dot}${digits})*)";
my $dn_keychar = "(?:${xalphanum}|${space})";
my $dn_key = "(?:${dn_keychar}+|(?:OID|oid)${dot}${dn_oid})";
my $dn_string = "(?:${uchar}*)";
my $dn_attribute = "(?:(?:${dn_key}${dn_optional_space}=" .
"${dn_optional_space})?${dn_string})";
my $dn_name_component = "(?:${dn_attribute}(?:${dn_optional_space}" .
"${plus}${dn_optional_space}${dn_attribute})*)";
my $dn_name = "(?:${dn_name_component}" .
"(?:${dn_spaced_separator}${dn_name_component})*" .
"${dn_spaced_separator}?)";
# RFC 1558 defines the filter syntax, but that requires a PDA to recognize.
# Since that's too powerful for Perl's REs, we allow any char between the
# parenthesis (which have to be there.)
my $ldap_filter = "(?:\(${xchar}+\))";
# This is from RFC 1777. It defines an attributetype as an 'OCTET STRING',
# whatever that is.
my $ldap_attr_type = "(?:${uchar}+)"; # I'm just guessing here.
# The RFCs aren't clear.
# Now we are at the grammar of RFC 1959.
my $ldap_attr_list = "(?:${ldap_attr_type}(?:,${ldap_attr_type})*)";
my $ldap_attrs = "(?:${ldap_attr_list}?)";
my $ldap_scope = "(?:base|one|sub)";
my $ldapurl = "(?:ldap://(?:${hostport})?/${dn_name}" .
"(?:${qm}${ldap_attrs}" .
"(?:${qm}${ldap_scope}(?:${qm}${ldap_filter})?)?)?)";
# RFC 2056 defines the format of URLs for the Z39.50 protocol.
my $z_database = "(?:${uchar}+)";
my $z_docid = "(?:${uchar}+)";
my $z_elementset = "(?:${uchar}+)";
my $z_recordsyntax = "(?:${uchar}+)";
my $z_scheme = "(?:z39${dot}50[rs])";
my $z39_50url = "(?:${z_scheme}://${hostport}" .
"(?:/(?:${z_database}(?:${plus}${z_database})*" .
"(?:${qm}${z_docid})?)?" .
"(?:;esn=${z_elementset})?" .
"(?:;rs=${z_recordsyntax}" .
"(?:${plus}${z_recordsyntax})*)?))";
# RFC 2111 defines the format for cid/mid URLs.
my $url_addr_spec = "(?:(?:${uchar}|[;?:@&=])*)";
my $message_id = $url_addr_spec;
my $content_id = $url_addr_spec;
my $cidurl = "(?:cid:${content_id})";
my $midurl = "(?:mid:${message_id}(?:/${content_id})?)";
# RFC 2122 defines the Vemmi URLs.
my $vemmi_attr = "(?:(?:${uchar}|[/?:@&])*)";
my $vemmi_value = "(?:(?:${uchar}|[/?:@&])*)";
my $vemmi_service = "(?:(?:${uchar}|[/?:@&=])*)";
my $vemmi_param = "(?:;${vemmi_attr}=${vemmi_value})";
my $vemmiurl = "(?:vemmi://${hostport}" .
"(?:/${vemmi_service}(?:${vemmi_param}*))?)";
# RFC 2192 for IMAP URLs.
# Import from RFC 2060.
# my $imap4_astring = "";
# my $imap4_search_key = "";
# my $imap4_section_text = "";
my $imap4_nz_number = $nz_digits;
my $achar = "(?:${uchar}|[&=~])";
my $bchar = "(?:${uchar}|[&=~:\@/])";
my $enc_auth_type = "(?:${achar}+)";
my $enc_list_mbox = "(?:${bchar}+)";
my $enc_mailbox = "(?:${bchar}+)";
my $enc_search = "(?:${bchar}+)";
my $enc_section = "(?:${bchar}+)";
my $enc_user = "(?:${achar}+)";
my $i_auth = "(?:;[Aa][Uu][Tt][Hh]=(?:${ast}|${enc_auth_type}))";
my $i_list_type = "(?:[Ll](?:[Ii][Ss][Tt]|[Ss][Uu][Bb]))";
my $i_mailboxlist = "(?:${enc_list_mbox}?;[Tt][Yy][Pp][Ee]=${i_list_type})";
my $i_uidvalidity = "(?:;[Uu][Ii][Dd][Vv][Aa][Ll][Ii][Dd][Ii][Tt][Yy]=" .
"${imap4_nz_number})";
my $i_messagelist = "(?:${enc_mailbox}(?:${qm}${enc_search})?" .
"(?:${i_uidvalidity})?)";
my $i_section = "(?:/;[Ss][Ee][Cc][Tt][Ii][Oo][Nn]=${enc_section})";
my $i_uid = "(?:/;[Uu][Ii][Dd]=${imap4_nz_number})";
my $i_messagepart = "(?:${enc_mailbox}(?:${i_uidvalidity})?${i_uid}" .
"(?:${i_section})?)";
my $i_command = "(?:${i_mailboxlist}|${i_messagelist}|${i_messagepart})";
my $i_userauth = "(?:(?:${enc_user}(?:${i_auth})?)|" .
"(?:${i_auth}(?:${enc_user})?))";
my $i_server = "(?:(?:${i_userauth}\@)?${hostport})";
my $imapurl = "(?:imap://${i_server}/(?:$i_command)?)";
# RFC 2224 for NFS.
my $nfs_mark = '[\$\-_.!~*\'(),]';
my $nfs_unreserved = "(?:${alphanum}|${nfs_mark})";
$nfs_unreserved =~ s/\Q]|[//g;
my $nfs_pchar = "(?:${nfs_unreserved}|${escape}|[:\@&=+])";
my $nfs_segment = "(?:${nfs_pchar}*)";
my $nfs_path_segs = "(?:${nfs_segment}(?:/${nfs_segment})*)";
my $nfs_url_path = "(?:/?${nfs_path_segs})";
my $nfs_rel_path = "(?:${nfs_path_segs}?)";
my $nfs_abs_path = "(?:/${nfs_rel_path})";
my $nfs_net_path = "(?://${hostport}(?:${nfs_abs_path})?)";
my $nfs_rel_url = "(?:${nfs_net_path}|${nfs_abs_path}|${nfs_rel_path})";
my $nfsurl = "(?:nfs:${nfs_rel_url})";
# Combining all the different URL formats into a single regex.
my $url = join "|", $httpurl, $ftpurl, $newsurl, $nntpurl,
$telneturl, $gopherurl, $waisurl, $mailtourl,
$fileurl, $prosperourl, $ldapurl, $z39_50url,
$cidurl, $midurl, $vemmiurl, $imapurl,
$nfsurl;
print $url, "\n";
__END__
Abigail
--
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 15 Aug 1999 22:41:39 -0400
From: STEVE <director@removethisitem.allexperts.com>
Subject: FREE PERL HELP!!!
Message-Id: <37B77A63.4DDD@removethisitem.allexperts.com>
In addition to this great newsgroup, there's another source of info to
answer your detailed one-on-one Perl questions for free! You can check
it out at
http://www.allexperts.com/getExpert.asp?Category=1045
Hope that helps someone...
------------------------------
Date: Mon, 16 Aug 1999 02:13:19 GMT
From: akhtara@erols.com
Subject: Help Parsing a line
Message-Id: <7p7s3p$7kg$1@nnrp1.deja.com>
Hello,
I am trying to parse the following lines and need to save the two name
fields. I am using Perl5. Any ideas or suggestion would be helpful.
J.Jackson (10) (20) 32 A.Sample (10) (30) (14) 42WR
A.Aaron (25) 54WL J.Jones (46) 42WR
The problem is that the number of fields are not always the same between
the two names. I only need to extract and save the two names. The
second name always starts at column 40.
This is just a small part of the input file. The input file isn't a
fixed format, but a mixture. I have sucessfully parsed the rest, but am
stuck on this very last section where I just need the names.
Thanks!
Asher
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 16 Aug 1999 02:40:23 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Help Parsing a line
Message-Id: <37B779FA.F23352FF@home.com>
[posted & mailed]
akhtara@erols.com wrote:
>
> I am trying to parse the following lines and need to save the two name
> fields. I am using Perl5. Any ideas or suggestion would be helpful.
>
> J.Jackson (10) (20) 32 A.Sample (10) (30) (14) 42WR
> A.Aaron (25) 54WL J.Jones (46) 42WR
>
> The problem is that the number of fields are not always the same between
> the two names. I only need to extract and save the two names. The
> second name always starts at column 40.
If the name field is a fixed width then a simple substr or unpack will
do. Otherwise, are they always followed by a number in parentheses?
If so:
my ($name1, $name2) = unpack 'A39 A*' => $_;
for ($name1, $name2) {
s/\(\d+\).*//;
}
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 16 Aug 1999 02:42:56 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: How to LOCK files with perl on Windows systems?
Message-Id: <37b77a1e.42901271@news.rmi.net>
On Mon, 16 Aug 1999 00:24:41 GMT, dunrobin52@hotmail.com wrote:
>On Sun, 1 Aug 1999 12:27:45 +1000, e-lephant@b-igpond.com (elephant)
>wrote:
>
>>Alexander Rühl writes ..
>>>I tested it under Win98 - but there isn't a 'flock'. It should run on a
>...where you'll discover that flock doesn't work on Win9x. End of
>story.
>
try
perl -MCPAN -e shell;
> install File::FlockDir
> install File:PathConvert
-- Bill
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: 16 Aug 1999 01:33:32 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTTP redirect..not working
Message-Id: <7p7ppc$h9$1@lublin.zrz.tu-berlin.de>
Sunfox <sunfox@sunwerx.com> wrote in comp.lang.perl.misc:
>Alan J. Flavell wrote in message ...
[...]
>>Oh look, you hung the entire previous content on the end of your f'up.
>
>
>Wasn't exactly a great amount of text, y'know. It appears a few of the folks
>in here should be on some sort of mood tranquilizer. Lighten up, dude.
What has the amount of text to do with its placement? The lazy practice
of placing the reply on top of everything else makes it hard for your
readers to find out what exactly you are replying to. It makes it even
harder to follow up to your mangled posting so that the result resembles
a logical sequence. No dose of tranquilizer will persuade me to think
different.
Anno
------------------------------
Date: 16 Aug 1999 02:55:39 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: i cann't read and write at the sametime
Message-Id: <slrn7revl9.g2.efflandt@efflandt.xnet.com>
On Fri, 13 Aug 1999 20:19:50 -0400, JCEtek <jcetek@ezzi.net> wrote:
>i've openned the file with +<, +> and +>>, i can read but cann't write. >
>overwrites. is there a way to open a file so i can finded something and
>rewrite just that line.
Does the file have write permission? Start with 666 if that works, you
could try reducing group permission. Note if the line you are writing to
the file is a different length than the one being replace, you will either
end up with some of the existing line still there (if new line is shorter)
or will step on following data if longer. So this only works easily if
old and new lines are the same length or you are appending to the file.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 15 Aug 1999 21:22:34 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Performance difference printing single vs double quote?
Message-Id: <x7so5k34f9.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> And changing C<"foo"> to C<"foo\n"> is easier than changing C<'foo'>
A> to C<"foo\n">. I don't buy this C<"foo"> is a fixed string without any
A> interpolation, hence you should use C<''>. C<"foo"> does do interpolation;
A> it's just that the number of interpolated tokens is 0. For the same
A> reason, C<""> is a string, and it's not something special cause it
A> doesn't contain characters.
A> I always try to keep in mind "what might I change?" when coding.
i have had occasions where i was bit by the need to change 'foo' to
"foo\n" but it is rare. my point is that the quotes are for the human
reading the code and not for perl. single quotes tell the reader there
is nothing to interpolate so don't waste time scanning the
string. double quotes mean the opposite. i already won over larry rosler
with my irrefutable logic (except he still likes "" over '' for null
strings). i doubt i will win your heart in this matter. if i can
influence others in this direction, then my life will have been worthy.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 15 Aug 1999 21:26:13 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Performance difference printing single vs double quote?
Message-Id: <x7pv0o3496.fsf@home.sysarch.com>
>>>>> "TM" == Trond Michelsen <mike@crusaders.no> writes:
TM> Uri Guttman <uri@sysarch.com> wrote in message
TM> news:x7wvuw3fmw.fsf@home.sysarch.com...> it is far more important to use the
TM> quotes that properly convey the
>> meaning of what you are doing in the string. single quoted strings ('
>> and its sibling q{} ) have no interpolation or backslashed char
>> insertion (\n and friends). double quoted strings (" and its sibling
>> qq{}) will have interpolation. so if you just need a fixed string
>> without any interpolation, use single quotes, otherwise use double
>> quotes.
TM> On a side note. How does concatenation perform compared to
TM> variable interpolation? I've seen plenty of programs that seem to
TM> have been written by authors that have a serious aversion for
TM> variable interpolation, so statements like:
TM> $string = 'the value of $foo is: ' . $foo . ' and the value of
TM> $bar is: ' . $bar . "\n";
i hate seeing code like that. it is very unreadable to my eyes.
TM> $string = "the value of \$foo is $foo and the value of \$bar is $bar\n";
again i don't like that. it is a debugging statement so i just wouldn't
print the \$ which then makes it look fine. you should never need to
print \$foo in a production program. it makes no sense outside of perl.
my debugging prints look more like:
print "foo: [$foo]\n" ;
the [] is so i can see null strings.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 15 Aug 1999 21:52:04 -0500
From: Steve <steve@nomail.com>
Subject: Perl data type size (max and min values)
Message-Id: <37B77CA1.115C205A@nomail.com>
Hi all, got a pretty simple Perl question here.
How can I determine the maximum and minimum value of a scalar value?
Or, what is the size of a scalar. I can’t seem to find this information
in Larry Wall’s Programming Perl or the online perl.com documentation.
Thanks,
Steve
Please respond via newsgroup only (email is not valid to avoid junk
mail).
------------------------------
Date: Mon, 16 Aug 1999 12:32:34 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: problem printing ("html")
Message-Id: <MPG.12222348297be98b989c29@news-server>
Rick Delaney writes ..
>Daniel Garmendia wrote:
>> I want to a script to return html to the browser. I made one that is
>> supposed to do that... I chmod 755'd it but it never executes.....
>
>perldoc perlfaq9
>
>My CGI script runs from the command line but not the browser. (500
>Server Error)
strange .. I didn't read anything in the poster's original that said
that it was working on the commandline
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 16 Aug 1999 12:28:43 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: problem printing ("html")
Message-Id: <MPG.1222226733b929a7989c28@news-server>
Alan J. Flavell writes ..
>On Sun, 15 Aug 1999 inlandpac@my-deja.com wrote:
>> It is #!usr/local/bin/perl, not #!usr/bin/perl
>
>How can you be so sure of that? Do you use the same system?
>You might be right, but then again, I think if they follow the usual FAQ
>steps they're more likely to (a) get the right answer and (b) understand
>the answer that they got.
and (c) use an absolute path for their shebangs instead of the relative
path that is being mindlessly recommended (and is probably the cause of
the originator's problems)
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 16 Aug 1999 12:36:15 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: problem printing ("html")
Message-Id: <MPG.1222242cfd5953e4989c2a@news-server>
Daniel Garmendia writes ..
>Please excuse my ignorance. I am also a rookie perl programmer. I want to
>a script to return html to the browser. I made one that is supposed to do
>that... I chmod 755'd it but it never executes..... This is html.cgi at
>http://home.dmv.com/~jaimeg/html.cgi :
>
>
>#!usr/bin/perl
^^
you've most likely made a typo on your shebang line .. you are
specifying a relative path to your perl executable .. this is probably
not what you want
assuming that your perl is in /usr/bin then this line should actually be
#!/usr/bin/perl -w
and the line following that should be
use strict;
your code will most likely then work .. test it from the command line
first .. then through your web server
perldoc perlrun
for more details
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Mon, 16 Aug 1999 02:55:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: problem printing ("html")
Message-Id: <37B77D8B.CF3ACD94@home.com>
[posted & mailed]
elephant wrote:
>
> strange .. I didn't read anything in the poster's original that said
> that it was working on the commandline
Neither did I.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 15 Aug 1999 22:30:48 -0400
From: "SH" <purchase9@hotmail.com>
Subject: Re: search script in need of help
Message-Id: <37b7763c@news1.us.ibm.net>
mike <mcmike123@worldnet.att.net> wrote in message
news:7p6itp$25g$1@bgtnsc02.worldnet.att.net...
> thank you for the help now i have the error
>
> Can't locate LWP/Simple.pm in @INC (@INC contains:
> /usr/local/lib/perl5/i386-freebsd/5.00404 /usr/local/lib/perl5
> /usr/local/lib/perl5/site_perl/i386-freebsd /usr/local/lib/perl5/site_perl
> .) at search.cgi line 12.
> BEGIN failed--compilation aborted at search.cgi line 12.
>
> does this mean all is lost and im doomed because i cant use the the
> LWP/Simple.pm.
> or is there another way?
E-mail your ISP with the module attached and ask for it to be installed.
LWP is a pretty common module so there should not be any problem.
------------------------------
Date: Mon, 16 Aug 1999 02:06:19 GMT
From: chrisl@tourneyland.com (Chris)
Subject: Why It's Cool To Make Fun Of Bad Code
Message-Id: <37b75f17.20178894@news.swbell.net>
I guess there was a bit of a thread here a few days ago, where someone
said some other programmer's code wasn't any good, and then a bunch of
people seemed to have a problem with this, and made some postings that
frankly were sort of bizarre. (I won't mention names, because the fact
that things were perceived as 'personal' was the whole source of the
anrti-code-bashing nonsense.)
HERE'S what I think about this . . .
I'm learning Perl, and for the most part I'm learning from other
people's code. (I read THE CAMEL and it didn't help, but hey, that
could be my problem). My web hosters have this script they provide to
do Email, and I thought "Cool, I can study the script and learn how to
do sockets programming in Perl", so I don't have to resort to Java
everytime I want to do sockets stuff.
I read the script, and it's got Copyright Some Guy and all kinds of
official looking stuff, so I assume "Hey, I guess this is pretty much
THE EMAIL SCRIPT. NOW I'll be learning thingsthe RIGHT way." But I'm
reading the script, and I'm kind of confused, cause it has things like
this in it:
$WEB_SERVER = "www.ichangedthis.com\n";
chop ($WEB_SERVER);
And I think "MAN, I must not no s**t about Perl, because to me that
code looks absurd, so I must completely misunderstand function call
semantics, or string lieterals. or God knows what. And there's a whole
bunch of pack & unpack gobbledygook, and that makes me think that
Sockets in Perl are kind of a pain.
You know what though? After reading that initial post making fun of
those old scripts, I thought "Hmmmmmm, maybe that code I was studying
ISN'T so great." And I realized that whole extraneous chop() stuff was
just sloppiness, and I found some socket code samples that didn't use
all that pack crap and that actually work, and now I see sockets in
Perl are easy as pie.
What's all that mean? Well, for starters, is was extremely helpful for
me for someone to speak out against the bad code. (That also took some
gumption, since the guy must have known he'd get slammed). Also, I
think it's not really too keen that such crappy code got out there in
the first place. When a guy goes to the trouble of Copyrighting his
code etc, and posturing his code as some sort of polished solution,
the least he can do is look it over. More people would understand this
if we had any sort of artisan or craftsman ethic left (if this were
the Middle Ages, some guys form the Guild would get together and get
medival on the coder's ass), but of course all that stuff is as dead
as the Plague.
If you read code that sucks, CALL IT OUT!
And if you WRITE code that sucks, DON'T RELEASE IT!
Bitch all you want.
Nuff said.
Chris
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 548
*************************************