[15772] in Perl-Users-Digest
Perl-Users Digest, Issue: 3185 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat May 27 14:10:25 2000
Date: Sat, 27 May 2000 11:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959451011-v9-i3185@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 27 May 2000 Volume: 9 Number: 3185
Today's topics:
Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
Re: seeking method to encode email addresses in web pag <dave@dave.org.uk>
Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
Re: seeking method to encode email addresses in web pag <dave@dave.org.uk>
Re: sort routine fails <jeff@vpservices.com>
Re: Tanspose rows to columns <nospam@devnull.com>
upload 0K files?? pepis_us@my-deja.com
Re: using param() and CGI.pm to store a persistent valu <godzilla@stomp.stomp.tokyo>
Re: using param() and CGI.pm to store a persistent valu <dave@dave.org.uk>
Re: Where to Start + FIFO Stack (Tad McClellan)
Re: Why not 5.005_03? (Yitzchak Scott-Thoennes)
Re: Windows/Linux Incompatibility (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 27 May 2000 06:58:12 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <392FD474.36988CCC@stomp.stomp.tokyo>
Neil Kandalgaonkar wrote:
> In article <392F25A5.71033160@stomp.stomp.tokyo>,
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> Personally, I've tried to be patient with you,
> but it appears you are incapable of acting like
> a rational and humane person. Instead, you treat
> this newsgroup as your personal shitting ground.
Oh my, now aren't you just the patron saint
of mule manure. Want some cheese with your
whine little boy?
Godzilla!
------------------------------
Date: Sat, 27 May 2000 07:04:20 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <392FD5E4.C77030CE@stomp.stomp.tokyo>
Dave Cross wrote:
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> > Dave Cross wrote:
> >> The WebDragon <nospam@devnull.com> wrote:
> >> It's far easier using 'pack' and 'unpack'.
> >=~ s/%(..)/pack("c",hex($1))/ge;
> >=~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
> >Which is best and why?
> Actually I was talking more about comparing encoding code
> $email =~ s/(.)/ sprintf('%02x',ord($1)) /ge ;
> with
> $email = unpack('H*', $email);
> and your decoding code
> $email =~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
> with
> $email = pack('H*', $email);
> In both cases, my version are
> a) easier for maintenance programmers to understand
> b) less typing (and therefore less prone to typos) and
That's it? Your rationale for announcing one
version of code better than another is less
effort to type it?
Whew...
> c) (as Larry Rosler has conclusively shown) far quicker.
Rosler's test was a totally bogus cheat.
His results are invalid and his attempt
to pull off a scam like this insults my
intelligence.
Godzilla!
------------------------------
Date: Sat, 27 May 2000 15:32:57 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <tvmvis0ad5kqb776ijolh9uisun0tfe25p@4ax.com>
On Sat, 27 May 2000 07:04:20 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Dave Cross wrote:
>
>> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>> > Dave Cross wrote:
>> >> The WebDragon <nospam@devnull.com> wrote:
>
>> >> It's far easier using 'pack' and 'unpack'.
>
>> >=~ s/%(..)/pack("c",hex($1))/ge;
>
>> >=~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
>
>> >Which is best and why?
>
>> Actually I was talking more about comparing encoding code
>
>> $email =~ s/(.)/ sprintf('%02x',ord($1)) /ge ;
>
>> with
>
>> $email = unpack('H*', $email);
>
>> and your decoding code
>
>> $email =~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
>
>> with
>
>> $email = pack('H*', $email);
>
>> In both cases, my version are
>
>> a) easier for maintenance programmers to understand
>> b) less typing (and therefore less prone to typos) and
>
>
>That's it? Your rationale for announcing one
>version of code better than another is less
>effort to type it?
>
>Whew...
Er.. no, it was one of three points in my message - and probably the
least important. You're still disputing the performance issue, but you
conveniently ignored my first point about maintainability.
>> c) (as Larry Rosler has conclusively shown) far quicker.
>
>Rosler's test was a totally bogus cheat.
>His results are invalid and his attempt
>to pull off a scam like this insults my
>intelligence.
Perhaps you'd like to post your own figures to dispute Larry's. Until
you do, all I can see here is FUD.
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Sat, 27 May 2000 07:47:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <392FDFFD.AB04CC82@stomp.stomp.tokyo>
Dave Cross wrote:
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >Dave Cross wrote:
> >> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >> > Dave Cross wrote:
> >> >> The WebDragon <nospam@devnull.com> wrote:
> >> c) (as Larry Rosler has conclusively shown) far quicker.
> >Rosler's test was a totally bogus cheat.
> >His results are invalid and his attempt
> >to pull off a scam like this insults my
> >intelligence.
> Perhaps you'd like to post your own figures to dispute Larry's. Until
> you do, all I can see here is FUD.
I provided realistic and objective code
for testing. He and, apparently, everyone
else refused to test this, scientifically
and objectively.
* wonders why *
Why are you trolling and harassing me?
Godzilla!
------------------------------
Date: Sat, 27 May 2000 16:04:06 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <rhovisonr75lbfoanqgdgt2c9pa5agok20@4ax.com>
On Sat, 27 May 2000 07:47:25 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Dave Cross wrote:
>> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>> >Dave Cross wrote:
>> >> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>> >> > Dave Cross wrote:
>> >> >> The WebDragon <nospam@devnull.com> wrote:
>
>> >> c) (as Larry Rosler has conclusively shown) far quicker.
>
>> >Rosler's test was a totally bogus cheat.
>> >His results are invalid and his attempt
>> >to pull off a scam like this insults my
>> >intelligence.
>
>> Perhaps you'd like to post your own figures to dispute Larry's. Until
>> you do, all I can see here is FUD.
>
>I provided realistic and objective code
>for testing. He and, apparently, everyone
>else refused to test this, scientifically
>and objectively.
>
>* wonders why *
Maybe I wasn't clear in my last message. I'll try to be clearer...
Perl comes with it's own built-in method for comparing the performance
of different pieces of code. It's called Benchmark.pm and all Perl
programmers should be proficient in its use.
Larry Rosler poseted some code using Benchmark.pm to compare your
sprintf idea with my unpack idea. He claims that it shows that unpack
is substantially faster than your code.
Rather than just complaining that his test was bogus, what I am asking
is for you to post Benchmark code which demonstrates that it's
possible to get a different answer if you don't make the changes to
your code that Larry did.
Is that clearer?
>Why are you trolling and harassing me?
Jus' trying to get to the facts, Mam.
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Sat, 27 May 2000 10:37:32 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: sort routine fails
Message-Id: <393007DC.AC8FC477@vpservices.com>
[posted and mailed]
linalina203 wrote:
>
> i have some problems with a sort routine within a data base.
> ...
> data.txt:
> software|description|download|rating
> something 1.0|great proggie|http://u.r.traced.net/proggie.zip|5
You may find that if you really want to treat this like a database, you
should simply do exactly that. You can treat pipe "delimited" files as
databases and use standard searching, sorting, and modifying commands
with DBI and either DBD::CSV or DBD::RAM.
> open (FH, "data.txt");
You don't check the succes or failure of the open and you don't do any
file locking so you may get corrupted data if two visitors attempt to
rate things at the same time.
Here is an entire script to read your file with file locking and print
it out sorted by rating:
#!perl -Tw
use strict;
use DBI;
my $dbh = DBI->connect(
'DBI:RAM:','usr','pwd',{RaiseError=>1}
) or die DBI->errstr;
$dbh->func([
['my_table','PIPE','data.txt',{col_names=>'first_line'}]
],'catalog');
my $sth = $dbh->prepare(
"SELECT * FROM my_table ORDER BY rating"
);
$sth->execute;
while (my @row=$sth->fetchrow_array) {
print "@row\n";
}
__END__
The line that starts "SELECT *" is the only one you'd need to change if
you want them sorted in a different order or selected so that, for
example, you only want programs that are above a certain rating, or only
programs on a certain host, etc.
--
Jeff
------------------------------
Date: 27 May 2000 17:58:31 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Tanspose rows to columns
Message-Id: <8gp2c7$mjl$0@216.155.32.192>
In article <959333743.7487@itz.pp.sci.fi>, Ilmari Karonen
<usenet11103@itz.pp.sci.fi> wrote:
| In article <8glce1$7gn$4@216.155.32.218>, The WebDragon wrote:
| ># syntax error, near ") for "
| >File 'Untitled'; Line 8
| ># Missing $ on loop variable.
| >File 'Untitled'; Line 10
|
| Upgrade your perl. It works on 5.005 just fine. Or just feed the
| script through this one-liner:
|
| perl -pi -e 's/(\S.*) for (.*);/for ($2) {$1}/'
still waiting for the next release of perl to appear for my platform.
do add in a require 5.005 next time.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Sat, 27 May 2000 16:15:13 GMT
From: pepis_us@my-deja.com
Subject: upload 0K files??
Message-Id: <8gosa9$594$1@nnrp1.deja.com>
Guys:
I have a quick script here to upload files to the server. The file
unfortunately is empty, with 0K size, when the script is done running.
The files permissions are: 644 though. Any ideas?
Thanks.
#############################################################
#!/usr/bin/perl
use CGI;
$q = new CGI;
$upload_file = $q->param("upload_file");
$upload_file =~ s/^.*(\\|\/)//;
print "Content-type: text/html\n\n";
print "<html><head><title>Upload</title></head>\n<body
bgcolor=\"\#ffffff\">\n";
print "<h2>File Upload</h2>\n";
#######################################################################
if ($upload_file) {
open(UPLOADED, ">/var/lib/apache/cgi-bin/docs/$upload_file") || print
"Couldn't open $file :: <b> $!</b>";
binmode UPLOADED;
while ($size = read($upload_file, $buffer, 1024)) {
print(UPLOADED $buffer)
} # end while
close(UPLOADED);
print "$upload_file\n";
} # end if
##-----------
print "<p>\n<b>Files in upload directory:</b><br>\n";
$path = "docs";
opendir (DIRHANDLE, "$path") || print "Can't open directory $path
<b>$!</b><br>\n";
while (defined ($files=readdir(DIRHANDLE))){
print " $files<br>\n" if ($files !~ /^\.{1,2}$/);
} # end while
closedir(DIRHANDLE);
print "</body></html>";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 27 May 2000 07:14:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <392FD857.8054D30C@stomp.stomp.tokyo>
Dave Cross wrote:
> On Fri, 26 May 2000 09:48:43 -0700, "Godzilla!"
> <godzilla@stomp.stomp.tokyo> wrote:
> > I use modules and know them well.
> and then oin the very next line
> > My choice is to not use modules.
> Are you going for some kind of World
> Inconsistancy Record, Kiralynne?
Huh? * stupefied *
I know of fire well. My choice is
not to stick fingers in fire.
I know of spelling errors well.
My choice is not to use them.
I know of poor bargins. My choice
is not to buy one.
Why are you trolling and harassing me?
Godzilla!
------------------------------
Date: Sat, 27 May 2000 15:41:01 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <s6nviss37e301esijgfq2ad57t5elq409b@4ax.com>
On Sat, 27 May 2000 07:14:47 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
>Dave Cross wrote:
>
>> On Fri, 26 May 2000 09:48:43 -0700, "Godzilla!"
>> <godzilla@stomp.stomp.tokyo> wrote:
>
>> > I use modules and know them well.
>
>> and then oin the very next line
>
>> > My choice is to not use modules.
>
>> Are you going for some kind of World
>> Inconsistancy Record, Kiralynne?
>
>Huh? * stupefied *
>
>I know of fire well. My choice is
>not to stick fingers in fire.
>
>I know of spelling errors well.
>My choice is not to use them.
>
>I know of poor bargins. My choice
>is not to buy one.
Not quite the same thing is it?
You didn't say:
"I _know_ modules. ... My choice is not to _use_ them"
You said:
"I _use_ modules ... My choice is not to _use_ them"
Do you see the difference now?
>Why are you trolling and harassing me?
Only one troll here - and that's you Kiralynne.
I'm not harassing you. Hopefully by poinitng out he eros and
inconsistancies in your posts I'm discouraging newbies from thinking
that they can learn anything from you.
Cheers,
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Sat, 27 May 2000 10:16:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Where to Start + FIFO Stack
Message-Id: <slrn8ivm60.1oc.tadmc@magna.metronet.com>
On Thu, 25 May 2000 14:54:53 -0400, Courtney Tompos <cdt9@cornell.edu> wrote:
>2) How difficult would it be to implement a FIFO stack in Perl
^^^^^^^^^^
It is impossible in Perl (and in all other programming languages too :-)
A "stack" is LIFO.
A "queue" is FIFO.
push() and pop() can implement a "stack".
push() and shift() can implement a "queue".
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 25 May 2000 23:04:48 -0700
From: sthoenna@efn.org (Yitzchak Scott-Thoennes)
Subject: Re: Why not 5.005_03?
Message-Id: <AQhL5gzkgKAd092yn@efn.org>
In article <392D61EA.F5ABBF5D@earthlink.net>,
Denis Haskin <dwhaskin@earthlink.net> wrote:
> I'm a little confused. I'm trying to decide which version of Perl to
> use on a new implementation (Solaris 8).
>
> I've been using 5.6.0 for development, and while it's advertised as the
> "stable, tested release that you should use in production environments"
> (see http://www.perl.com/pub/language/info/software.html), I've
> encountered problems with it and Unicode that I had to work around.
Unicode support is experimental. That shouldn't reflect on the
quality of the release as a whole. It does have new bugs in other
areas (surprise!). It also fixes scores of 5.005_03 bugs. Which
you should go with depends on which bugs you would prefer.
Fixes for most of the reported bugs are in the bleeding-edge sources,
and should be released in a 5.6.1 version in the not too distant future.
By all means, check the bugs database and report the unicode stuff you've
found if it isn't already there.
If you have the time, build a bleeding-edge perl and play with the
unicode stuff. The more bugs you find, the more bugs can be fixed.
> I'm now also encountering a *very* weird problem with a subroutine
> disappearing on me, but I'll describe it in more detail in another post.
Bugs should be reported via the perlbug program distributed with perl.
> The page at www.perl.com that I mentioned above says that the "previous
> version of Perl is the 5.004_05 release" and contains a link to that.
Sounds like an oversight.
------------------------------
Date: Sat, 27 May 2000 10:49:46 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Windows/Linux Incompatibility
Message-Id: <slrn8ivo4a.1oc.tadmc@magna.metronet.com>
On Mon, 22 May 2000 03:27:04 GMT, Blair Heuer <ab@cd.com> wrote:
>- code snippet start -
> open PREFS,"$pages/$board/pref.txt" or open PREFS,"$pages/basepref.txt";
You should check the return value *before* reading from PREFS.
Just because you _asked_ for it to be opened doesn't mean you
will get what you asked for:
open PREFS,"$pages/$board/pref.txt" or
open PREFS,"$pages/basepref.txt" or
die "could not open prefs file $!";
> if ($threadnewcolor == "") { $threadnewcolor = 0; }
== does numeric tests
eq does string tests
So you should use one of:
if ($threadnewcolor eq "")
if ($threadnewcolor == 0)
depending on which it is that you really want there.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3185
**************************************