[18385] in Perl-Users-Digest
Perl-Users Digest, Issue: 553 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 23 09:05:35 2001
Date: Fri, 23 Mar 2001 06:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985356313-v10-i553@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 23 Mar 2001 Volume: 10 Number: 553
Today's topics:
Re: "perldoc" broken in Solaris 8 (Eric Bohlman)
Re: "perldoc" broken in Solaris 8 (Abigail)
Re: "perldoc" broken in Solaris 8 (Rafael Garcia-Suarez)
Re: [MySQL/DBI] Duplicate rows. <a.peacock@chime.ucl.ac.uk>
Re: checkbox problem <iltzu@sci.invalid>
Re: fetch back STDERR outputs nobull@mail.com
Re: Followup - evaluating functions in a FILE (Damian James)
form to mail Can I send the mail as an attachment?? <ade_101@yahoo.com>
Re: MySQL / DBI Problem <a.peacock@chime.ucl.ac.uk>
Naming returned files <gi59@dial.pipex.com>
Re: Pointers in Perl <bart.lateur@skynet.be>
POST method and cgi.pm <vprasad@americasm01.nt.com>
Re: POST method and cgi.pm (Rafael Garcia-Suarez)
problem ?? <Waarddebon@chello.nl>
Re: problem ?? <vmurphy@Cisco.Com>
Re: problem ?? (Rafael Garcia-Suarez)
Re: question on string identification <tinamue@zedat.fu-berlin.de>
Regex question (Ave Wrigley)
Re: Regex question (Abigail)
Re: regexp with // in the input string <krahnj@acm.org>
Re: regexp with // in the input string nobull@mail.com
Statistics <jonni@ifm.liu.se>
Re: Statistics (Bernard El-Hagin)
Tree of user defined objects <sree@india.ti.com>
Re: using closures (road to OO) <iltzu@sci.invalid>
Re: using closures (road to OO) <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Mar 2001 12:37:04 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: "perldoc" broken in Solaris 8
Message-Id: <99fg1g$6vm$1@bob.news.rcn.net>
Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
> I've recently started working as a consultant for Sun Microsystems, and
> in hacking around using the default Perl installation under Solaris 8, I
> noticed that "perldoc" is highly broken: it does not have a "-q" option
> (using it returns a failure/"usage" message, which lists all the
> switches - no "-q" anywhere in sight.) The only "release" info that I
> can find on the Solaris CDs is "February 2000"; the Perl version is,
> IIRC (no NG access from there), 5.005_03. Replacing the "perldoc"
> script with the one from my Linux laptop works fine (of course), and
> adds "-q" functionality - but I'm very surprised to find it missing in
> the first place.
-q was added in the perldoc that came with, IIRC, perl 5.004. Your site
has 5.003 installed, so its perldoc wouldn't have had -q.
Note that there was a massive effort to find and remove buffer-overrun
vulnerabilities before releasing 5.004, so most people recommend upgrading
any 5.003 installations.
> Any suggestions for whom I should notify?
Whoever administers your box.
------------------------------
Date: Fri, 23 Mar 2001 12:43:45 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: "perldoc" broken in Solaris 8
Message-Id: <slrn9bmh81.dtp.abigail@tsathoggua.rlyeh.net>
Eric Bohlman (ebohlman@omsdev.com) wrote on MMDCCLXI September MCMXCIII
in <URL:news:99fg1g$6vm$1@bob.news.rcn.net>:
%% Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
%% > I've recently started working as a consultant for Sun Microsystems, and
%% > in hacking around using the default Perl installation under Solaris 8, I
%% > noticed that "perldoc" is highly broken: it does not have a "-q" option
%% > (using it returns a failure/"usage" message, which lists all the
%% > switches - no "-q" anywhere in sight.) The only "release" info that I
%% > can find on the Solaris CDs is "February 2000"; the Perl version is,
%% > IIRC (no NG access from there), 5.005_03. Replacing the "perldoc"
%% > script with the one from my Linux laptop works fine (of course), and
%% > adds "-q" functionality - but I'm very surprised to find it missing in
%% > the first place.
%%
%% -q was added in the perldoc that came with, IIRC, perl 5.004. Your site
%% has 5.003 installed, so its perldoc wouldn't have had -q.
Eh, since when is 5.005_03 a release of perl 5.003?
Abigail
------------------------------
Date: Fri, 23 Mar 2001 13:13:57 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: "perldoc" broken in Solaris 8
Message-Id: <slrn9bmj0t.diu.rgarciasuarez@rafael.kazibao.net>
Eric Bohlman wrote in comp.lang.perl.misc:
> Ben Okopnik <ben-fuzzybear@geocities.com> wrote:
> > I've recently started working as a consultant for Sun Microsystems, and
> > in hacking around using the default Perl installation under Solaris 8, I
> > noticed that "perldoc" is highly broken: it does not have a "-q" option
> > (using it returns a failure/"usage" message, which lists all the
> > switches - no "-q" anywhere in sight.) The only "release" info that I
> > can find on the Solaris CDs is "February 2000"; the Perl version is,
> > IIRC (no NG access from there), 5.005_03. Replacing the "perldoc"
> > script with the one from my Linux laptop works fine (of course), and
> > adds "-q" functionality - but I'm very surprised to find it missing in
> > the first place.
>
> -q was added in the perldoc that came with, IIRC, perl 5.004. Your site
> has 5.003 installed, so its perldoc wouldn't have had -q.
The OP gave the right version number, Solaris 8 comes with perl 5.005_03:
$ uname -srv
SunOS 5.8 Generic
$ /usr/bin/perl --version
This is perl, version 5.005_03 built for sun4-solaris
[...]
To the OP : are you sure that you use the original perldoc given with
the OS, located in /usr/perl5/5.00503/bin by default ? My version
understands -q and works perfectly.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 23 Mar 2001 13:26:31 +0000
From: Anthony Peacock <a.peacock@chime.ucl.ac.uk>
Subject: Re: [MySQL/DBI] Duplicate rows.
Message-Id: <3ABB4F07.58B49624@chime.ucl.ac.uk>
Daniel Wilson wrote:
<SNIP>
> I was checking to see if the first UPDATE generated an error and if it did,
> because it would normaly result in the error 'Table 'database.A$info[3]'
> doesn't exist' but i found that occasionaly $sth->errstr will result in
> 'Lost connection to MySQL server during query' hence the if ($sth->errstr =~
> /doesn\'t exist/)
<SNIP>
"Lost connection to MySQL server..." that error message used to crop up
regularly on some earlier versions of mySQL.
I think this may be a mySQL issue...
------------------------------
Date: 23 Mar 2001 11:06:00 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: checkbox problem
Message-Id: <985343072.5324@itz.pp.sci.fi>
In article <F99u6.1536$SB2.127971@ruti.visi.com>, uNcONvEntiOnaL wrote:
>
>$phone = $in{"phone"};
>$whotocheckboxes = $in{"whotocheckboxes"};
>
>phone is a textbox, whotocheckboxes is a checkbox array.
As it's obviously not a proper array, I can only assume that you've
concatenated the values with some delimiter between them. In that case
the first step is to turn it back into an array again:
my @whotocheckboxes = split /,/, $in{whotocheckboxes};
(I'm assuming you've used a comma as your delimiter. YMMV.)
>The values of phone and the checkbox array (multiple if multiple
>ones are checked) need to be passed to another web page.
>
>print "<a HREF='http://www.sasha.com/contact2.html?phone=$phone&
>whotocheckboxes=$whotocheckboxes'>Return</a>\n";
my $phone = $in{phone};
my @whotocheckboxes = split /,/, $in{whotocheckboxes};
$phone = escape($phone);
@whotocheckboxes = map escape($_), @whotocheckboxes;
$phone = "phone=$phone";
@whotocheckboxes = map "whotocheckboxes=$_", @whotocheckboxes;
my $query = join '&', $phone, @whotocheckboxes;
my $url = escapeHTML("http://www.sasha.com/contact2.html?$query");
print qq(<a href="$url">Return</a>\n);
You don't have to do it one step at a time, of course, but it's more
readable this way. You may notice escape() and escapeHTML() in the code
above. Those functions are available from CGI.pm, but it's possible to
write your own:
sub escape {
local $_ = shift;
s/([^0-9A-Za-z])/sprintf "%%%02X", $1/eg;
return $_;
}
sub escapeHTML {
local $_ = shift;
s/&/&/g;
s/</</g;
s/>/>/g;
s/"/"/g;
return $_;
}
>whotocheckboxes only has one value in it, it doesn't remember
>all the checked boxes. Does someone know what else I need
>to add to capture and pass on all chosen checkboxes?
You mean even $in{whotocheckboxes} has only one value? In that case
you'll just have to fix your query parsing routine. Or better yet,
switch to CGI.pm. With that, all you need to do is:
use CGI qw/:cgi escapeHTML/;
my %in = ( phone => param('phone'),
whotocheckboxes => [ param('whotocheckboxes') ],
);
my $query = CGI->new(\%in)->query_string();
my $url = escapeHTML("http://www.sasha.com/contact2.html?$query");
print qq(<a href="$url">Return</a>\n);
Yes, I'm mixing the OO and non-OO interfaces of CGI.pm -- so?
The %in hash looks a lot like yours, except that $in{whotocheckboxes} is
an array reference, not a simple scalar.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: 23 Mar 2001 12:34:23 +0000
From: nobull@mail.com
Subject: Re: fetch back STDERR outputs
Message-Id: <u9d7b8irzk.fsf@wcl-l.bham.ac.uk>
"John Lin" <johnlin@chttl.com.tw> writes:
> package AG;
> use strict;
> local *ERR;
> open ERR,"+>>test.err" or die $!;
> open STDERR,">>&ERR" or die $!;
> my $tell = tell STDERR;
> END {
> if(tell(STDERR) > $tell) {
> seek ERR,$tell,0 or die "seek failed\n";
> print for <ERR>;
> }
> }
> 1
>
> And call it with a small program
>
> use AG;
> warn "hello\n";
>
> It won't work. The error message is:
>
> seek() on unopened file at AG.pm line 9.
> seek failed
> END failed--call queue aborted.
Get rid of the local(). Putting the local in there causes the file
handle AG::ERR to be closed as soon as the require() of AG.pm
completes.
BTW: unless you've made $, and $\ unequal:
print for <ERR>;
Is just a less eficient way to:
print <ERR>;
What I think you meant to say:
local $_;
print while <ERR>;
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 23 Mar 2001 13:30:41 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Followup - evaluating functions in a FILE
Message-Id: <slrn9bmjv6.k35.damian@puma.qimr.edu.au>
Gregory Toomey chose Fri, 23 Mar 2001 18:39:33 +1000 to say this:
> ...
>
>It's trivial to read the file into a list or variable.
>But can the file be processed to correctly evaluate each line?
>
perldoc -f eval
BTW, in future you should avoid 1) replying *above* the text you are
replying to, and 2) quoting the *entire* article to which you are referring.
Cheers,
Damian
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: Fri, 23 Mar 2001 12:39:56 -0000
From: "Wing Commander" <ade_101@yahoo.com>
Subject: form to mail Can I send the mail as an attachment??
Message-Id: <dAHu6.43787$g63.5551377@nnrp3.clara.net>
I am using a script that e-mails the contents of the form to me.
Currently the contents of the form is in the body of the e-mail, but I would
like to receive the form info as an attachment - is this possible??
if so are there any pre-written scripts available or is it just a couple of
lines of code I can add to my existing script??
Thanks in advance............
------------------------------
Date: Fri, 23 Mar 2001 13:29:44 +0000
From: Anthony Peacock <a.peacock@chime.ucl.ac.uk>
Subject: Re: MySQL / DBI Problem
Message-Id: <3ABB4FC8.10CAFD8B@chime.ucl.ac.uk>
Danni wrote:
>
> I have a serious problem, probably due to my lack of experience with MySQL and the DBI interface.
>
> I am designing an Ad Serving Daemon in perl using MySQL for databases. The Daemon forks to handle each request.
>
> The adserver is currently sending 130+ Queries per second to MySQL and i am getting a lot of duplicate entrees in the databases when i should only be getting single entrees.
>
> I was checking to see if the first UPDATE generated an error and if it did, because it would normaly result in the error 'Table 'database.A$info[3]' doesn't exist' but i found that occasionaly $sth->errstr will result in 'Lost connection to MySQL server during query' hence the if ($sth->errstr =~ /doesn\'t exist/)
>
> Can anyone see the fault in the code below, or any ideas on how i can optimise/improve this routeen.
>
> if ($dbh->do("UPDATE A$info[3] SET views = views + 1 WHERE day = $mday AND month = $month AND year = $year AND adid = $info[0]") <= 0) {
> if ($sth->errstr =~ /doesn\'t exist/) {
> $dbh->do("CREATE TABLE IF NOT EXISTS A$info[3] (day INTEGER, month INTEGER, year INTEGER, adid INTEGER, views INTEGER, uviews INTEGER, clicks INTEGER, spent DECIMAL(100,10))");
> $dbh->do("INSERT INTO A$info[3] VALUES ($mday, $month, $year, $info[0],1,$unique,0,$info[4])");
> } elsif (! $sth->errstr) {
> $dbh->do("INSERT INTO A$info[3] VALUES ($mday, $month, $year, $info[0],1,$unique,0,$info[4])");
> }
> } else {
> $dbh->do("UPDATE A$info[3] SET spent = spent + $info[4] WHERE day = $mday AND month = $month AND year = $year AND adid = $info[0]");
> $dbh->do("UPDATE A$info[3] SET uviews = uviews + $unique WHERE day = $mday AND month = $month AND year = $year AND adid = $info[0]");
> }}
Why have you sent this twice under different subject lines?
Just a general point. I would get out of the habit of using the ->do
method. Use the ->prepare, ->execute method.
You are also not checking for all errors, this would be useful.
------------------------------
Date: Fri, 23 Mar 2001 14:16:54 -0000
From: "Alan Hood" <gi59@dial.pipex.com>
Subject: Naming returned files
Message-Id: <3abb538f$0$12249$cc9e4d1f@news.dial.pipex.com>
I need to download a file using a value from a select box on the browser.
Since I connot alter the mime-types on the server I am trying to use a perl
script.
The following code works but returns the name of the script.
my $orderToDown = $orderPath.$formPars->param("SELECTED");
print "Content-type: application/octet-stream html\n\n";
open(ORDER,$orderToDown);
while(<ORDER>){
print $_;
}
close(ORDER);
}
I have tried to change the name by using Content-Location in the resonse
header as follows
print "Content-Location: (http://www.website.com/orderfile.ord)\n";
But this does not work.
Can anybody tell if this is possible and if so how ?.
Many thanks
Alan Hood
------------------------------
Date: Fri, 23 Mar 2001 13:50:21 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pointers in Perl
Message-Id: <l6lmbtcubcq538gv1pk33cuqdkpkoc5ei6@4ax.com>
Abigail wrote:
>Of course, the program would always output 987654321, regardless of
>the number on input.
That's a trick you yourself regularily do in this newsgroup.
--
Bart.
------------------------------
Date: Fri, 23 Mar 2001 05:55:49 -0500
From: "Prasad, Victor [FITZ:K500:EXCH]" <vprasad@americasm01.nt.com>
Subject: POST method and cgi.pm
Message-Id: <99fa7p$e8c$1@bcrkh13.ca.nortel.com>
If you have html code and you use the POST method - pass the data to a
cgi.pm module using script - to what variable does it pass it to?
How does the POST method work - I have seen it with out cgi.pm and it uses
pack and unpack and hex commands - what are these?
Any sample code of html using post passing it to a cgi.pm script for use?
Maybe a text fields send a first and last name?
Thanks,
V
------------------------------
Date: Fri, 23 Mar 2001 12:20:06 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: POST method and cgi.pm
Message-Id: <slrn9bmfru.db8.rgarciasuarez@rafael.kazibao.net>
Prasad, Victor wrote in comp.lang.perl.misc:
> If you have html code and you use the POST method - pass the data to a
> cgi.pm module using script - to what variable does it pass it to?
The same way that with a GET method. CGI.pm makes it transparent.
Get the values as usual with :
my $q = new CGI;
my $value = $q->param('name_of_the_input_field');
> How does the POST method work - I have seen it with out cgi.pm and it uses
> pack and unpack and hex commands - what are these?
The contents of the input fields are passed in the request content
instead of appending it to the URL (as with GET). unpack and hex
commands are used to decode the URL-encoded characters (e.g. '%20' to
' ').
> Any sample code of html using post passing it to a cgi.pm script for use?
> Maybe a text fields send a first and last name?
Except the method="POST" attribute in the <form> tag, this is exactly the
same as GET methods. For details, read your favorite HTML documentation
or tutorial.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 23 Mar 2001 13:18:22 GMT
From: "Waarddebon" <Waarddebon@chello.nl>
Subject: problem ??
Message-Id: <y2Iu6.2232245$%C1.29235813@Flipper>
In my script I use the following lines:
open(K,"/full/path/to/key_file") || die $!;
@rec=<K>;
close(K);
chomp(K);
but it gives me an error message, namely:
Can't modify constant item in safe chop at list.pl line 35, near "K)"
Execution of list.pl aborted due to compilation errors.
How to solve this problem ?
------------------------------
Date: 23 Mar 2001 08:26:23 -0500
From: Vinny Murphy <vmurphy@Cisco.Com>
Subject: Re: problem ??
Message-Id: <m3g0g4d3b4.fsf@vpnrel.cisco.com>
"Waarddebon" <Waarddebon@chello.nl> writes:
> In my script I use the following lines:
>
> open(K,"/full/path/to/key_file") || die $!;
> @rec=<K>;
> close(K);
> chomp(K);
>
> but it gives me an error message, namely:
> Can't modify constant item in safe chop at list.pl line 35, near "K)"
> Execution of list.pl aborted due to compilation errors.
>
> How to solve this problem ?
>
>
Don't chomp the closed filehandle, chomp the array @rec.
HTH.
--
Vinny
------------------------------
Date: Fri, 23 Mar 2001 13:31:04 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: problem ??
Message-Id: <slrn9bmk10.dln.rgarciasuarez@rafael.kazibao.net>
Waarddebon wrote in comp.lang.perl.misc:
> In my script I use the following lines:
>
> open(K,"/full/path/to/key_file") || die $!;
> @rec=<K>;
> close(K);
> chomp(K);
>
> but it gives me an error message, namely:
> Can't modify constant item in safe chop at list.pl line 35, near "K)"
> Execution of list.pl aborted due to compilation errors.
>
> How to solve this problem ?
By avoiding to chomp a filehandle.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 23 Mar 2001 11:57:09 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: question on string identification
Message-Id: <99fdml$113ha$2@fu-berlin.de>
R.J. Brown <u7rjb@csc.liv.ac.uk> wrote:
> I need to check the format of an input from a web page into a perl
> script but don't know how.
> It needs to be checked to ensure that there are no numbers or symbols in
> the string, letters allowed only.
> The solution I expect is really simple but I can't find the answer.
print "ok" unless tr/a-zA-Z/a-zA-Z/c
doesn't work for other characters that a-z, so
if you use locale, take a regex instead.
regards,
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanx
------------------------------
Date: Fri, 23 Mar 2001 12:53:18 GMT
From: Ave.Wrigley@itn.co.uk (Ave Wrigley)
Subject: Regex question
Message-Id: <3abb4665.251304096@news.lhr.globix.net>
Anyone know a neat regex for the follwing; capture from a string a
substing which contains any given 2 (3,4, ...) words, in any order.
Something along the lines of:
$string =~ /(?=.*foo)(?=.*bar)(.*?)(?<=foo.*)(?<=bar.*)/;
execpt that variable length lookbehind not implemented.
Ave Wrigley <Ave.Wrigley@itn.co.uk>
------------------------------
Date: Fri, 23 Mar 2001 13:13:21 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Regex question
Message-Id: <slrn9bmivh.dtp.abigail@tsathoggua.rlyeh.net>
Ave Wrigley (Ave.Wrigley@itn.co.uk) wrote on MMDCCLXI September MCMXCIII
in <URL:news:3abb4665.251304096@news.lhr.globix.net>:
}} Anyone know a neat regex for the follwing; capture from a string a
}} substing which contains any given 2 (3,4, ...) words, in any order.
}} Something along the lines of:
}}
}} $string =~ /(?=.*foo)(?=.*bar)(.*?)(?<=foo.*)(?<=bar.*)/;
}}
}} execpt that variable length lookbehind not implemented.
$_ = "There are a bar, a foo and a baz here.";
my @words = qw /foo bar baz/;
$" = "";
if (/^@{[map {"(?=.*?(\\b$_\\b))"} @words]}/) {
my $min = length;
map {$min = $_ if $min > $_} @- [1 .. $#-];
my $max = -1;
map {$max = $_ if $max < $_} @+ [1 .. $#+];
print substr $_, $min, $max - $min + 1;
print "\n";
}
__END__
bar, a foo and a baz
Abigail
--
my $qr = qr/^.+?(;).+?\1|;Just another Perl Hacker;|;.+$/;
$qr =~ s/$qr//g;
print $qr, "\n";
------------------------------
Date: Fri, 23 Mar 2001 11:54:15 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: regexp with // in the input string
Message-Id: <3ABB3B09.80022214@acm.org>
Thomas wrote:
>
> Hi,
>
> I have a regexp to find strings in a C-source file;
> m/i18n\(\"(.*?)\"/;
> $theString .= $1;
>
> This maches fine, and all i18n("blaat") are found,
> except when the text between the quotes contains a double slash.
> The
> i18n("http://blaat")
> did not mach; any idea how to mach this anyway?
$ perl -e '$_ = q{ i18n("http://blaat") }; m/i18n\(\"(.*?)\"/ and print
"$1\n";'
http://blaat
It works for me.
John
--
use Perl;
program
fulfillment
------------------------------
Date: 23 Mar 2001 12:34:47 +0000
From: nobull@mail.com
Subject: Re: regexp with // in the input string
Message-Id: <u9bsqsiryw.fsf@wcl-l.bham.ac.uk>
Thomas <zander@xs3.xs4all.nl> writes:
> This maches fine ... except when ...
> Using perl, version 5.005_03 built for i586-linux
Problem could not be reproduced on 5.005_03 built for i586-linux.
Please post short, strict, warning-free, complete example that
produces the symptoms described.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 23 Mar 2001 12:22:33 +0100
From: "Jonas Nilsson" <jonni@ifm.liu.se>
Subject: Statistics
Message-Id: <99fbgp$ikt$1@newsy.ifm.liu.se>
Has anyone looked into the statistics for this newsgroup? I've been away for
two days and i've got over 400 unread??? This is more than it used to be,
isn't it?
/jN
--
_______________________________
Jonas Nilsson
------------------------------
Date: Fri, 23 Mar 2001 11:22:21 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Statistics
Message-Id: <slrn9bmccn.s3u.bernard.el-hagin@gdndev32.lido-tech>
On Fri, 23 Mar 2001 12:22:33 +0100, Jonas Nilsson <jonni@ifm.liu.se> wrote:
>Has anyone looked into the statistics for this newsgroup? I've been away for
>two days and i've got over 400 unread??? This is more than it used to be,
>isn't it?
More than it used to be when?
Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'
------------------------------
Date: Fri, 23 Mar 2001 17:49:47 +0530
From: Sreekanth <sree@india.ti.com>
Subject: Tree of user defined objects
Message-Id: <3ABB3F63.4C4CE9FC@india.ti.com>
Hi,
Following statement
$hashtree->{a}->{b}->{c}->{d} = undef;
will create tree(one branch) of hashobjects with leaf being
undefined. My question is it possible to create tree of user
defined objects say "Node()" maintaining the same syntax as
above. That is following statement
$mytree->{a}->{b}->{c}->{d} = undef;
should give me tree of Node objects. At the creation of each
successive element in the tree perl should call constructor
of object Node. If possibe how can i do this. I tried with
"tie" but not successful.
Thanks a lot,
sreekanth
------------------------------
Date: 23 Mar 2001 11:27:19 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: using closures (road to OO)
Message-Id: <985346252.10004@itz.pp.sci.fi>
In article <tbk5ub44ktf1f7@corp.supernews.com>, Greg Bacon wrote:
>In article <985262286.23392.0.nnrp-09.c3ad6974@news.demon.co.uk>,
> W K <b_nospam_ill.kemp@wire2.com> wrote:
>
>: I have been reading the OO book, and I thought I could get this to work in
>: an ordinary subroutine
>:
>: #!/usr/bin/perl
>: use strict;
>: my $i=10;
>: while(<>){ print a_sub()," <",$i--,">\n" }
>:
>: {
>: my $i=20;
>: sub a_sub{return ("#". $i++."#")}
>: }
>:
>: Now it does work, and there is a closure,
>
>No. There's no closure.
Of course there's a closure, B::Deparse is just being silly. The only
problem the OP had was forgetting that the assignment "$i = 20" happens
at run time, not at compile time. Easily fixed:
#!/usr/bin/perl
use strict;
my $i=10;
while(<>){ print a_sub()," <",$i--,">\n" }
BEGIN {
my $i=20;
sub a_sub{return ("#". $i++."#")}
}
There. And yes, whoever said that moving the closure definition into a
module would help _was_ right -- that's because "use" is a compile-time
directive, so that anything in a "use"d module is effectively put in an
implicit BEGIN block.
The answer about removing "my", on the other hand, was utter bullshit of
course. But I rather think you all knew that already.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Fri, 23 Mar 2001 13:51:55 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: using closures (road to OO)
Message-Id: <j8lmbt4hjfhl21mf6sdp0g8gmiq7ck14ld@4ax.com>
Ilmari Karonen wrote:
> BEGIN {
> my $i=20;
> sub a_sub{return ("#". $i++."#")}
> }
Or:
{
my $i;
BEGIN {
$i = 20;
}
sub a_sub {
return ("#". $i++."#")
}
}
--
Bart.
------------------------------
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 V10 Issue 553
**************************************