[16911] in Perl-Users-Digest
Perl-Users Digest, Issue: 4323 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 14 14:06:32 2000
Date: Thu, 14 Sep 2000 11:05:09 -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: <968954709-v9-i4323@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 14 Sep 2000 Volume: 9 Number: 4323
Today's topics:
Re: "perl -ne" w/nonzero exit?; chging exit code w/END <yanick@babyl.sympatico.ca>
(Funny) How the Perl got its camel (Craig Berry)
Building and traversing trees <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Can you do this with a Hash? rathmore@tierceron.com
Re: Can you do this with a Hash? <christopher_j@uswest.net>
Re: Can you do this with a Hash? <bcaligari@my-deja.com>
Re: Changing the filename for reporting compile errors <bkennedy99@home.com>
Re: Character Class in Regex - Despecify What? (Andrew Johnson)
Re: Character Class in Regex - Despecify What? <e.roselli@volusoft.com>
Re: Character Class in Regex - Despecify What? <e.roselli@volusoft.com>
Re: Character Class in Regex - Despecify What? <lr@hpl.hp.com>
Re: File:Find - Why don't directories have trailing sla <jboes@eomonitor.com>
Help in RegExp to highlight keyword in HTML file parvaist@my-deja.com
Re: How do I sort a list of list by a certain column <christopher_j@uswest.net>
Re: LWP::UserAgent and EBay using Post <variant@shell.pacifier.com>
O'Reilly University of Perl 2000 CGI$WWW Programming in <hillr@ugsolutions.com>
passing login & password to .htaccess via Perl script gittarman@my-deja.com
Re: passing login & password to .htaccess via Perl scri (Tony L. Svanstrom)
Re: passing login & password to .htaccess via Perl scri <notkmetcalf@notlighthousemarketingnot.com>
Re: Perl <christopher_j@uswest.net>
Re: Perl <notkmetcalf@notlighthousemarketingnot.com>
Re: Qualifications for new Perl programmer????? (brian d foy)
Re: Qualifications for new Perl programmer????? <bcaligari@my-deja.com>
Re: Returning values of unticked checkbox (Jerome O'Neil)
Re: Running Program without wait for finish (Chris Fedde)
Re: sprintf() rounding problem <davidhj@mail.com>
Re: sprintf() rounding problem mexicanmeatballs@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 14 Sep 2000 15:45:07 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: "perl -ne" w/nonzero exit?; chging exit code w/END blk??
Message-Id: <7o6w5.260379$1h3.5166297@news20.bellglobal.com>
Tom Rodman <trodman@nyx.nyx.net> wrote:
: Is it possible to change the exit code of a perl script
: by doing something within an "END" block?
: How can I write a script using the "-n" syntax such that
: the script *may* conditionally exit with nonzero exit
: code?
: This may hint at what I'm after:
: perl -np -e '
: s/red/blue/;
: /green/ && do {$fail=1} ;
: END {if ($fail) {
: 0 or die "oops I would like to exit w/code 1 here\n";
: }
: }' < myfile
: How can the above be cleaned up to work?
I could be wrong, but I think both
perl -pe'#stuff END{ exit 1 if $fail }'
perl -pe'#stuff END{ $!=1 and die "ARGH!" if $fail }'
should work. 'perldoc -f exit' and 'perldoc -f die' will
tell you why.
Joy,
Yanick
--
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;
------------------------------
Date: Thu, 14 Sep 2000 17:46:57 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: (Funny) How the Perl got its camel
Message-Id: <ss23oh4pct687@corp.supernews.com>
Moderately amusing:
http://segfault.org/story.phtml?mode=2&id=39be3742-08584960
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Every force evolves a form."
| - Shriekback
------------------------------
Date: Thu, 14 Sep 2000 18:44:47 +0100
From: "Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk>
Subject: Building and traversing trees
Message-Id: <968953127.21507.0.nnrp-07.9e98e5bc@news.demon.co.uk>
Can anyone point to Perl code snippets for building and traversing trees?
I want to build a tree representation of heirarchical address strings.
For example, give the strings:
/GB/BT/BBC/NEWS
/GB/BT/BBC/SPORT
/GB/BT/BBC/DRAMA
/GB/BT/ITV
/GB/BT/C4
/US/ATT/ABC
/US/ATT/NBC
I'd like to build a tree (starting from a root entry) with this structure (I
hope this is meaningful):
root
GB
BT
BBC
NEWS
SPORT
DRAMA
ITV
C4
US
ATT
ABC
NBC
Note this is not a binary tree. (Nodes BBC and BT both have 3 branches.)
Neither is it a matrix (list of lists). So the Complex Structures bit of
perldsc, and perllol, do not seem to help.
I'd appreciate any pointers or references ;-)
Clyde
------------------------------
Date: Thu, 14 Sep 2000 16:45:00 GMT
From: rathmore@tierceron.com
Subject: Can you do this with a Hash?
Message-Id: <8pqva5$45f$1@nnrp1.deja.com>
Here is what I know:
I've got a table that contains three fields for each row. Field_one is
a unique identifier (sounds like it's time for a hash!), Field_two is a
string, Field_three is a string. A couple of lines might look something
like this:
2000 S/M SM
2001 075 7-1/2
2002 NOSZ
What I need to do with this data is read through a line of text and
find any occurance of values found in Field_three. If a match is found,
I need to replace the current value that matched Field_three with the
value in Field_two.
My question is, can a hash have more than one value per key? If that is
possible, I'm thinking the code would be fairly straight-forward, but I
can't find any reference to hashes with more than one value per key.
Does that break the whole concept of a hash?
Other ideas on what kind of data structure I might use?
Thanks all!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 10:06:14 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: Can you do this with a Hash?
Message-Id: <9A7w5.422$0j.147013@news.uswest.net>
<rathmore@tierceron.com> wrote:
> Here is what I know:
>
> I've got a table that contains three fields for each row. Field_one is
> a unique identifier (sounds like it's time for a hash!), Field_two is a
> string, Field_three is a string. A couple of lines might look something
> like this:
>
> 2000 S/M SM
> 2001 075 7-1/2
> 2002 NOSZ
>
> What I need to do with this data is read through a line of text and
> find any occurance of values found in Field_three. If a match is found,
> I need to replace the current value that matched Field_three with the
> value in Field_two.
>
> My question is, can a hash have more than one value per key? If that is
> possible, I'm thinking the code would be fairly straight-forward, but I
> can't find any reference to hashes with more than one value per key.
> Does that break the whole concept of a hash?
>
> Other ideas on what kind of data structure I might use?
You probably want a hash of array refs.
Assuming your table is tab delimited, you might use something
like this.
#!/usr/bin/perl -w
%table = ();
# get your table values
open (TABLE, "<table.dat");
while (<TABLE>)
{
chomp;
my ($key, $f1, $f2) = split(/\t/, $_);
$table{$key} = [$f1, $f2];
}
close (TABLE);
# then, for a particular line of text:
foreach (keys %table)
{ $text =~ s/$table{$_}[1]/$table{$_}[1]/; }
#####################
Although, I wonder what the use for the unique identifier is
in the table (column 1). It sounds like you could just use
field three for the hash key and have field two be the hash
value in this case.
------------------------------
Date: Thu, 14 Sep 2000 17:33:05 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Can you do this with a Hash?
Message-Id: <8pr24g$7ou$1@nnrp1.deja.com>
In article <8pqva5$45f$1@nnrp1.deja.com>,
rathmore@tierceron.com wrote:
> Here is what I know:
>
> I've got a table that contains three fields for each row. Field_one is
> a unique identifier (sounds like it's time for a hash!), Field_two is
a
[snip]
> can't find any reference to hashes with more than one value per key.
> Does that break the whole concept of a hash?
just about anything can be represented using a hash
I found the book "Advanced Perl Programming" (O'Reilly)
very helpful.
----------
my %hi = (
'earth' => ['big', 'blue'],
'moon' => ['small', 'grey'],
);
foreach (keys(%hi)) {
print("$_\t$hi{$_}[0]\t$hi{$_}[1]\n");
}
----------
Brendon
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 17:18:14 GMT
From: "Ben Kennedy" <bkennedy99@home.com>
Subject: Re: Changing the filename for reporting compile errors
Message-Id: <qL7w5.25806$AW2.345615@news1.rdc2.pa.home.com>
"Thom Harp" <thomharp@flash.net> wrote in message
news:39BF86DF.FBDC89FF@flash.net...
> Is there a way I can overide the name of the current file as it's
> reported during compile time errors?
> Specifically, I preprocess my script and write out the processed version
> to /tmp and then execute it with
> do '/tmp/file.pl';
>
> Is there a way for compile time errors to report the original filename,
> and not the /tmp one?
>
> thanks...
I don't think this is possible, but maybe you can put in the begining of
your preprocessed file
END {
print "Failure in original file $orig_file"; # prints after all compile
time errors
}
or use a very cludgy wrapper to run the temporary script like
use strict;
use warnings;
my $orig_file = "origname.pl";
my $tmp_file = "/tmp/tmp.pl";
pipe(my $reader,STDERR) or die "Cannot pipe: $!";
unless(my $retval = do $tmp_file)
$@ and print STDERR $@;
$! and print "Could not do: $!\n";
}
close(STDERR);
while(<$reader>) {
s/$tmp_file/$orig_file/ge;
print;
}
might do the trick
--Ben Kennedy
------------------------------
Date: Thu, 14 Sep 2000 15:27:20 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Character Class in Regex - Despecify What?
Message-Id: <s76w5.17145$a5.243550@news1.rdc1.mb.home.com>
In article <39c0e473.296c$34a@news.op.net>,
Mark-Jason Dominus <mjd@plover.com> wrote:
[snip]
! You get more normal behavior with $/ = "". In this case Perl breaks
! the data into two paragraphs; the first one is "... blah blah\n\n\n\n"
! and the second is "more more ...".
Just to clarify, the first paragraph your program will read in will
be "...blah blah\n\n", and the second "more more..." -- in paragraph
mode the additional blank lines will not be included in the input.
Probably not important for the problem at hand, but if you do want
your output to maintain all the blank lines present in the input,
paragraph mode won't do it.
regards,
andrew
--
Andrew L. Johnson http://members.home.net/andrew-johnson/
Some people, when confronted with a problem, think 'I know,
I'll use regular expressions.' Now they have two problems.
-- Jamie Zawinski, on comp.lang.emacs
------------------------------
Date: Thu, 14 Sep 2000 17:43:50 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Re: Character Class in Regex - Despecify What?
Message-Id: <8pqrvs$4vl$1@wanadoo.fr>
Mark-Jason Dominus a écrit dans le message
<39c0e473.296c$34a@news.op.net>...
>That's very observant of you. "\n\n" is quite similar, but reading
>text in paragraphs is a very common operation, so Perl has a special
>facility built into it just for that, which you enable by setting $/ =
>"".
Well, thanks for that, and for your very throrough explanation! It can be my
new Perl toy for the day!
>I agree that paragraph mode is definitely the way to go here. Try
>this:
>
> $character = uc shift or die "Usage: $0 character-name\n";
>
> $/ = ""; # Paragraph mode
>
> while (<>) {
> print $cue, $_ if /^\s*$character/o;
> $cue = $_;
> }
>
>Each time through the while loop, we read a new paragraph into $_. If
>the new paragraph begins with the appropriate character name, we print
>out the previous paragraph ($cue) and the current paragraph ($_).
>Then we set $cue to be the new paragraph so that it will have the
>right value for the *next* time through the loop.
Thanks, I'll study that and play it when I get a chance. Perl is so
condensed - I'm not sure I fully understand how $cue ever gets to be
defined, but that's probably because I need to read up a bit more.
Cheers,
Elisa Francesca Roselli
------------------------------
Date: Thu, 14 Sep 2000 17:49:26 +0300
From: "Elisa Roselli" <e.roselli@volusoft.com>
Subject: Re: Character Class in Regex - Despecify What?
Message-Id: <8pqsa7$5ii$1@wanadoo.fr>
Andrew Johnson a écrit dans le message ...
>Just to clarify, the first paragraph your program will read in will
>be "...blah blah\n\n", and the second "more more..." -- in paragraph
>mode the additional blank lines will not be included in the input.
>Probably not important for the problem at hand, but if you do want
>your output to maintain all the blank lines present in the input,
>paragraph mode won't do it.
So far, the texts I have been using are very regular in formatting. Each
speech is demarcated by two blank lines and there are apparently no
multi-paragraph speeches, or if these occur, as after some stage directions,
the character's name is re-introduced. Admittedly this is a bit of a
straightjacket, and as soon as I change play it is unlikely that i will find
the same regularity.
>Andrew L. Johnson http://members.home.net/andrew-johnson/
> Some people, when confronted with a problem, think 'I know,
> I'll use regular expressions.' Now they have two problems.
> -- Jamie Zawinski, on comp.lang.emacs
Great quote! Thanks for your help.
Elisa Francesca Roselli
------------------------------
Date: Thu, 14 Sep 2000 09:56:34 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Character Class in Regex - Despecify What?
Message-Id: <MPG.142aa31da86cd5d598ad62@nntp.hpl.hp.com>
In article <8ppu4q$cgg$1@wanadoo.fr> on Thu, 14 Sep 2000 09:14:35 +0300,
Elisa Roselli <e.roselli@volusoft.com> says...
>
> Andrew J. Perrin a écrit dans le message ...
> >From memory, the only characters that require escaping in classes are
> >^, - (sometimes), and ]. So I think you should be able to do:
> >
> >[A-Za-z \n.,;:!?'()-]
>
> Good to know - so the only things to escape in a character class are the
> characters that might otherwise be ambiguous within it, but not within the
> whole of Perl. What about character classes _within_ character classes - I
> mean things like \s or \W?
Perfectly legitimate. For example, to match any 'letter' in a locale-
sensitive manner:
[^\W\d_]
...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 14 Sep 2000 10:52:12 -0400
From: Jeff Boes <jboes@eomonitor.com>
Subject: Re: File:Find - Why don't directories have trailing slash?
Message-Id: <39c0e7f1$0$51208$7aa13262@news.net-link.net>
multiplexor wrote:
> I feel it is difficult to distinguish between file and directory without the
> slash, because a file without an extension looks like a directory. Are there
> any reasons for this? What can I do if I really want directories having
> trailing slash?
Wouldn't this do the trick? (Sorry, I don't have ActivePerl at hand, and
testing it under Linux doesn't seem to be productive!)
> ####
> use File::Find;
>
> my (@files);
> find(\&wanted, '../');
>
> sub wanted {
my $n = $File::Find::name;
$n .= '/'
if (-d $n) and ($n !~ m{/$});
push @files, $n;
> }
> ####
--
Jeff Boes EoExchange, Inc.
Sr. Software Engineer (616) 381-9889 x.18
Search. Monitor. Notify. jboes@eoexchange.com
Aeneid is now EoExchange. http://www.eoexchange.com
------------------------------
Date: Thu, 14 Sep 2000 16:03:24 GMT
From: parvaist@my-deja.com
Subject: Help in RegExp to highlight keyword in HTML file
Message-Id: <8pqsrr$n5$1@nnrp1.deja.com>
Hello,
I would like to create a regexp to highlight a keyword in a html text.
Highlight means add the <FONT COLOR=...>keyword</FONT> tags. Of course,
if the keyword in contained in an HTML tag (example: <A
HREF="keyword.html">), it should not been highlighted !!!!
Can you help me by creating this regexp ??
Thank you
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 09:39:54 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: How do I sort a list of list by a certain column
Message-Id: <ub7w5.409$0j.136503@news.uswest.net>
"Malte Ubl" <ubl@schaffhausen.de> wrote:
> Hi,
>
> I want to sort a list of lits by a certain column. An example would be
> to sort
> a list of the names of all the members of a family by the third member
> of
> the family.
>
> I have written my one little algorithm to do this, but it is fairly
> slow, so I was
> wondering if there was a module to do this (havent found anything at
> CPAN)
> or if anybody else had a nice way to do this.
You should probably check the faq, there's a lot of helpful
stuff in there (including about this). Basically, what you
want it to use a hash and then use 'sort' to sort the keys
of the hash.
However, if you have duplicate key values, you could run into
problems. I had a situation like this a while back and what
I did to solve the problem was create a hash of arrays of
index values to the original array (keyed by the column of
data that I wanted to sort by). That way I was able to sort
without clobbering the rows with the same key value.
------------------------------
Date: 14 Sep 2000 10:25:46 PST
From: Jason Hurst <variant@shell.pacifier.com>
Subject: Re: LWP::UserAgent and EBay using Post
Message-Id: <39c10a1a_1@news.pacifier.com>
xxaxx@my-deja.com wrote:
> I'm using the following code to attempt posting a form to Ebay:
> sub post2ebay {
> my(%data) = @_;
> require LWP::UserAgent;
> my($ua) = LWP::UserAgent->new;
> $ua->agent('Mozilla/4.61 [en] (Win95; I)');
> my($url) = 'http://cgi2.ebay.com/aw-cgi/eBayISAPI.dll';
> my ($req) = HTTP::Request->new(POST => "$url");
> $req->content_type('application/x-www-form-urlencoded');
> $req->header('Accept' => 'text/html', Referer => "$url");
> my($stufftosend);
> foreach $key (keys %data) {
> $data{$key} =~ s/([!@#$%^&()_+\n])/sprintf("%%%02x",ord($1))/eg;
> $data{$key} =~ s/\s/+/g;
> $stufftosend .= "$key=$data{$key}&";
> }
> $stufftosend =~ s/&$//;
> $req->content($stufftosend);
> my ($res) = $ua->request($req);
> return($res->as_string);
> }
> This is called by:
> $SEND_DATA{'MfcISAPICommand'} = 'LeaveFeedback';
> $SEND_DATA{'userid'} = 'usernamehere';
> $SEND_DATA{'pass'} = 'passwordhere';
> $SEND_DATA{'otheruserid'} = 'persontoleavefeedbackfor';
> $SEND_DATA{'itemno'} = 'relateditemnumber';
> $SEND_DATA{'which'} = 'positive';
> $SEND_DATA{'comment'} = 'Great Ebay buyer. etc.';
> $SEND_DATA{'submit'} = 'leave feedback';
> $response = post2ebay(%SEND_DATA);
> The result of this is:
> HTTP/1.0 302 (Found) Object Moved
> Date: Wed, 13 Sep 2000 21:01:11 GMT
> Date: Wed, 13 Sep 2000 21:01:11 GMT
> Location:
> http://cgi3.ebay.com/aw-cgi/eBayISAPI.dll?userid=usernamehere&itemno=rel
> ateditemnumber&submit=leave+feedback&pass=passwordhere&comment=Great+Eba
> y+buyer.+etc.&which=positive&otheruserid=persontoleavefeedbackfor&MfcISA
> PICommand=LeaveFeedback
> Server: Microsoft-IIS/4.0
> Server: Microsoft-IIS/4.0
> Client-Bad-Header-Line: HTTP/1.0 501 Not Implemented
> Client-Date: Thu, 14 Sep 2000 06:36:32 GMT
> Client-Peer: 216.32.120.138:80
> I've run this with proper ids and passwords with same result.
> Has anyone managed to use the LWP::UserAgent POST method on ebay forms?
> Any help would be appreciated.
> Claude
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 10:40:35 -0700
From: Ron Hill <hillr@ugsolutions.com>
Subject: O'Reilly University of Perl 2000 CGI$WWW Programming in Perl class prerequisites
Message-Id: <39C10D93.EF44E6FF@ugsolutions.com>
According to the web page here is the prerequisites:
intermediate to advanced Perl programmers who know Perl 5 and are
familiar with the principles of CGI scripting.
However in the flier that I have received it states that no previous CGI
experence is required. Also It's for "occasional/intermediate" Perl
programmers (which I consider myself as).
My questions is : Which prereq should I beleive?
In my mind there is a big difference between occasional/intermediate and
intermediate to advanced. Also any recommendations as how to prepare for
this class?
Thanks
Ron Hill
------------------------------
Date: Thu, 14 Sep 2000 15:21:41 GMT
From: gittarman@my-deja.com
Subject: passing login & password to .htaccess via Perl script
Message-Id: <8pqqd9$tg9$1@nnrp1.deja.com>
Is there a way that you can use a Perl script to pass the login and
password to the .htaccess program. For instance, suppose I wanted to
create a form where the user can enter their login and password. This
information would be passed to a Perl script, which would in turn pass
these two fields to the .htaccess file or program. Right now I know only
how to have the person enter the login and password on the form and then
enter it again when they try to access a file in the password-protected
directory. I would appreciate any help on this matter. Thank you.
- Gittarman
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 17:38:06 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: passing login & password to .htaccess via Perl script
Message-Id: <1egym9o.nvaywf16tql37N%tony@svanstrom.com>
<gittarman@my-deja.com> wrote:
> Is there a way that you can use a Perl script to pass the login and
> password to the .htaccess program. For instance, suppose I wanted to
> create a form where the user can enter their login and password. This
> information would be passed to a Perl script, which would in turn pass
> these two fields to the .htaccess file or program. Right now I know only
> how to have the person enter the login and password on the form and then
> enter it again when they try to access a file in the password-protected
> directory. I would appreciate any help on this matter. Thank you.
Put the form in the password-protected area. :)
But... this is more of a CGI-than Perl question, so you so go to
comp.infosystems.www.authoring.cgi
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: 14 Sep 2000 17:39:28 GMT
From: Kevin Metcalf <notkmetcalf@notlighthousemarketingnot.com>
Subject: Re: passing login & password to .htaccess via Perl script
Message-Id: <39C10DBC.BCEACCA2@notlighthousemarketingnot.com>
You could only point to the script from within the pw protected directory.
That would allow you to only have to request it once.
Kevin
gittarman@my-deja.com wrote:
> Is there a way that you can use a Perl script to pass the login and
> password to the .htaccess program. For instance, suppose I wanted to
> create a form where the user can enter their login and password. This
> information would be passed to a Perl script, which would in turn pass
> these two fields to the .htaccess file or program. Right now I know only
> how to have the person enter the login and password on the form and then
> enter it again when they try to access a file in the password-protected
> directory. I would appreciate any help on this matter. Thank you.
>
> - Gittarman
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 09:28:55 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: Perl
Message-Id: <a17w5.404$0j.132182@news.uswest.net>
<patrick_k6801@my-deja.com> wrote:
> Hello NG,
> i am a newbie to perl and I have no questions. So please do not answer
> to this posting.
>
> But think of the following:
> Why is Perl so bad?
> Why is is it so slow and why did it get you so far, that you are
> accepting this f...... @#$\%-syntax ?
A) You're a troll, go away.
B) Perl is not bad.
C) Nor is it slow.
D) Maybe the reason you're having a hard time accepting the
natural and easy to use syntax is because you've been
brainwashed by other programming languages.
For a vast number of things (especially CGI), Perl wipes
the floor with other languages, in ease of use, in speed,
in functionality, in portability, and even in robustness
and security.
------------------------------
Date: 14 Sep 2000 17:37:54 GMT
From: Kevin Metcalf <notkmetcalf@notlighthousemarketingnot.com>
Subject: Re: Perl
Message-Id: <39C10D5D.FE4A3CB6@notlighthousemarketingnot.com>
If you have no questions, then why are there question marks at the end of
your sentences. You must use some incredible hi-tech language that I have
never heard of that uses a QM for a line delimeter. What is this awesome
language called? Is it that new "Question Based Ansi Standard Idiot's
Code?"
;)
patrick_k6801@my-deja.com wrote:
> Hello NG,
> i am a newbie to perl and I have no questions. So please do not answer
> to this posting.
>
> But think of the following:
> Why is Perl so bad?
> Why is is it so slow and why did it get you so far, that you are
> accepting this f...... @#$\%-syntax ?
>
> regards,
> Patrick
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 11:24:41 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <brian-ya02408000R1409001124410001@news.panix.com>
In article <Bh5w5.17142$a5.243003@news1.rdc1.mb.home.com>, andrew-johnson@home.com posted:
> In article <8pq6sd$6e1$1@nnrp1.deja.com>,
> Brendon Caligari <bcaligari@my-deja.com> wrote:
> ! upsetting was a book review i saw when hunting for perl books a few
> ! months ago. the review said that the book teaches perl even if you
> ! don';t have any programming experience.
> Why is it upsetting that a book teaches Perl programming to beginners
> who have no prior programming experience? Do you feel the same way
> about books that teach Pascal, or C to beginners, or is it just
> introductory Perl programming books that upset you?
perhaps he hasn't read your book or seen dha's glowing review of it in
which he says:
_Elements of Programming with Perl_ by Andrew L. Johnson is
the first book that you would want to actually recommend to
those people who say "I've heard about this 'PEARL' thing,
where can I learn more?" without worrying that they'll have
to be entirely retrained afterwards.
http://www.perl.org/books/elements.html
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Thu, 14 Sep 2000 17:18:36 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <8pr18i$6rs$1@nnrp1.deja.com>
In article <Bh5w5.17142$a5.243003@news1.rdc1.mb.home.com>,
andrew-johnson@home.com wrote:
> In article <8pq6sd$6e1$1@nnrp1.deja.com>,
> Brendon Caligari <bcaligari@my-deja.com> wrote:
> [snip]
>
> ! upsetting was a book review i saw when hunting for perl books a few
> ! months ago. the review said that the book teaches perl even if you
> ! don';t have any programming experience.
>
> Why is it upsetting that a book teaches Perl programming to beginners
> who have no prior programming experience? Do you feel the same way
> about books that teach Pascal, or C to beginners, or is it just
> introductory Perl programming books that upset you?
introductory perl programming books are fine....bought "learning
perl" and although I didn't like it, i think it's a good book.
"programming perl" i liked, and "advanced perl programming" i adhored.
as a writing style, i prefer books like arnold robbin's "sed & awk".
>
> ! I'll shoot the next guy I meet who'll say that he wants to learn
> ! programming and is therefore going to learn perl, vb, c..whatever.
>
> OK, you'll shoot a beginner who wants to start with Perl, VB, or C --
> what language would you recommend they start with ... oh, you already
> shot them, I guess you won't be recommending anything to them.
would you teach programming using basic?
if (something = something) then goto somewhere
Some languages (like perl) are more relaxed than, say...pascal.
For someone with at least a semi-sound programming background
that's fine. But if you're a beginner, a language like perl is
a sure way of never learning any sound practices. I believe
that an education in programming should be a rigorous exercise
in concepts and problem solving rather than a "see how easy it
is to do this", and "look how easy it is to do that".
I may have been unfair as I haven't yet read your book (could give
you my address for a free evaluation copy ;) and I'm sure it's
a brilliant masterpiece. Yet I still believe that Perl as a first
programming language is a lousy choice.
Brendon
++++
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 14 Sep 2000 17:10:35 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Returning values of unticked checkbox
Message-Id: <fE7w5.490$wN2.115075@news.uswest.net>
Larry Rosler <lr@hpl.hp.com> elucidates:
> jerome@activeindexing.com says...
>> $form_data{"box"}[0] = ($form_data{"box"}[0]) ? $form_data{"box"}[0] : 'no';
>
> Too many notes, Herr Mozart!
>
> $form_data{box}[0] ||= 'no';
This is why I love you, man.
Someday, I'll get than handicap to one digit.
------------------------------
Date: Thu, 14 Sep 2000 16:26:06 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: Running Program without wait for finish
Message-Id: <y_6w5.141$W3.170615808@news.frii.net>
In article <39BFF52B.67FC5601@megapage.ch>, Barna <barna@megapage.ch> wrote:
>Hi All
>
>I want to execute a program,
>
How many Perl programmers does it take to execute a program?
Guerr. Bar gb ubyq vg qbja. Bar gb phg vg'f guebng naq bar gb pbhag hc gur
tbys fpber.
chris
--
This space intentionally left blank
------------------------------
Date: Thu, 14 Sep 2000 17:28:33 +0100
From: David Hugh-Jones <davidhj@mail.com>
To: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: sprintf() rounding problem
Message-Id: <968949519.1319850538@news.uklinux.net>
Hi Gwyn,
I took your advice and tried sprintf("%.0f",...) instead of int(). This works
fine for $total=57. However, for $total=38, it goes too high, giving a value
with tax of 44.66 instead of 44.65. I assume that in this case, adding 0.5 to
4465 gives 4465.5, and sprintf() then rounds this up to 4466. In other words,
sprintf() will not work if my result is an integer (in cents).
My fundamental problem is, I am trying to do floating point arithmetic and then
need to round the results correctly (by accounting standards). Int isn't
accurate enough, and sprintf() rounds for mathematicians but not
accountants. Timeo mathematicos et equationes ferentes;-)
Is there anyone out there who has found a way to work this?
thanks
David
On Thu, 14 Sep 2000, Gwyn Judd wrote:
>I was shocked! How could David Hugh-Jones <davidhj@mail.com>
>say such a terrible thing:
>
>>I came to the conclusion that sprintf() wouldn't work because it sometimes
>>rounds .5 down, for very good mathematical reasons (as a kid I wondered why 0.5
>>"had to round up" - encouraging to know it doesn't). I want my rounding to round
>>0.5 up all the time, which I assume is the accounting convention.
>>
>>So I wrote something like this:
>>$total=57;
>>$tax=17.5;
>>$total+=$total*$tax$0.01;
>>$total*=100; #these 3 lines to round to 2 sig digits
>>$total+=0.5;
>>$total=int($total);
>>$total/=100;
>>
>>But I still get a problem. $total is 6697.5 after multiplying by 100, and 6698
>>after adding 0.5. But then int($total) puts it down to 6697!
>
>If you change the sixth line "$total=int($total);" to:
>
>$total = sprintf "%f.0", $total;
>
>Then it will do what you want (I think. It works for the example you
>gave, but it's not tested really). This is because although perl says
>$total is 6698 it's really more like 6697.9999999999999999998765 so when
>int() chops off the integer portion ugly things happen (did you read
>"perldoc -f int"). Anyway glad to see you read the advice and made an
>effort.
>
>--
>Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
>Whatever it is, I fear Greeks even when they bring gifts.
> -- Publius Vergilius Maro (Virgil)
------------------------------
Date: Thu, 14 Sep 2000 17:15:19 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: sprintf() rounding problem
Message-Id: <8pr12f$6g9$1@nnrp1.deja.com>
In article <968949519.1319850538@news.uklinux.net>,
David Hugh-Jones <davidhj@mail.com> wrote:
>
<shockingly inept de-jeopardification>
>
> On Thu, 14 Sep 2000, Gwyn Judd wrote:
> >I was shocked! How could David Hugh-Jones <davidhj@mail.com>
> >say such a terrible thing:
> >
> >>I came to the conclusion that sprintf() wouldn't work because it
sometimes
> >>rounds .5 down, for very good mathematical reasons (as a kid I
wondered why 0.5
> >>"had to round up" - encouraging to know it doesn't). I want my
rounding to round
> >>0.5 up all the time, which I assume is the accounting convention.
> >>
> >>So I wrote something like this:
> >>$total=57;
> >>$tax=17.5;
> >>$total+=$total*$tax$0.01;
> >>$total*=100; #these 3 lines to round to 2 sig digits
> >>$total+=0.5;
> >>$total=int($total);
> >>$total/=100;
> >>
> >>But I still get a problem. $total is 6697.5 after multiplying by
100, and 6698
> >>after adding 0.5. But then int($total) puts it down to 6697!
> >
> >If you change the sixth line "$total=int($total);" to:
> >
> >$total = sprintf "%f.0", $total;
> >
> >Then it will do what you want (I think. It works for the example you
> >gave, but it's not tested really). This is because although perl says
> >$total is 6698 it's really more like 6697.9999999999999999998765 so
when
> >int() chops off the integer portion ugly things happen (did you read
> >"perldoc -f int"). Anyway glad to see you read the advice and made an
> >effort.
> >
> Hi Gwyn,
>
> I took your advice and tried sprintf("%.0f",...) instead of int().
This works
> fine for $total=57. However, for $total=38, it goes too high, giving a
value
> with tax of 44.66 instead of 44.65. I assume that in this case, adding
0.5 to
> 4465 gives 4465.5, and sprintf() then rounds this up to 4466. In other
words,
> sprintf() will not work if my result is an integer (in cents).
>
> My fundamental problem is, I am trying to do floating point arithmetic
and then
> need to round the results correctly (by accounting standards). Int
isn't
> accurate enough, and sprintf() rounds for mathematicians but not
> accountants. Timeo mathematicos et equationes ferentes;-)
>
> Is there anyone out there who has found a way to work this?
>
> thanks
> David
Arg, the whole jeopardy thing has confused me....
How's this:
$rounded_up = int($value)==$value? $value : sprintf("%.0f",$value+0.5);
Or have I got the wrong end of the stick?
You want an always round up right?
Surely this was too trivial for a newsgroup?
Seems to fail for:
$value=4.0000000000000001;
Where it rounds down again.
I guess that's about the limit of the precision of the compare.
--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 4323
**************************************