[23525] in Perl-Users-Digest
Perl-Users Digest, Issue: 5734 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 31 09:06:31 2003
Date: Fri, 31 Oct 2003 06:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 31 Oct 2003 Volume: 10 Number: 5734
Today's topics:
Re: Anybody using PERL to control their house ? brianr@liffe.com
Aps and Linux <nonspammare@nospam.com>
Re: Aps and Linux <josef.moellers@fujitsu-siemens.com>
Re: Aps and Linux <nonspammare@nospam.com>
Re: Aps and Linux <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: Aps and Linux <jurgenex@hotmail.com>
Re: Checkbox - database checkbox, if checked gives val (Anno Siegel)
Re: difference between defined & exists <nobull@mail.com>
Re: Equivalent of "ls -t" ? <abigail@abigail.nl>
function modification <adj@demadrid.com>
Get Windows Task-Names?! <usenet@repsak.de>
Re: How Do I Use CGI->System Call As CronJob? <yan@NsOeSiPnAeMr.com>
Re: How Do I Use CGI->System Call As CronJob? (Anno Siegel)
Re: How to tell what modules are installed? (Jim Anderson)
Re: How to tell what modules are installed? <HelgiBriem_1@hotmail.com>
Re: How to tell what modules are installed? <ak+usenet@freeshell.org>
Re: How to tell what modules are installed? (Anno Siegel)
Re: How to tell what modules are installed? <noreply@gunnar.cc>
Re: How to tell what modules are installed? <HelgiBriem_1@hotmail.com>
Re: Logic Flow Question <nobull@mail.com>
Re: Logic Flow Question <usenet@morrow.me.uk>
Re: mldbm error <vervoom@hotmail.com>
Re: mldbm error <usenet@morrow.me.uk>
Re: newbie pass variables on CGI <usenet@morrow.me.uk>
Re: newbie pass variables on CGI <nobull@mail.com>
Re: newbie pass variables on CGI <flavell@ph.gla.ac.uk>
Re: Perl Cut Command <zawrotny@jaguar.sb.fsu.edu>
Projects (Robert Shaffer)
Video::Capture <stanb@panix.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Oct 2003 13:25:04 +0000
From: brianr@liffe.com
Subject: Re: Anybody using PERL to control their house ?
Message-Id: <vtad7h7d5b.fsf@liffe.com>
"Andrew Rich \(VK4TEC\)" <vk4tec@hotmail.com> writes:
> Anybody using automation and control ?
>
>
Have a look at:
http://search.cpan.org/search?query=x10&mode=all
HTH
--
Brian Raven
P.S. I suppose I really should be nicer to people today, considering
I'll be singing in Billy Graham's choir tonight... :-)
-- Larry Wall in <199709261754.KAA23761@wall.org>
------------------------------
Date: Fri, 31 Oct 2003 12:24:31 +0100
From: "Ste" <nonspammare@nospam.com>
Subject: Aps and Linux
Message-Id: <bntg8d$sbn$1@grillo.cs.interbusiness.it>
Hi all, with my old win2k server iis i had this file working, but with linux
and apache i have a problem:
http://delibere.onde.net/rimando.asp
Any idea?
Tks
Ste
------------------------------
Date: Fri, 31 Oct 2003 13:08:21 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: Aps and Linux
Message-Id: <3FA250B5.25BCD1D1@fujitsu-siemens.com>
Ste wrote:
> =
> Hi all, with my old win2k server iis i had this file working, but with =
linux
> and apache i have a problem:
> =
> http://delibere.onde.net/rimando.asp
I wouldn't touch that URL even with asbestos gloves.
interbusiness.it is one of the main sources of SPAM that I receive.
-- =
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 31 Oct 2003 13:33:42 +0100
From: "Ste" <nonspammare@nospam.com>
Subject: Re: Aps and Linux
Message-Id: <bntk9u$ajd$1@grillo.cs.interbusiness.it>
I'm sorry about what you wrote.
I'm not a spammer, this is a public administration server with
this code inside and a error somewhere near "if":
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Elezioni 2002 - Desenzano del Garda</title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv="cache-control" content="no-cache">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#660099" vlink="#999900"
alink="#CC9933">
<%
ipric = Request.ServerVariables("REMOTE_ADDR")
If (InStr(ipric,"10.2")>0) Then
Response.Redirect("http://delibereweb.onde.net:8081/cgi-bin/dati/atti1.mac/i
nput?")
ElseIf (InStr(ipric,"10.1")>0) Then
Response.Redirect("http://delibereweb.onde.net:8081/cgi-bin/dati/atti1.mac/i
nput?")
ElseIf (InStr(ipric,"172.")>0) Then
Response.Redirect("http://as400.onde.net/cgi-bin/dati/atti1.mac/input?")
ElseIf (InStr(ipric,"10.3")>0) Then
Response.Redirect("http://as400.onde.net/cgi-bin/dati/atti1.mac/input?")
Else
Response.Redirect("http://www.onde.net:8081/cgi-bin/dati/atti1.mac/input?")
End If
%>
<body>
</html>
"Josef Möllers" <josef.moellers@fujitsu-siemens.com> ha scritto nel
messaggio news:3FA250B5.25BCD1D1@fujitsu-siemens.com...
Ste wrote:
>
> Hi all, with my old win2k server iis i had this file working, but with
linux
> and apache i have a problem:
>
> http://delibere.onde.net/rimando.asp
I wouldn't touch that URL even with asbestos gloves.
interbusiness.it is one of the main sources of SPAM that I receive.
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: Fri, 31 Oct 2003 12:47:57 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: Aps and Linux
Message-Id: <Xns94258C244B864elhber1lidotechnet@62.89.127.66>
"Ste" <nonspammare@nospam.com> wrote in
news:bntk9u$ajd$1@grillo.cs.interbusiness.it:
[...]
> <html>
>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
> charset=windows-1252"> <title>Elezioni 2002 - Desenzano del
> Garda</title> <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
> <meta http-equiv="cache-control" content="no-cache">
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000" link="#660099" vlink="#999900"
> alink="#CC9933">
>
> <%
> ipric = Request.ServerVariables("REMOTE_ADDR")
> If (InStr(ipric,"10.2")>0) Then
[snipped more of the same]
That's not Perl. Why are you asking this here? Do you have a Perl question?
--
Cheers,
Bernard
------------------------------
Date: Fri, 31 Oct 2003 12:56:41 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Aps and Linux
Message-Id: <d_sob.37584$AU.1737@nwrddc01.gnilink.net>
Ste wrote:
> this is a public administration server with
> this code inside and a error somewhere near "if":
[...]
> If (InStr(ipric,"10.2")>0) Then
[...]
Case matters in Perl, the "if" should be all lower case.
And the "then" should be an opening curly bracket.
Is this even Perl code at all?
jue
------------------------------
Date: 31 Oct 2003 12:10:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Checkbox - database checkbox, if checked gives value of 1 .. how to sum ?
Message-Id: <bntjep$gjv$5@mamenchi.zrz.TU-Berlin.DE>
randy <searsdvdtech@yahoo.com> wrote in comp.lang.perl.misc:
> I don't need you to tell me how to handle my messages. If I want to
> top post. This is my choice.
Absolutely. So long.
> Who are you the Internet miss manners
> police? If you can't help then don't post to this thread.
Hypocrite.
Anno
------------------------------
Date: 31 Oct 2003 12:20:16 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: difference between defined & exists
Message-Id: <u9y8v1r43j.fsf@wcl-l.bham.ac.uk>
Ben Morrow <usenet@morrow.me.uk> writes:
> Is exists() not still useful for an array element, with exists($a[$n])
> being equivalent to ($n < @a)?
It is not equivalent - see other posts in this thread.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 31 Oct 2003 14:01:32 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Equivalent of "ls -t" ?
Message-Id: <slrnbq4qpr.4eb.abigail@alexandra.abigail.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMDCCXII
September MCMXCIII in <URL:news:bnr860$5gr$1@mamenchi.zrz.TU-Berlin.DE>:
[] Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
[] > Stan Brown (stanb@panix.com) wrote on MMMDCCXII September MCMXCIII in
[] > <URL:news:bnr1vh$gap$1@reader2.panix.com>:
[] > \\ I need to get a list of all the files in a given directory, sorted in
[] > \\ oldest -> newest into an array for processing.
[] >
[] >
[] > ls -t orders them from newest to oldest. Anyway, here's a solution
[] > (oldest to newest).
[] >
[] > my $dir = ".";
[] > opendir my $dh => $dir or die;
[] > my @files = map {substr $_ => 8}
[] > sort
[] > map {sprintf "%08x$_" => (stat) [9], $_} grep {! /^\./} readdir $dh;
[] ^^
[] That second "$_" seems to be a remnant of an earlier version. Otherwise,
[] it's a very true replication of "ls -tr", skipping files beginning with
[] "." and, cleverly, sorting alphabetically files that have the same mod-time.
[]
[] Oh, but it fails for a file named "hundred%safe". Maybe the earlier version
[] was preferable :)
There was no earlier version. The format was intended to be '%08x%s';
it's just that the directories I tested on didn't have files with %'s
in their names, so the typo remained unnoticed.
[] Why the hex format?
Because I know timestamps are 32 bit integers, which are at most 8
hex digits. I contemplated figuring out how many digits I needed,
but then I realized that being lazy would save memory, so I used
hex digits instead of normal digits.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Fri, 31 Oct 2003 14:05:18 +0100
From: "abraxas" <adj@demadrid.com>
Subject: function modification
Message-Id: <bntmea$njj3@news.hi.inet>
Hello,
i'm just a beginner using Perl and i have a little problem.
I have an html page with several links and a function that search the first
of those links. The function is the following:
search_first_link {
$cadena = $_[0];
$p = index ($cadena, '<a');
return -1 if ($p < 0);
$p1 = index ($cadena, 'href', $p);
return -1 if ($p1 < 0);
$p2 = index ($cadena, '>', $p1);
return -1 if ($p2 < 0);
$subcadena = substr ($cadena, $p1, $p2-$p1);
$reg_exp = "href=\"([^\"]+)\"";
return ($1) if ($subcadena =~ /$reg_exp/s);
return (-1);
}
It takes the html code as a parameter and returns the url of the first link
that it finds. For example, if the first link that the function find is the
following:
<a href="http://www.page.com">
My Page
</a>
it returns "http://www.page.com".
My problem is that also i want the function to return the text of the link,
"My Page".
How can I modify the function to get it?
Thanks and sorry for my awfull english!!! :-)
------------------------------
Date: Fri, 31 Oct 2003 13:22:07 +0100
From: Kasper Dziurdz <usenet@repsak.de>
Subject: Get Windows Task-Names?!
Message-Id: <bntk5d$14qnms$1@ID-210032.news.uni-berlin.de>
Hi,
is there a way or module to get the names of Windows tasks currently
running (for example "Google - Mozilla" but not "mozilla.exe")?!
Thanks,
Kasper
--
HTML::KTemplate | Perl module to process HTML templates.
http://search.cpan.org/dist/HTML-KTemplate/
Kopierschutz-Nein-Danke.de | Gegen kopiergeschützte Un-CDs!
http://www.kopierschutz-nein-danke.de/
------------------------------
Date: Fri, 31 Oct 2003 06:07:22 -0500
From: Captain Dondo <yan@NsOeSiPnAeMr.com>
Subject: Re: How Do I Use CGI->System Call As CronJob?
Message-Id: <bntfpa$epqe$1@news3.infoave.net>
Public Interest wrote:
> The CGI still want for the exec to be finished!!!. I have printout from the
> EXEC. and it kept showing on my browser!!!
man bash:
exec If command is specified, it replaces the shell.
When you run 'exec', there is no longer a script to return to. exec is
the last command any script will run.
If you want to return to it, use 'system'.
I'm guessing that perl and sh are consistent in the use of 'exec' and
'system'.
-Dondo
--
What am I on?
I'm on my bike, o__
6 hours a day, busting my ass. ,>/'_
What are you on? --Lance Armstrong (_)\(_)
------------------------------
Date: 31 Oct 2003 11:08:07 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How Do I Use CGI->System Call As CronJob?
Message-Id: <bntfqn$gjv$4@mamenchi.zrz.TU-Berlin.DE>
Public Interest <no@no.no> wrote in comp.lang.perl.misc:
> Another very very big problem:
>
> The CGI still want for the exec to be finished!!!. I have printout from the
> EXEC. and it kept showing on my browser!!!
>
> So they are still not independent.
That is because the child's STDOUT is the same as the parent's. If you
don't want to see output, re-direct it in the child process.
> And only the Child's print is out and parent's output is not printed..
>
> Try this: in test.cgi
>
> #!/usr/bin/perl
>
> print "Content-type: text/html\n\n";
> exec ('sh test.sh);
> print 'ok this is parent';
>
> in test.sh:
> ls -al
>
>
> Then in my browser, it shows all the files, but no 'ok this is hte parent'.
Of course it doesn't. Would you *please* take a look at the documentation
of the functions you're using? A successful call to exec() does *not*
return to the calling process. If you want that, use system().
Anno
------------------------------
Date: 31 Oct 2003 05:08:53 -0800
From: james.h.anderson@ssmb.com (Jim Anderson)
Subject: Re: How to tell what modules are installed?
Message-Id: <2cfb060a.0310310508.59046711@posting.google.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
> Jim Anderson wrote:
> > What's the best way to get a list of all the installed modules?
>
> That's a FAQ.
>
> perldoc -q installed
Unfortunately, this just tells me that there's no doc for 'installed'.
------------------------------
Date: Fri, 31 Oct 2003 13:15:20 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: How to tell what modules are installed?
Message-Id: <i0o4qv48p8fs32gtq8aki285k4g6qcf1f7@4ax.com>
On 31 Oct 2003 05:08:53 -0800, james.h.anderson@ssmb.com (Jim
Anderson) wrote:
>Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:
><bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
>> Jim Anderson wrote:
>> > What's the best way to get a list of all the installed modules?
>>
>> That's a FAQ.
>>
>> perldoc -q installed
>
>Unfortunately, this just tells me that there's no doc for 'installed'.
Then you either do not have Perl installed on your system
or the installation is broken. Which is it?
------------------------------
Date: Fri, 31 Oct 2003 13:23:19 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: How to tell what modules are installed?
Message-Id: <slrnbq4oi6.k84.ak+usenet@norge.freeshell.org>
In article <i0o4qv48p8fs32gtq8aki285k4g6qcf1f7@4ax.com>, Helgi Briem wrote:
> On 31 Oct 2003 05:08:53 -0800, james.h.anderson@ssmb.com (Jim
> Anderson) wrote:
>
>>Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:
>><bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
>>> Jim Anderson wrote:
>>> > What's the best way to get a list of all the installed modules?
>>>
>>> That's a FAQ.
>>>
>>> perldoc -q installed
>>
>>Unfortunately, this just tells me that there's no doc for 'installed'.
>
> Then you either do not have Perl installed on your system
> or the installation is broken. Which is it?
Hmmm...
$ perl -v
This is perl, v5.8.0 built for i386-openbsd
[...]
$ perldoc -q installed
No documentation for perl FAQ keyword `installed' found
--
Andreas Kähäri
------------------------------
Date: 31 Oct 2003 13:34:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to tell what modules are installed?
Message-Id: <bntocn$nvi$1@mamenchi.zrz.TU-Berlin.DE>
Jim Anderson <james.h.anderson@ssmb.com> wrote in comp.lang.perl.misc:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message
> news:<bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
> > Jim Anderson wrote:
> > > What's the best way to get a list of all the installed modules?
> >
> > That's a FAQ.
> >
> > perldoc -q installed
>
> Unfortunately, this just tells me that there's no doc for 'installed'.
Ah... you're running an older Perl. The FAQ suggests to use the
ExtUtils::Installed module. Another possibility is "perldoc perllocal".
That lists all modules that were properly installed through CPAN.
If you just want to know if module Xyz is installed, try "perldoc Xyz".
If you can read the documentation, the module is (most likely) installed,
if you can't it (most likely) isn't, though it can conceivably go
wrong either way.
Anno
------------------------------
Date: Fri, 31 Oct 2003 14:27:08 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to tell what modules are installed?
Message-Id: <bntogq$15kcdh$1@ID-184292.news.uni-berlin.de>
Helgi Briem wrote:
> On 31 Oct 2003 05:08:53 -0800, james.h.anderson@ssmb.com (Jim
> Anderson) wrote:
>> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:
>> <bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
>>> Jim Anderson wrote:
>>>> What's the best way to get a list of all the installed
>>>> modules?
>>>
>>> That's a FAQ.
>>>
>>> perldoc -q installed
>>
>> Unfortunately, this just tells me that there's no doc for
>> 'installed'.
>
> Then you either do not have Perl installed on your system or the
> installation is broken. Which is it?
Actually, I noticed that the Q/A in question is not included at
http://www.perldoc.com/perl5.8.0/pod/perlfaq3.html, so perldoc.com may
be broken as well. ;-) Or has somebody, for some inscrutable reason,
removed it deliberately?
Anyway, here it is:
http://faq.perl.org/perlfaq3.html#How_do_I_find_which_
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Fri, 31 Oct 2003 13:43:50 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: How to tell what modules are installed?
Message-Id: <o0p4qvoktjeb68f4816ku4614e7cvhe1pj@4ax.com>
On Fri, 31 Oct 2003 13:23:19 +0000 (UTC), Andreas Kahari
<ak+usenet@freeshell.org> wrote:
>> Then you either do not have Perl installed on your system
>> or the installation is broken. Which is it?
>
>Hmmm...
>
>$ perl -v
>
>This is perl, v5.8.0 built for i386-openbsd
>[...]
>$ perldoc -q installed
>No documentation for perl FAQ keyword `installed' found
So it's broken. You should look into that.
It seems to be endemic, because the section in question,
"How do I find which modules are installed on my system?"
should be in perlfaq3 and is there on most of my systems,
but not on yours, not on my Linux ES 2.1 with perl 5.6.1 nor on
http://perldoc.com/perl5.8.0/pod/perlfaq3.html
where it should be.
Hmmm, indeed.
Short answer:
#!perl
use warnings;
use strict;
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
my @modules = $inst->modules();
print join "\n",@modules;
__END__
------------------------------
Date: 31 Oct 2003 12:15:05 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Logic Flow Question
Message-Id: <u93cd9siwm.fsf@wcl-l.bham.ac.uk>
Ben Morrow <usenet@morrow.me.uk> writes:
> jrolandumuc@yahoo.com (JR) wrote:
> > my $i = 0;
>
> Did you add this line?
>
> > for my $i (0..$#items) {
>
> The 'my' here makes this create a new variable called $i, masking the
> old one, which now counts up from 0 to $#items. The old $i from the
> line above is never incremented, but neither is it ever printed.
>
> If you want access to the loop variable outside the loop, remove the
> 'my'.
No, don't do that. It will not make any difference. Perl will put it
straight back in. IMNSHO Perl should issue a warning when it does this
to encourge people to put an explict my when using a lexical variable
as a loop iterator variable.
The situation is subtly different for package variables.
my $i = 'outer $i';
my $i_p = sub { print \$i,$i,"\n" };
$i_p->();
for $i ( 'inner $i' ) { # Implied my
print \$i,$i,"\n";
$i_p->();
}
$i_p->();
our $j = 'outer $j';
my $j_p = sub { print \$j,$j,"\n" };
$j_p->();
for $j ( 'inner $j' ) {
print \$j,$j,"\n";
$j_p->();
}
$j_p->();
__END__
SCALAR(0x81059f4)outer $i
SCALAR(0x8105ab4)inner $i
SCALAR(0x81059f4)outer $i
SCALAR(0x81059f4)outer $i
SCALAR(0x8105b14)outer $j
SCALAR(0x8105ba4)inner $j
SCALAR(0x8105ba4)inner $j
SCALAR(0x8105b14)outer $j
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 31 Oct 2003 13:07:47 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Logic Flow Question
Message-Id: <bntmr3$9rp$2@wisteria.csv.warwick.ac.uk>
Brian McCauley <nobull@mail.com> wrote:
> Ben Morrow <usenet@morrow.me.uk> writes:
> > The 'my' here makes this create a new variable called $i, masking the
> > old one, which now counts up from 0 to $#items. The old $i from the
> > line above is never incremented, but neither is it ever printed.
> >
> > If you want access to the loop variable outside the loop, remove the
> > 'my'.
>
> No, don't do that. It will not make any difference. Perl will put it
> straight back in.
Sorry, yes, my error. (No pun intended.)
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: Fri, 31 Oct 2003 11:18:52 +0000
From: JS <vervoom@hotmail.com>
Subject: Re: mldbm error
Message-Id: <bntgg9$o3q$1@cspc1n11.baplc.com>
Ben Morrow wrote:
> vervoom@hotmail.com wrote:
>
>>I have some code to print from a multi-level hash that has been stored
>>using mldbm:
>>
>>use MLDBM qw(DB_File Storable);
>>tie my %appstaffwk, 'MLDBM', $appstaffwkdb or die $!;
>>
>>foreach $app (keys %appstaffwk){
>> $hashref=$appstaffwk{$app};
>> foreach $staffno (keys %$hashref){
>> print "\n$app:$staffno:$hashref->{$staffno}";
>> }
>>}
>>
>
> <snip>
>
>>It gives me the below error (when I have diagnostics switched on):
>>
>
> <snip>
>
>> Uncaught exception from user code:
>> Storable binary image v24.8 more recent than I am (v2.6) at
>>blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al)
>>line 364.
>
>
> I'm sorry to say this, but it looks to me like your database is
> corrupt. Storable seems to think that the data stored in the database
> was created by Storable.pm v24.8, but that won't be written for
> really *quite* some time...
>
> What happens when you run the following:
>
> use Data::Dumper;
> use MLDBM qw/DB_File Storable/;
>
> tie my %appstaffwk, MLDBM => $appstaffwkdb or die "tie failed: $!";
>
> for (keys %appstaffwk) {
> eval {
> print Dumper $appstaffwk{$_};
> 1;
> } or warn "\$appstaffwk{$_} is corrupt!\n";
> }
>
> __END__
>
> The eval{} is there so that if some of the entries are corrupt and
> others aren't, it'll carry on and try them all rather than dieing
> after the first.
>
> Ben
>
Thanks, you were right, the database was corrupted. I'm going to start
over again.
I just wondered, when I store my hash %appstaffwk which has 2 levels -
$appstaffwk{$app}{$staffno} my script which usually runs in 1 minute,
takes about 30 minutes. Is that normal? This is the code I've been using
to store the hash:
my $tmp=$appstaffwk{$app};
if (! defined $tmp->{$staffno}){
$tmp->{$staffno}=1;
$appstaffwk{$app}=$tmp;
}
It doesn't work if you just do:
$appstaffwk{$app}{$staffno}=1;
Is there anything I can do to make the hash storage faster?
Thanks,
JS.
------------------------------
Date: Fri, 31 Oct 2003 13:04:15 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: mldbm error
Message-Id: <bntmkf$9rp$1@wisteria.csv.warwick.ac.uk>
vervoom@hotmail.com wrote:
> I just wondered, when I store my hash %appstaffwk which has 2 levels -
> $appstaffwk{$app}{$staffno} my script which usually runs in 1 minute,
> takes about 30 minutes. Is that normal?
If this is the only hash which has more than one level, then this is
the only one which actually uses MLDBM as opposed to simply using
DB_File: so yes, I would expect it to be slower. How much slower I
couldn't say, having not used MLDBM. I would not expect that adding
more levels would cause any further decrease in speed, though.
> This is the code I've been using to store the hash:
>
> my $tmp=$appstaffwk{$app};
> if (! defined $tmp->{$staffno}){
> $tmp->{$staffno}=1;
> $appstaffwk{$app}=$tmp;
> }
>
> It doesn't work if you just do:
>
> $appstaffwk{$app}{$staffno}=1;
>
> Is there anything I can do to make the hash storage faster?
Read the WARNINGS section at the end of perldoc MLDBM.
Ben
--
It will be seen... that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher arises among them who... convinc[es] them that their
...institutions are not based on... morality. [Samuel Butler] ben@morrow.me.uk
------------------------------
Date: Fri, 31 Oct 2003 11:08:10 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: newbie pass variables on CGI
Message-Id: <bntfqq$9g$2@wisteria.csv.warwick.ac.uk>
news2003@wanadoo.es (John) wrote:
> This is a general question, I would like to know how can I pass
> variables from a page to another one. I am talking about a web page,
> under CGI.
>
> I can pass values, but I don't know how I could pass the full hash, or
> the full parameters.
(I take it you're using CGI.pm?)
You can retrieve the query-string with $query->query-string, and then
append this to another URI to invoke that script with the same
parameters.
Ben
--
Joy and Woe are woven fine,
A Clothing for the Soul divine William Blake
Under every grief and pine 'Auguries of Innocence'
Runs a joy with silken twine. ben@morrow.me.uk
------------------------------
Date: 31 Oct 2003 12:30:41 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: newbie pass variables on CGI
Message-Id: <u9u15pr3m6.fsf@wcl-l.bham.ac.uk>
news2003@wanadoo.es (John) writes:
> This is a general question, I would like to know how can I pass
> variables from a page to another one. I am talking about a web page,
> under CGI.
>
>
> I can pass values, but I don't know how I could pass the full hash, or
> the full parameters.
I use a hidden field populated using the Storable module and MIME
base64 encoding.
See also various modules with "Session" in their names.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 31 Oct 2003 12:33:09 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: newbie pass variables on CGI
Message-Id: <Pine.LNX.4.53.0310311224400.2294@ppepc56.ph.gla.ac.uk>
On Fri, 31 Oct 2003, Ben Morrow wrote:
> You can retrieve the query-string with $query->query-string, and then
> append this to another URI to invoke that script with the same
> parameters.
Hmmm, CGI.pm documentation is a bit vague in this area. I'm looking
at http://stein.cshl.org/WWW/software/CGI/
| query_string()
| Returns a query string suitable for maintaining state.
Does this mean it's in URLencoded form, or not?
At any rate, anyone who's using -oldstyle_urls should take note of
what it says about the need for HTML-escaping ampersands.
cheers
------------------------------
Date: 31 Oct 2003 13:20:40 GMT
From: Michael Zawrotny <zawrotny@jaguar.sb.fsu.edu>
Subject: Re: Perl Cut Command
Message-Id: <slrnbq4obd.6c9.zawrotny@jaguar.sb.fsu.edu>
Tintin <me@privacy.net> wrote:
> "Michael Zawrotny" <zawrotny@jaguar.sb.fsu.edu> wrote in message
> >
> > You could try "cut -b1-20,41-60".
>
> $ perldoc -f cut
> No documentation for perl function 'cut' found
The "cut" in question was the *nix utility. The OP was having trouble
getting those columns from a file with cut, and went looking for a
perl solution when it wasn't working, so I showed how cut could do the
job. See "man cut" for details.
Mike
--
Michael Zawrotny
Institute of Molecular Biophysics
Florida State University | email: zawrotny@sb.fsu.edu
Tallahassee, FL 32306-4380 | phone: (850) 644-0069
------------------------------
Date: 31 Oct 2003 04:04:25 -0800
From: qwickfire@hotmail.com (Robert Shaffer)
Subject: Projects
Message-Id: <3f1bb9b8.0310310404.4be005@posting.google.com>
Does anyone know where I can find some sort of list of unfinished
programming projects or open source projects that need developers?
Perl would be ideal. I need practice!
Thanks in advance.
Robert Shaffer.
------------------------------
Date: Fri, 31 Oct 2003 13:12:16 +0000 (UTC)
From: Stan Brown <stanb@panix.com>
Subject: Video::Capture
Message-Id: <bntn3g$d35$1@reader2.panix.com>
How can I select which card this module is accessing?
--
"They that would give up essential liberty for temporary safety deserve
neither liberty nor safety."
-- Benjamin Franklin
------------------------------
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 5734
***************************************