[15798] in Perl-Users-Digest
Perl-Users Digest, Issue: 3211 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 18:10:43 2000
Date: Tue, 30 May 2000 15:10:31 -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: <959724631-v9-i3211@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 30 May 2000 Volume: 9 Number: 3211
Today's topics:
including CGI.pm kills the program. <csorensen@uptimeresources.net>
Re: including CGI.pm kills the program. <tony_curtis32@yahoo.com>
Installing DBI.ppd <cedron.johnson@bridge.bellsouth.com>
Re: Is Perl for me? (Kragen Sitaker)
Modules in modules question jdaves@gilanet.com
Re: newbee regex question <andkaha@my-deja.com>
Re: newbee regex question <lr@hpl.hp.com>
Re: newbee regex question <aqumsieh@hyperchip.com>
Re: newbee regex question <lr@hpl.hp.com>
Re: newbee regex question (Neil Kandalgaonkar)
Re: newbee regex question <lr@hpl.hp.com>
Re: newbee regex question <tina@streetmail.com>
Re: newbee regex question <tina@streetmail.com>
Re: newbee regex question <transpulse@hotmail.com>
Re: oops Re: seeking method to encode email addresses i <nospam@devnull.com>
Re: perl and nanosleep()? (Abigail)
perl scheduling project <bob@nac.net>
Perl to JavaServlet <ankadakiaNOanSPAM@hotmail.com.invalid>
Re: Perl unusable as a programming language <kaleja@estarcion.com>
Re: Perl unusable as a programming language (Greg Bacon)
Re: Perl unusable as a programming language <dave@dave.org.uk>
Re: Perl unusable as a programming language (Malcolm Dew-Jones)
Re: Perl unusable as a programming language <Tbone@pimpdaddy.com>
Re: Perl unusable as a programming language <Tbone@pimpdaddy.com>
Re: Perl unusable as a programming language (Ilya Zakharevich)
Re: Perl unusable as a programming language <Tbone@pimpdaddy.com>
perl-5.6.0 and UTF8 character weirdness <aaccomazzi@my-deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 May 2000 14:08:42 EDT
From: Chris <csorensen@uptimeresources.net>
Subject: including CGI.pm kills the program.
Message-Id: <393403A7.83551557@uptimeresources.net>
This simple form handler works fine - without the cgi lines in it .. if
filled out it will mail to the appropriate address
if I keep the following portion of script in place .. . it will work ..
but the email it sends is blank !!
#####
use CGI ':standard';
open IDNT, ">>lstrans.txt" or die "can't write file: $!";
print IDNT cookie('ident'). "\n";
close IDNT;
####
Any ideas why this isn't working ???
#!/usr/bin/perl
use CGI ':standard';
open IDNT, ">>lstrans.txt" or die "can't write file: $!";
print IDNT cookie('ident'). "\n";
close IDNT;
$mailprogram = "/usr/lib/sendmail -t";
@required = ();
$youremail = "csorensen\@uptimeresources.net";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
foreach $check(@required) {
unless ($FORM{$check}) {
print "Content-type: text/html\n\n";
print "<html><head><title>Missing
Information</title></head>\n";
print "<body><h1>Missing Information</h1><br>\n";
print "I'm sorry, but it would appear that you've
forgotten to\n";
print "fill out the $check field. Please click\n";
print "back and try again.\n";
print "</body></html>\n";
exit;
}
}
if ($FORM{'email'}) {
unless ($FORM{'email'} =~ /\w+@\w+.\w+/) {
print "Content-type: text/html\n\n";
print "<html><head><title>Bad E-mail</title></head>\n";
print "<body><h1>Bad E-mail</h1><br>The e-mail address
that you've\n";
print "entered, $FORM{'email'}, is invalid. Please
click
back and\n";
print "try again.\n";
exit;
}
}
open (MAIL,"|$mailprogram");
print MAIL "To: $youremail\n";
print MAIL "From: $FORM{'email'}\n";
print MAIL "Subject: $FORM{'subject'}\n";
print MAIL "Hello. The following information has been submitted:\n\n";
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
unless ($name eq "response" || $name eq "email" || $name eq
"subject") {
print MAIL "$name: $value\n";
}
}
close MAIL;
if ($FORM{'response'} && $FORM{'email'}) {
open (RESPONSE, $FORM{'response'});
@response = <RESPONSE>;
close(RESPONSE);
open (MAIL,"|$mailprogram");
print MAIL "To: $FORM{'email'}\n";
print MAIL "From: $youremail\n";
print MAIL "Subject: $FORM{'subject'} -- Autoresponse\n";
foreach $line (@response) {
print MAIL "$line";
close MAIL;
}
print header ('text/html'),
print redirect ('/confirmation.htm');
------------------------------
Date: 30 May 2000 14:33:13 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: including CGI.pm kills the program.
Message-Id: <87ln0rsuiu.fsf@limey.hpcc.uh.edu>
>> On 30 May 2000 14:08:42 EDT,
>> Chris <csorensen@uptimeresources.net> said:
> This simple form handler works fine - without the cgi
> lines in it .. if filled out it will mail to the
> appropriate address
> if I keep the following portion of script in place
> .. . it will work .. but the email it sends is blank !!
> use CGI ':standard';
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
This is what CGI.pm does for you. Notice that this code
here allows unrestricted amounts of data to be uploaded
and thus is vulnerable to overflow attacks.
"perldoc CGI"
Then things uploaded are available through the method
param() regardless of what the HTTP method was.
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Tue, 30 May 2000 14:54:11 -0400
From: Cedron Johnson <cedron.johnson@bridge.bellsouth.com>
Subject: Installing DBI.ppd
Message-Id: <39340E52.5176B433@bridge.bellsouth.com>
I am trying to install the DBI module and have been unsuccessful. I am
typing the following at my dos prompt:
ppm install dbi.ppd
and I receive the following error:
Error installing package 'dbi.ppd' : Could not locate a PPD file for
package dbi.ppd
I am typing the ppm install comand in the path containing the PPD file.
I am running Active Perl on WinNT and Apache. Can anyone help?
Cedron
------------------------------
Date: Tue, 30 May 2000 19:49:05 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Is Perl for me?
Message-Id: <RWUY4.128892$681.2418521@news-east.usenetserver.com>
In article <8h0tf2$inj$1@nnrp1.deja.com>, <brondsem@my-deja.com> wrote:
>In article <8h0fuf$qru$1@porthos.nl.uu.net>,
> "Robert Voesten" <robert@pharmapartners.nl> wrote:
>> I just started Perl, because I'm a webdesigner; and there are 2
>(general)
>> ways of getting information from a client, who views your webpages:
>> A) ASP
>> B) CGI/PERL
>
>Another good language is ColdFusion by Allaire. It is quite simple and
>easy to learn, but is still quite powerful, especially if you plan on
>using databases.
As long as you're touting other languages on comp.lang.perl.misc, may I
suggest that Python is also a nice language for web stuff? Especially
with Zope. Ditto for Tcl, with AOLServer and the ArsDigita Community
System.
Perl, Python, and Tcl are widely-used languages built into web tools
that are free software. Cold Fusion is a sui generis proprietary
language built into proprietary web tools.
Oh, and there's PHP3, too. It's sui generis too, but it's also free
software.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either. :)
------------------------------
Date: Tue, 30 May 2000 21:06:36 GMT
From: jdaves@gilanet.com
Subject: Modules in modules question
Message-Id: <8h1agg$tee$1@nnrp1.deja.com>
Hi, all. I've got two source files, main.pl and common.pm, in the same
dir. main.pl has this at the top:
#!/usr/bin/perl -w
use common;
use strict;
. . .
common.pm has this at the top:
#!/usr/bin/perl -w
use strict;
use DBI;
use CGI qw/:standard :html3/;
use CGI::Carp qw(fatalsToBrowser);
. . .
Then there's a function in common.pm:
sub print_header() {
print $query->header;
print $query->start_html( -title=>$main_title,
-author=>$author,
-meta=>{'keywords'=>'stuff'},
-BGCOLOR=>'white');
}
This doesn't work. When I run this from the command line, I get two
warnings:
common.pm: Ambiguous use of title => resolved to "title" => at
common.pm line 150.
common.pm: Ambiguous use of meta => resolved to "meta" => at common.pm
line 152.
followed by the regular "offline mode enter name=value pairs" stuff.
Line 150 is, naturally enough, the first line of the 'start_html' stuff.
And when I call the cgi from a browser, I get a "mail.pl aborted due to
compilation errors".
The questions:
-Why does it want to change -title=> to "title" => ??
-Why does it only want to change -title and -meta, but not -author or
-BGCOLOR?
Thanks much in advance, I can give more chunks of code if necessary.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 18:03:13 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: newbee regex question
Message-Id: <8h0vok$km0$1@nnrp1.deja.com>
In article <3933F881.B571E960@hotail.com>,
transpulse@hotail.com wrote:
>
> hi there,
>
> i need help with reqex.
> i want to check a certain string for illegal charaters. (legel
charaters
> are a-z A-Z 0-9 - . /). How can i do this with regex.
>
> Thx for your help
>
> daniel
>
$str = "illägal";
if ($str =~ /[^a-zA-Z0-9\-\.\/]/) {
print "contains illegal characters\n";
} else {
print "does not\n";
}
Another equivalent RE is /[^\d\w\-\.\/]/
/A
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 30 May 2000 11:18:51 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbee regex question
Message-Id: <MPG.139da5e162070ae398ab03@nntp.hpl.hp.com>
In article <3933FB05.5DCCA75B@hotmail.com> on Tue, 30 May 2000 19:31:49
+0200, transpulse <transpulse@hotmail.com> says...
...
> > i need help with reqex.
> > i want to check a certain string for illegal charaters. (legel charaters
> > are a-z A-Z 0-9 - . /). How can i do this with regex.
You can do it with a regex, using a negated character class:
$illegal = $string =~ m![^a-zA-Z0-9./-]!;
But, depending on the data, you may be able do it much more efficiently
with the translation operator:
$illegal = $string =~ tr!a-zA-Z0-9./-!!c;
This has to scan the entire string, while the regex can stop after the
first illegal character. The Benchmark module may help you decide which
to use. In all likelihood, it will be translation.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 30 May 2000 18:25:41 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: newbee regex question
Message-Id: <7aln0ryjx5.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
Tina Mueller <tina@streetmail.com> writes:
> transpulse@hotail.com wrote:
> > i want to check a certain string for illegal charaters. (legel charaters
> > are a-z A-Z 0-9 - . /). How can i do this with regex.
>
> where's the problem? have you tried anything?
>
> print "not ok" if /[^\w\.]/
Close, but not quite there :)
Your regexp will not match a dash '-' which the OP seems to want to
match. Also, your regexp will match an underscore, which the OP
doesn't seem to want. Perhaps the OP is mistaken :)
Also, a slash should be matched, if I'm reading the post correctly.
Another suggestion would be to use tr/// if you simply want to know if a
character exists in a string:
print "not ok" if tr/a-zA-Z.-\///c;
--Ala
------------------------------
Date: Tue, 30 May 2000 11:26:43 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbee regex question
Message-Id: <MPG.139da7c13dac065f98ab04@nntp.hpl.hp.com>
In article <8h0vdv$268tc$11@fu-berlin.de> on 30 May 2000 17:57:20 GMT,
Tina Mueller <tina@streetmail.com> says...
> transpulse@hotail.com wrote:
>
> > i need help with reqex.
>
> perldoc perlre
>
> > i want to check a certain string for illegal charaters. (legel charaters
> > are a-z A-Z 0-9 - . /). How can i do this with regex.
>
> where's the problem? have you tried anything?
>
> print "not ok" if /[^\w\.]/
Three errors: '_' is OK by this regex; '-' and '/' are not.
Possible fourth error: if 'locale' is used, some other 'letter'
characters may become legal.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 30 May 2000 18:28:19 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: newbee regex question
Message-Id: <8h1183$99m$1@newsflash.concordia.ca>
In article <8h0vok$km0$1@nnrp1.deja.com>,
Andreas Kahari <andkaha@my-deja.com> wrote:
>Another equivalent RE is /[^\d\w\-\.\/]/
\w includes _, which is illegal by the OP's criteria.
\d is useless, since \w is a superset of \d.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Tue, 30 May 2000 11:30:04 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newbee regex question
Message-Id: <MPG.139da885a4f9b1f198ab05@nntp.hpl.hp.com>
In article <8h0vok$km0$1@nnrp1.deja.com> on Tue, 30 May 2000 18:03:13
GMT, Andreas Kahari <andkaha@my-deja.com> says...
> In article <3933F881.B571E960@hotail.com>,
> transpulse@hotail.com wrote:
> > i need help with reqex.
> > i want to check a certain string for illegal charaters. (legel
> > charaters are a-z A-Z 0-9 - . /). How can i do this with regex.
...
> $str = "illägal";
>
> if ($str =~ /[^a-zA-Z0-9\-\.\/]/) {
> print "contains illegal characters\n";
> } else {
> print "does not\n";
> }
>
> Another equivalent RE is /[^\d\w\-\.\/]/
That is by no means equivalent to the first. Now '_' becomes legal, and
in some locales the 'ä' in your example data becomes legal also, along
with a host of other 'letters'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 30 May 2000 18:46:08 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: newbee regex question
Message-Id: <8h129g$268tc$13@fu-berlin.de>
hi,
Andreas Kahari <andkaha@my-deja.com> wrote:
> In article <3933F881.B571E960@hotail.com>,
> transpulse@hotail.com wrote:
>> i want to check a certain string for illegal charaters. (legel
> charaters
>> are a-z A-Z 0-9 - . /). How can i do this with regex.
> Another equivalent RE is /[^\d\w\-\.\/]/
you don't need the \d because \w contains digits.
try it out,
$ perl -e'print "ok\n" if (1 =~ /\w/);'
ok
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 30 May 2000 19:22:14 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: newbee regex question
Message-Id: <8h14d6$268tc$19@fu-berlin.de>
hi,
Tina Mueller <tina@streetmail.com> wrote:
> transpulse@hotail.com wrote:
>> i want to check a certain string for illegal charaters. (legel charaters
>> are a-z A-Z 0-9 - . /). How can i do this with regex.
> print "not ok" if /[^\w\.]/
sorry,
this also will give no error when the string contains a "_",
so then you should try out one of the other
suggestions m![^a-z0-9\./-]!i
tina
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: Tue, 30 May 2000 23:35:32 +0200
From: transpulse <transpulse@hotmail.com>
Subject: Re: newbee regex question
Message-Id: <39343424.1B257B2E@hotmail.com>
Hey Tina,
I tried, I tell you, and I tried exactly what u wrote here, but i
didn't work for me
Thx anyway
hv a good one
Tina Mueller wrote:
>
> hi,
>
> transpulse@hotail.com wrote:
>
> > i need help with reqex.
>
> perldoc perlre
>
> > i want to check a certain string for illegal charaters. (legel charaters
> > are a-z A-Z 0-9 - . /). How can i do this with regex.
>
> where's the problem? have you tried anything?
>
> print "not ok" if /[^\w\.]/
>
> tina
>
> --
> http://www.tinita.de \ enter__| |__the___ _ _ ___
> tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
> search & add comments \ \ _,_\ __/\ __/_| /__/ perception
------------------------------
Date: 30 May 2000 21:35:04 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: oops Re: seeking method to encode email addresses in web pageforms
Message-Id: <8h1c68$5aq$0@216.155.32.165>
In article <3933D1DF.9B6AC663@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
| The WebDragon wrote:
| > In article <393066CA.319D5EEE@stomp.stomp.tokyo>, "Godzilla!"
| > <godzilla@stomp.stomp.tokyo> wrote:
|
| > | Extracted from Web Dragon's recent
| > | series of articles.
| > |
| > | PERL 5 VERSION
| > | (NO PRINT AT ALL)
|
| > (no, because I don't dereference the HOHOL until later on
| > in the output section)
|
|
| Precisely. This is why my Perl 4 code does four
| times as much with one-fourth the amount of coding
| as a Perl 5 version.
huh? if I *wanted* to print the data there, I certainly could... however
since I want to format the output in html I do it later, and by using
the HOHOL I can sort the output into gametype sections, use
$gametype.icon.jpg files (coming soon), and <<here documents around the
html sections (which I left out here to make the script body more
legible)
Interesting that you latch on to the first thing I said, and ignored the
remainder of my post.. please go back and finish reading it (suggestion,
noting the use of the word please) as there was a lot more information
there than just this..
--
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: 30 May 2000 21:33:55 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: perl and nanosleep()?
Message-Id: <8h1c43$59q$1@news.panix.com>
On 27 May 2000 05:05:03 GMT, force <forcenoube@zipworld.com.au> wrote:
++
++ Does anyone know if it's possible to sleep() in perl for less than
++ one millisecond? In particular, if there's an equivilant of nanosleep()
++ in perl (or a perl module).
FAQ.
Abigail
------------------------------
Date: Tue, 30 May 2000 15:38:38 -0400
From: Bob Palma <bob@nac.net>
Subject: perl scheduling project
Message-Id: <Pine.BSF.4.10.10005301538110.23284-100000@iago.nac.net>
I am starting a project the will involve some massive scheduling...
Description:
Generate a master schedule for a high-school for students
constraints on total number in class, available rooms, etc..
Does anyone know of any modules that would help or any pointers to other
scripts
that do this sort of processing?
Thanks in advance...
--
Robert Palma
bob@nac.net
--
.:|:..:|:. Route all you want, we'll make more
--
------------------------------
Date: Tue, 30 May 2000 12:55:58 -0700
From: Ashish Kadakia <ankadakiaNOanSPAM@hotmail.com.invalid>
Subject: Perl to JavaServlet
Message-Id: <00619fa8.fe3a33c0@usw-ex0104-031.remarq.com>
I heard people are moving from Perl to JavaServlet for CGI
purpose... Which major websites liked to stick to perl..?
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Tue, 30 May 2000 10:39:22 -0700
From: Russell Bornschlegel <kaleja@estarcion.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <3933FCCA.4AC3A0B4@estarcion.com>
Edward Avis wrote:
>
> Russell Bornschlegel <kaleja@estarcion.com> writes:
>
> >Perl does seem to me to have an advantage over some other languages in that
> >there's essentially only one implementation of the core language[1], as
> >opposed to countless C++ compilers which all differ from the Standard and
> >from each other in different subtle ways.
>
> Are you sure this is an advantage? Does Mac OS have an advantage over
> Unix of having only one implementation? I would say that a bit of
> competition is healthy.
I would rather that Perl's competition be, for example, Python, and not
Microsoft Visual Perl++.
*shudder*
-Russell B
------------------------------
Date: Tue, 30 May 2000 18:34:46 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Perl unusable as a programming language
Message-Id: <sj82e6d5pj75@corp.supernews.com>
In article <G8RY4.98360$hT2.399322@news1.rdc1.ct.home.com>,
Dan Sugalski <dan@tuatha.sidhe.org> wrote:
: $bar = "abc";
: $bar =~ /(b)/;
: foo($1);
:
: sub foo {
: "abc" =~ /(c)/;
: my $bar = shift;
: print $bar, "\n";
: }
:
: it prints c, because $1 (which you unshifted off the parameter list) was c
: at that point because of the regex match.
:
: Match variables behave in ways that can be reasonably called bizarre. :)
Perl's parameter passing operates under pass-by-reference semantics, so
the behavior is reasonable albeit initially surprising . I don't
usually run into problems like this because I tend to be a little
paranoid about match variables and copy their contents if I'll need them
later.
Greg
--
It's a good thing there's no LotR litmus test or perl would've been shy one
pumpkin holder. Or maybe I've just proven that there should be a LotR
litmus test. I don't think I really want to know.
-- Andy Dougherty
------------------------------
Date: Tue, 30 May 2000 19:35:18 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Perl unusable as a programming language
Message-Id: <be28jssbhu04l8u6bpu9vjemsa069ud4sg@4ax.com>
On Tue, 30 May 2000 10:39:22 -0700, Russell Bornschlegel
<kaleja@estarcion.com> wrote:
>I would rather that Perl's competition be, for example, Python, and not
>Microsoft Visual Perl++.
>
>*shudder*
Do you mean something like this?
<http://www.activestate.com/Corporate/Media_Center/News/Press959117519.html>
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: 30 May 2000 11:57:18 -0800
From: yf110@victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Perl unusable as a programming language
Message-Id: <39340f0e@news.victoria.tc.ca>
Dan Sugalski (dan@tuatha.sidhe.org) wrote:
: > Could you explain this comment please. I don't understand what the
: > issue would be with "f($1)"
: Because of some of the oddities of perl, accessing a match variable gets
: you the value of the variable at the time you use it. So if you do this:
: $bar = "abc";
: $bar =~ /(b)/;
: foo($1);
: sub foo {
: "abc" =~ /(c)/;
: my $bar = shift;
: print $bar, "\n";
: }
: it prints c, because $1 (which you unshifted off the parameter list) was c
: at that point because of the regex match.
Perhaps its just me, but that one doesn't seem that bizarre. Perl
variables are passed by reference, and your example (implicitly) reuses a
global variable before you make a copy of its original value.
------------------------------
Date: 30 May 2000 18:38:02 GMT
From: Tushar Samant <Tbone@pimpdaddy.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <8h11qa$277l$1@news.enteract.com>
simon@brecon.co.uk writes:
>Tushar Samant (comp.lang.perl.moderated):
>>But there are many versions. And although the powers that be are
>>mostly kind enough to make only syntax errors do something cool in
>>a new version, there is no saying how undocumented things will change.
>
>Speaking as a relatively minor power that is - what undocumented things?
>Perl doesn't have them.
Perl does "have them" in every sense of the term--if they are undocumented
*special cases*. I'll again bring up split /^/, which acts like /^/m. This
is a feature which is not optional, or seen only by people who venture "out
of the box". And the average programmer can only discover it accidentally.
>>the latter case, and starts with a yes/no question about a *general*
> ^^^^^^^^^
>>behaviour: e.g. does Perl do sequential evaluation in such-and-such
> ^^^^^^^^^^^^^
>>a case.
> ^^^^^^^
>
>Something appears inconsistent here. I'm going to accuse you of
>over-philosophising a purely practical matter.
Not really; I gave an example in my post. It was a general statement,
and involved a specific syntax: do B1, do B2, etc.
>> If it's true, no experimentation is going to prove it.
>
>I apparently have a lot to learn about the scientific method.
Scientific method is irrelevant here, and the messiest, DWIM-est
language can hardly be comparable to unknown "nature". A false
statement can be disproved in one case; a true statement verified
a hundred times will still leave doubt about some special case.
As for your example: $a = 1; $a++ giving $a == 2 is immediately
convincing, since it is documented. However, some paranoid enough
person would be well within rights to doubt it, because of known
undocumented special cases (in the language).
------------------------------
Date: 30 May 2000 18:41:27 GMT
From: Tushar Samant <Tbone@pimpdaddy.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <8h120n$27bq$1@news.enteract.com>
dan@tuatha.sidhe.org writes:
>[...]
>Match variables behave in ways that can be reasonably called bizarre. :)
Maybe Pedantic.pm could warn about the use of $1 outside of s/// ?
------------------------------
Date: 30 May 2000 19:23:45 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl unusable as a programming language
Message-Id: <8h14g1$ai4$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tushar Samant
<Tbone@pimpdaddy.com>],
who wrote in article <8h11qa$277l$1@news.enteract.com>:
> >I apparently have a lot to learn about the scientific method.
>
> Scientific method is irrelevant here, and the messiest, DWIM-est
> language can hardly be comparable to unknown "nature". A false
> statement can be disproved in one case; a true statement verified
> a hundred times will still leave doubt about some special case.
The largest differences are that usually nature does not change under
your foot, and nature has no malice. [Perl has as much (or as little)
malice as combined p5p.]
Ilya
------------------------------
Date: 30 May 2000 20:34:43 GMT
From: Tushar Samant <Tbone@pimpdaddy.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <8h18l3$2f74$1@news.enteract.com>
yf110@victoria.tc.ca writes:
>Perhaps its just me, but that one doesn't seem that bizarre. Perl
>variables are passed by reference, and your example (implicitly) reuses a
>global variable before you make a copy of its original value.
It doesn't seem very bizarre anymore, I agree. The $1 distracted me;
it wasn't much to do with it. sub f { $x=2; print shift() }; f($x=1);
would do the same "bizarre" thing...
------------------------------
Date: Tue, 30 May 2000 21:23:50 GMT
From: Alberto Accomazzi <aaccomazzi@my-deja.com>
Subject: perl-5.6.0 and UTF8 character weirdness
Message-Id: <8h1bgk$u8p$1@nnrp1.deja.com>
I'm planning to make extensive use of the new utf8 handling capabilities
in perl5.6.0, but I still feel very confused by the string manipulation
scheme or I'm getting stomped by implementation bugs. I have been
writing code assuming all along that to get a string containing utf8
characters I could use constructs like
$utf8char = chr($number);
$number = ord($utf8char);
to do character-based encoding and decoding, but something seems to go
wrong in the following test program:
alberto@guinan-476: cat -n utf8test.pl
1 use Devel::Peek;
2 no bytes;
3 use utf8;
4 $a = pack("U",197);
5 $b = chr(197);
6 $c = v197;
7 $d = "\x{c5}";
8 print "\n", map { $_, " " } ($a,$b,$c,$d);
9 print "\n", map { ord($_), " " } ($a,$b,$c,$d);
10 print "\n", map { unpack("U",$_), " " } ($a,$b,$c,$d);
11 print "\n", map { sprintf("%vx ", $_) } ($a,$b,$c,$d);
12 print "\n\n";
13
14 Dump $_ foreach ($a,$b,$c,$d);
alberto@guinan-477: perl5.6.0 utf8test.pl
à ŠŠÃ
Malformed UTF-8 character at utf8test.pl line 10.
Malformed UTF-8 character at utf8test.pl line 10.
195 197 197 197
197 65533 65533 197
c3.85 c5 c5 c5
SV = PV(0xf1c80) at 0x120ad4
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0xf101c "\303\205"\0
CUR = 2
LEN = 3
SV = PV(0xf1c14) at 0x120b1c
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0xf10ec "\305"\0
CUR = 1
LEN = 2
SV = PV(0xf1cf8) at 0x109510
REFCNT = 2
FLAGS = (POK,pPOK)
PV = 0xf1230 "\305"\0
CUR = 1
LEN = 2
SV = PV(0x10db04) at 0x109534
REFCNT = 2
FLAGS = (POK,pPOK,UTF8)
PV = 0xf1234 "\303\205"\0
CUR = 2
LEN = 3
As you can see the only string that seems to be properly tagged as being
utf8 is $d, which uses the \x{} constructs. Why can't I use chr() and
ord() to do the same thing? The perlunicode page states that
o The `chr()' and `ord()' functions work on characters.
This is like `pack("U")' and `unpack("U")', not like
`pack("C")' and `unpack("C")'.
but from what I can tell that does not seem to be the case here.
What am I missing?
Thanks,
-- Alberto
alberto@guinan-478: perl5.6.0 -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
Platform:
osname=solaris, osvers=2.6, archname=sun4-solaris
uname='sunos guinan 5.6 generic_105181-11 sun4u sparc '
config_args='-Dprefix=/proj/ads/soft/utils -Uinstallusrbinperl'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define
use64bitint=undef use64bitall=undef uselongdouble=undef
usesocks=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.8.1
cppflags='-I/proj/ads/soft/utils/include'
ccflags ='-I/proj/ads/soft/utils/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-L/proj/ads/soft/utils/lib '
libpth=/proj/ads/soft/utils/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/proj/ads/soft/utils/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under solaris
Compiled at Mar 23 2000 18:14:21
@INC:
/proj/ads/soft/utils/lib/perl5/5.6.0/sun4-solaris
/proj/ads/soft/utils/lib/perl5/5.6.0
/proj/ads/soft/utils/lib/perl5/site_perl/5.6.0/sun4-solaris
/proj/ads/soft/utils/lib/perl5/site_perl/5.6.0
/proj/ads/soft/utils/lib/perl5/site_perl/5.005/sun4-solaris
/proj/ads/soft/utils/lib/perl5/site_perl/5.005
/proj/ads/soft/utils/lib/perl5/site_perl
.
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 3211
**************************************