[24939] in Perl-Users-Digest
Perl-Users Digest, Issue: 7189 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 29 06:06:45 2004
Date: Wed, 29 Sep 2004 03:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 29 Sep 2004 Volume: 10 Number: 7189
Today's topics:
Re: (Win32) Timing out a process while reading process' <kevin@vaildc.net>
Re: accessing perl's internal hashing algorithm <bik.mido@tiscalinet.it>
CGI.pm sticky hidden fields: why? (wana)
Re: FileDeletionByDate - Error (tomcat)
Re: FileDeletionByDate - Error (Anno Siegel)
Re: gather/take <bik.mido@tiscalinet.it>
Re: gtk2 / glade problem. <kalinaubears@iinet.net.au>
help with eval <simplitia@gmail.com>
Re: How to check size of harddisk? <qjason@starhub.net.sg>
Re: How to check size of harddisk? <spamtrap@dot-app.org>
Re: How to check size of harddisk? <kalinaubears@iinet.net.au>
Re: How to check size of harddisk? <ThomasKratz@REMOVEwebCAPS.de>
Re: How to embed javascript functionality into a Perl C (Vibhu)
Re: How to embed javascript functionality into a Perl C <tadmc@augustmail.com>
HTTP::Cookies cookie_jar %rest hash (bigDWK)
Re: Loop through scalar? <bik.mido@tiscalinet.it>
Re: Number of Days Between 2 Dates. <jkeen_via_google@yahoo.com>
Re: Perl vs PHP <jkeen_via_google@yahoo.com>
Re: Precedence of exponentiation (Anno Siegel)
Problem with garbage in serialized CGI::Session files <scarblac@pino.selwerd.nl>
Re: references to filehandle? <matrix_calling@yahoo.dot.com>
Re: references to filehandle? <bik.mido@tiscalinet.it>
use require and loading modules (buildmorelines)
Re: use require and loading modules <noreply@gunnar.cc>
Re: use require and loading modules (buildmorelines)
Re: Using C::Scan : How to ignore #includes ? <matrix_calling@yahoo.dot.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 29 Sep 2004 01:36:06 GMT
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: (Win32) Timing out a process while reading process' output?
Message-Id: <kevin-DDF188.21324628092004@news.verizon.net>
In article <pan.2004.09.28.16.54.58.466849@cfdlab.ae.utexas.edu>,
rtm <mclay@cfdlab.ae.utexas.edu> wrote:
> I am interested in running a process with a timeout. Also I'm
> interested in analyzing the output of this process.
>
> Under Unix, the solution is described clearly in the Perl Cookbook
> "16.10: Communicating between related processes" and 16.24 "Timing
> out an Operation". Enclosed below is an example showing what I want
> to do under Unix.
>
> I need to do this under Windows XP. As others have pointed out
> "alarm" works under 5.8+ and fork sorta works under 5.8+ under
> windows. But the unix example code below just hangs.
>
> So the best thing I have found is Win32::Job.
>
> []
>
> The only problem is that I can't see how you read the output while the
> process is running when using Win32::Job. Of course one can write the
> output to a file then read it back in after the process is finished.
Look at the "watch" method. The following is code (ripped out of a
program I use at work) that starts a console program and then reads its
output. (It may not work in isolation like this, but it should give you
an idea of how to do this.)
eval {
pipe FROM_PARENT, TO_CHILD or do {
die "can't create pipe from parent to child: $!\n";
};
pipe FROM_CHILD, TO_PARENT or do {
die "can't create pipe from child to parent: $!\n";
};
my $job = new Win32::Job;
$job->spawn(
$program,
$cmdline,
{
no_window => 1,
cwd => $cwd,
stdin => \*FROM_PARENT,
stdout => \*TO_PARENT,
stderr => \*TO_PARENT,
}
) or die($^E);
close FROM_PARENT;
close TO_PARENT;
TO_CHILD->autoflush(1);
my $ein = "";
vec($ein, fileno(FROM_CHILD), 1) = 1;
$job->watch(
sub {
my ($eout, $buffer);
while (select($eout = $ein, undef, undef, 0.01)) {
if (sysread(FROM_CHILD, $buffer, 16384)) {
$buffer =~ s/\r//g;
print $output $buffer;
} else {
last;
}
}
return 0;
},
0.1
);
$result = $job->status;
$return_status = 1;
close TO_CHILD;
close FROM_CHILD;
};
--
Kevin Michael Vail | a billion stars go spinning through the night,
kevin@vaildc.net | blazing high above your head.
. . . . . . . . . | But _in_ you is the presence that
. . . . . . . . | will be, when all the stars are dead.
. . . . . . . . . | (Rainer Maria Rilke)
------------------------------
Date: Wed, 29 Sep 2004 11:55:28 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: accessing perl's internal hashing algorithm
Message-Id: <8c1ll097k8eb0kcma46e08t54nar0kj325@4ax.com>
On Mon, 27 Sep 2004 18:00:04 GMT, Ala Qumsieh <notvalid@email.com>
wrote:
>The solution is to preallocate a large enough hash, if you think you can
> guess how many keys you will need:
>
> keys %hash = 5000;
Cool! A good example of how precious bits of information can leak in
clpmisc... actually it's all there in the docs, as I have promptly
checked, but, well: would I have done that had I not read this?!?
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 28 Sep 2004 20:20:22 -0700
From: ioneabu@yahoo.com (wana)
Subject: CGI.pm sticky hidden fields: why?
Message-Id: <bf0b47ca.0409281920.2ee07abb@posting.google.com>
Is there any justification for the 'stickiness' of hidden fields? A
web page viewer cannot legitimately enter a value into a hidden field,
so why would anyone want to hold over a value to the next page?
I really got stuck on this one for a while because I was creating a
session and passing the session id in a hidden field and it was
getting stuck there and not changing when it was supposed to until I
added -override=>1.
Also, in passing session id via url, Konqueror seems to have a problem
with this. Even with sample code from the Perl and MySQL book, I had
to go to the address bar and press enter each time as if I was typing
in the address with session id each time for it to work. I did not
bother to test this with Netscape since I prefer passing by hidden
field and that seems to work now that I know they are sticky.
------------------------------
Date: 29 Sep 2004 01:22:55 -0700
From: t.piotrowski@gmail.com (tomcat)
Subject: Re: FileDeletionByDate - Error
Message-Id: <404ed500.0409290022.689d4e7d@posting.google.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message
> Perl is case sensitive.
ech... it is :-)
There is no problem with undefined subroutine anymore but there is new
one...
"Can't use string ("D:\mp3") as a HASH ref while "strict refs" in use
at D:/Perl/site/lib/File/Recurse.pm line 36"
D:\mp3 is path in script:
"$Dir_Path = "D:\\mp3";"
Line 36 in MODULE is there:
"sub Recurse {
my $dirsref = shift || die 'Recurse: Need an array reference of
dirs';
my $rulesref = shift;
%files = (); # -- reset the global variable
# -- Set the rules to a hash that &wanted can access
%File::Recurse::RULES = %{ $rulesref }; ############# LINE
36 ###
# -- Process it all
finddepth(\&File::Recurse::wanted, @{ $dirsref });
return %files;
}"
Any ideas?
Regards,
Tom
------------------------------
Date: 29 Sep 2004 08:43:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FileDeletionByDate - Error
Message-Id: <cjdsjn$eme$1@mamenchi.zrz.TU-Berlin.DE>
tomcat <t.piotrowski@gmail.com> wrote in comp.lang.perl.misc:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message
>
> > Perl is case sensitive.
>
> ech... it is :-)
>
> There is no problem with undefined subroutine anymore but there is new
> one...
>
> "Can't use string ("D:\mp3") as a HASH ref while "strict refs" in use
> at D:/Perl/site/lib/File/Recurse.pm line 36"
What is the call that produces the error message? How are we supposed
to tell you what you do wrong when you don't say what you are doing?
> D:\mp3 is path in script:
> "$Dir_Path = "D:\\mp3";"
>
> Line 36 in MODULE is there:
> "sub Recurse {
> my $dirsref = shift || die 'Recurse: Need an array reference of
> dirs';
> my $rulesref = shift;
> %files = (); # -- reset the global variable
>
> # -- Set the rules to a hash that &wanted can access
> %File::Recurse::RULES = %{ $rulesref }; ############# LINE
> 36 ###
>
> # -- Process it all
> finddepth(\&File::Recurse::wanted, @{ $dirsref });
>
> return %files;
> }"
>
> Any ideas?
Yes. Read the documentation for the module you are using!
In your original posting, the call was
Recurse(\&Test_And_Delete, $Dir_Path);
A glance at "perldoc File::Recurse" shows that the call is supposed
to be
Recurse(\@dirs, \%rules);
You are giving it a subref where it expects an arrayref, and a scalar
where it expects a hashref. That won't work.
Anno
------------------------------
Date: Wed, 29 Sep 2004 11:55:40 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: gather/take
Message-Id: <v3ojl0tlnlv6b0q1c87eu9inn8atoe7gou@4ax.com>
On 28 Sep 2004 21:50:45 +1000, ? the Platypus {aka David Formosa}
<dformosa@zeta.org.au> wrote:
>Then I thourt, actually with a little mucking about I could implement
>it from within perl5. So I did.
Well done!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 29 Sep 2004 12:19:12 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: gtk2 / glade problem.
Message-Id: <415a1cd8$0$26020$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Andy Baxter wrote:
>
> The Gtk2 examples work OK, but I can't find any .pm files for
> Window,Dialog etc. anywhere in the perl path.
>
And I can't find it anywhere on CPAN either.
Google for Gtk2::Window. That turns up some documentation for that
module at sourceforge - though just where the module source is located
is anybody's guess. It's probably _somewhere_ on sourceforge.
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: 28 Sep 2004 23:24:06 -0700
From: "Alex Lee" <simplitia@gmail.com>
Subject: help with eval
Message-Id: <1096439046.737066.19030@h37g2000oda.googlegroups.com>
Dear all:
I am getting this weird error message from eval even when @$ is not
set.
example:
eval '**1';
yeilds erorr outpu:
Number found where operator expected at (eval 1) line 1, near "**1"
(Missing operator before 1?)
I am using the active state 806 perl version: 5.8.0
Does anyone know how I can silence this error from eval? I read
something about patches for certain versions of perl, but do not have
any details.
thanks in advance.
al
------------------------------
Date: Wed, 29 Sep 2004 12:32:37 +0800
From: Jason Quek <qjason@starhub.net.sg>
Subject: Re: How to check size of harddisk?
Message-Id: <nhekl09rnd1adrfmhbgvad390tvh6l426g@4ax.com>
Tad McClellan <tadmc@augustmail.com> wrote:
>Jason Quek <qjason@starhub.net.sg> wrote:
>
>> How can I use Perl to check the size of the harddisk and the amount of
>> space left?
>>
>> Any help would be appreciated.
>
>
>Managing the filesystem is the job of the Operating System,
>not of a programming language.
>
>How would you check the size of a harddisk without using Perl?
>
>You can likely do it whatever way that is from within Perl too,
>but we don't even know what OS you need this for...
Hi Tad
The OS is Windows XP Pro. I have an indexing script, which, after it
is run, needs to report on how much space is left on the harddisk.
Thank you.
Jason Q.
------------------------------
Date: Wed, 29 Sep 2004 01:07:24 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: How to check size of harddisk?
Message-Id: <Re-dneKNhp6Q3sfcRVn-sA@adelphia.com>
Jason Quek wrote:
> Tad McClellan <tadmc@augustmail.com> wrote:
>
>>How would you check the size of a harddisk without using Perl?
>>
>>You can likely do it whatever way that is from within Perl too,
>>but we don't even know what OS you need this for...
>
> The OS is Windows XP Pro. I have an indexing script, which, after it
> is run, needs to report on how much space is left on the harddisk.
Well, like Tad said - how would you do it without Perl? I.e. what
command would you run in a DOS box to get that information?
Once you find that out, the rest is simple - just use backticks or
open() to run that command and grab its output.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Wed, 29 Sep 2004 15:30:58 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: How to check size of harddisk?
Message-Id: <415a49c8$0$26035$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Jason Quek wrote:
d
>
> The OS is Windows XP Pro. I have an indexing script, which, after it
> is run, needs to report on how much space is left on the harddisk.
>
You can use Win32::AdminMisc for this.
my($total_drive_space, $available_space_on_this_drive) =
Win32::AdminMisc::GetDriveSpace($drive);
Cheers,
Rob
--
To reply by email u have to take out the u in kalinaubears.
------------------------------
Date: Wed, 29 Sep 2004 11:55:59 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: How to check size of harddisk?
Message-Id: <415a86b0$0$14520$bb690d87@news.main-rheiner.de>
Jason Quek wrote:
> Hi
>
> How can I use Perl to check the size of the harddisk and the amount of
> space left?
>
> Any help would be appreciated.
>
> Regards,
>
>
>
>
> Jason Q.
Look at this sub I posted a few weeks ago to get the info from WMI
http://www.google.de/groups?hl=de&lr=&ie=UTF-8&selm=4138a093%240%2414528%24bb690d87%40news.main-rheiner.de
Thomas
--
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-
------------------------------
Date: 28 Sep 2004 20:25:29 -0700
From: vbontala9@yahoo.com (Vibhu)
Subject: Re: How to embed javascript functionality into a Perl CGI script?
Message-Id: <b3d950bf.0409281925.480fcf74@posting.google.com>
Brendon,
I agree with you. Does it mean we can't do dynamic magic in CGI Perl?
If so, how can it happen? I had prior experience with JSP and
Javascript. JSP executes on server side and Javascript on the client.
What actually happens is when Javascript code is embedded inside a
server side script, client side code won't get interpreted by the
server. Server executes the server side part of it and evaluates it's
values and returns boh HTML and Javascript to the browser(client).
Client then displays HTML pages along with values returned by server.
I did this in JSP. But haven't ever seen how this can be done in perl.
So, I'd appreciate help.
Thanks again.
-Vibhu
Brendon Caligari <bcaligari@nospam.fireforged.com> wrote in message news:<4159d483$0$94918$bed64819@news.gradwell.net>...
> Vibhu wrote:
>
> > I have this fundamental problem where I am trying to generate some
> > HTML content using Perl CGI script. Currently, my CGI script uses some
> > variables to calculate and value retrieval stuff and throws that onto
> > a HTML format. In addition to this, I want to add dynamic capability
> > to my CGI script.
> >
> > For example, I generate a HTML web-page using Perl CGI code. In that
> > generated page, if I have some checkboxes/radio buttons/select windows
> > etc, I want to generate some dynamic content if I select one of those
> > elements. This means as soon as I select an item, one of the perl
> > functions should be invoked. Similarly, how could I do "onMouseOver",
> > "onClick" etc kind of stuff with Perl CGI scripts? Please help me.
> >
> > Thanks
> > -Vibhu
>
> CGI scripts are executed at the server side. And server side code can
> only be executed when page in question is requested from the server. To
> achieve what you are after you need code that can execute within the
> browser itself...such as JavaScript.
>
> B.
------------------------------
Date: Tue, 28 Sep 2004 22:58:08 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: How to embed javascript functionality into a Perl CGI script?
Message-Id: <slrnclkcmg.gat.tadmc@magna.augustmail.com>
[ Please do not top-post! It is seen as being rude. ]
Vibhu <vbontala9@yahoo.com> wrote:
> Brendon Caligari <bcaligari@nospam.fireforged.com> wrote in message news:<4159d483$0$94918$bed64819@news.gradwell.net>...
>> Vibhu wrote:
>> > I want to add dynamic capability
>> > to my CGI script.
I'm quite sure I don't know what you mean when you say "dynamic".
I think you mean "client side".
>> > For example, I generate a HTML web-page using Perl CGI code. In that
>> > generated page, if I have some checkboxes/radio buttons/select windows
>> > etc, I want to generate some dynamic content if I select one of those
>> > elements. This means as soon as I select an item, one of the perl
>> > functions should be invoked.
Perl code does not run on clients (browsers), it runs on servers.
>> CGI scripts are executed at the server side. And server side code can
>> only be executed when page in question is requested from the server. To
>> achieve what you are after you need code that can execute within the
>> browser itself...such as JavaScript.
> I agree with you.
It was a statement of fact, not of opinion.
> Does it mean we can't do dynamic magic in CGI Perl?
> If so, how can it happen? I had prior experience with JSP and
> Javascript. JSP executes on server side and Javascript on the client.
>
> What actually happens is when Javascript code is embedded inside a
> server side script, client side code won't get interpreted by the
> server.
When Javascript code is embedded inside a Perl server side script,
client side code won't get interpreted by the server.
So far so good...
> Server executes the server side part of it and evaluates it's
> values
A Perl program can do that. Good!
> and returns boh HTML and Javascript to the browser(client).
A Perl program can do that too. Good!
> Client then displays HTML pages along with values returned by server.
What are these "values returned by server"?
> I did this in JSP. But haven't ever seen how this can be done in perl.
Use Perl's print() function to output Javascript in the right place
in the CGI program's output.
That is, JSP embedded Javascript in its output, you can embed
Javascript in output from Perl programs too.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Sep 2004 20:33:29 -0700
From: daveGoogle@davewking.com (bigDWK)
Subject: HTTP::Cookies cookie_jar %rest hash
Message-Id: <9901b9fa.0409281933.7508018@posting.google.com>
From the HTTP::Cookies man page it shows this function
I believe I have the most current version of HTTP::Cookies (cpan tells
me I do).
$cookie_jar->scan( \&callback );
The argument is a subroutine that will be invoked for
each cookie stored in the $cookie_jar. The subroutine
will be invoked with the following arguments:
0 version
1 key
2 val
3 path
4 domain
5 port
6 path_spec
7 secure
8 expires
9 discard
10 hash
I can retrieve all this info, but i'm having problems getting the
values out of the hash that's returned. Here's my code
##########Code starts here, $c_jar has been filled with stuff from a
request###
$c_jar->scan(\&cookieCB);
sub cookieCB
{
my($ver, $keyC, $valC, $path, $domain, $port, $path_spec,
$secure, $maxage, $discard, %attr) = @_;
#then i do stuff with the values returned, all of these are
filled with values
#now to the hash
foreach my $key (keys(%attr))
{
print $key."\n";
}
}
##############End of Code###############3
The above code prints "HASH(0x[SomeHexNumber])" instead of the value
of the key. Of cource if I try and reference the value with this key
I get a blank value every time. Any ideas?
------------------------------
Date: Wed, 29 Sep 2004 11:55:34 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Loop through scalar?
Message-Id: <3bnjl05kqo2piso4st9j518go8rm1fa5re@4ax.com>
On 28 Sep 2004 00:02:16 -0700, jkinkade@datashelter.net (Jason
Kinkade) wrote:
>Theres obviously a new line after each Line#. I would like to loop
>through this variable line by line with something like
>
>foreach ($var)
>{
> print "Current Line: $_";
>}
BTW: curious indenting style!
Well, there should be nothing to add to what others already suggested
you and most definitely split() is the way anyone would reasonably go.
However, more as of a curiosity than anything else I'll mention that
you can also do
#!/usr/bin/perl
open my $fh, '<', \ <<"EOTXT" or die "D'Oh!";
line1
line2
line3
EOTXT
s/\d+$//,print while <$fh>;
__END__
But then (in your case) please *don't* do this... ;-)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Wed, 29 Sep 2004 01:15:29 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Number of Days Between 2 Dates.
Message-Id: <R0o6d.8962$sP2.5188@trndny04>
Fred Goldberg wrote:
> I have the current releace of ActiveState for Win32.
>
> I'm confused by the shear number of time and date modules and exactly what
> they are capable of doing. I need help calculating the number of days
> (including weekends) between two dates. All dates are in the format of
> mm/dd/yyyy. This format can be changed if needed.
>
> What module is best to use and what is the format of the function. Thanks.
>
> Fred
>
As other posters have stated, try Date::Calc. I use it in production
code at work. IIRC, ActiveState has a ppm for Date::Calc which means
that you don't need to have an installed C-compiler to install it. And
DeltaDays is indeed the function you want to use.
jimk
------------------------------
Date: Wed, 29 Sep 2004 01:12:54 GMT
From: Jim Keenan <jkeen_via_google@yahoo.com>
Subject: Re: Perl vs PHP
Message-Id: <q_n6d.8953$sP2.4292@trndny04>
? the Platypus {aka David Formosa} wrote:
> "Jürgen Exner" <jurgenex@hotmail.com> writes:
>
> [...]
>
>
>>How do you call the opposite of a tautology (i.e always false)?
>
>
> A contradiction.
>
Oh, no! The thread that wouldn't die! Didn't we drive a stake through
its heart?
------------------------------
Date: 29 Sep 2004 09:15:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Precedence of exponentiation
Message-Id: <cjduep$eme$2@mamenchi.zrz.TU-Berlin.DE>
Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
[...]
> I agree that it would have been better if Perl parsed -a ** b as
> (-a) ** b, but...
I disagree. Traditional mathematics construes -x as (-1) * x, and
consequently -a ** b = (-1) * (a ** b) = -(a ** b), because ** binds
tighter than *. Most computer languages follow suit. It would make
Perl a unicum to do otherwise.
Anno
------------------------------
Date: Wed, 29 Sep 2004 08:23:18 +0000 (UTC)
From: Remco Gerlich <scarblac@pino.selwerd.nl>
Subject: Problem with garbage in serialized CGI::Session files
Message-Id: <slrnclksl4.oq9.scarblac@pino.selwerd.nl>
We use PerlRun to run our site, which uses CGI::Session sessions,
the serialized session info is stored in /tmp.
Occasionally we get errors like this in our error log:
[Mon Sep 27 11:57:54 2004] [error] PerlRun: `syntax error at
(eval 20) line 1, near ";)"\n'
This happens when CGI::Session is running eval() on the contents
of the serialized session file, because when this happens we have
files that look like this (sorry for the mess):
$D = {"_SESSION_ID" => "307fdfadb1cc3be72a44d0c45fe793d9","_SESSION_ETIME" =>
1209600,"transport" => "BU","_SESSION_REMOTE_ADDR" => "xxx.xx.xxx.xx",
"_SESSION_CTIME" => "1096272044","Booking" =>
( ... deleted a lot of lines ... )
["03"],"to1" => [""]}, 'CGI' )}, 'Booking' ),"_SESSION_ATIME" =>
"1096387975","_SESSION_EXPIRE_LIST" => {}};)}, 'Booking'
),"_SESSION_ATIME" => "1096387975","_SESSION_EXPIRE_LIST" => {}};
In the next to last line, notice the ';)'. The ; is where the information
ends; up to there the string parses correctly, and contains all the info
that should be there. The syntax error occurs at the ).
It looks like the session file used to be bigger, and then got
overwritten with a smaller version, leaving the garbage at the end.
Now the question: does anybody have any ideas or clues as to why
this happens? We have no idea where to start looking.
Thanks for any insight.
--
Remco Gerlich
------------------------------
Date: Wed, 29 Sep 2004 10:39:44 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: references to filehandle?
Message-Id: <2Dr6d.54$4V.151@news.oracle.com>
Tad McClellan wrote:
[SNIP]
> Please stop asking hundreds of people around the world to read
> the docs to you, simply read them yourself and post only if you
> still have questions after that.
>
>
I am sorry I asked an obviously inane question like that. Won't happen again.
Thanks
Abhinav
--
------------------------------
Date: Wed, 29 Sep 2004 11:55:22 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: references to filehandle?
Message-Id: <sb1ll01ricjiqtm3qh3id9ah7j1a4a9jh7@4ax.com>
On Tue, 28 Sep 2004 20:01:46 +0530, Abhinav
<matrix_calling@yahoo.dot.com> wrote:
>> knowing "which $m" is the guilty one should be enough. OTOH you should
>> have noticed that my code contained also a \n-less warn() because in
>> that case it seemed to mo more meaningful to do so...
>
>That was interesting behaviour(for me..). Where can I find more about this ?
perldoc -f die
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 28 Sep 2004 18:10:09 -0700
From: bulk88@hotmail.com (buildmorelines)
Subject: use require and loading modules
Message-Id: <ee659c69.0409281710.38e1f2e4@posting.google.com>
As I understand, if I load a module with "use" it will be parsed
imidiatly on/read during compiled/eats up initial start-up time, if I
use "require" it is loaded when perl reaches the require statement?
I am trying to load a module, but I want to save time on start up, so
I want to load the module much later on in the program, and its not
always required.
------------------------------
Date: Wed, 29 Sep 2004 03:13:47 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: use require and loading modules
Message-Id: <2rugilF1dpkk8U1@uni-berlin.de>
buildmorelines wrote:
> As I understand, if I load a module with "use" it will be parsed
> imidiatly on/read during compiled/eats up initial start-up time, if
> I use "require" it is loaded when perl reaches the require
> statement?
>
> I am trying to load a module, but I want to save time on start up,
> so I want to load the module much later on in the program, and its
> not always required.
?? Then change your code, for god's sake.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 29 Sep 2004 02:56:57 -0700
From: bulk88@hotmail.com (buildmorelines)
Subject: Re: use require and loading modules
Message-Id: <ee659c69.0409290156.48c8f3e4@posting.google.com>
bulk88@hotmail.com (buildmorelines) wrote in message news:<ee659c69.0409281710.38e1f2e4@posting.google.com>...
> As I understand, if I load a module with "use" it will be parsed
> imidiatly on/read during compiled/eats up initial start-up time, if I
> use "require" it is loaded when perl reaches the require statement?
>
> I am trying to load a module, but I want to save time on start up, so
> I want to load the module much later on in the program, and its not
> always required.
I didnt have enough cola :(
What I was asking is, is there any way to load modules after the
initial compilation, as needed/on the fly/dynamically, so I wont be
loading code that will not get used?
As I understood, if I uses "use" to do it, the module will be parsed
and compiled when the program is run for the first time. I dont want
the module to be parsed and compiled when the program is run for the
first time, I want the module to be paresed and compiled when I say
its ok. how would I do this in Perl?
------------------------------
Date: Wed, 29 Sep 2004 11:18:49 +0530
From: Abhinav <matrix_calling@yahoo.dot.com>
Subject: Re: Using C::Scan : How to ignore #includes ?
Message-Id: <Hbs6d.58$4V.58@news.oracle.com>
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to
> Abhinav
> <matrix_calling@yahoo.dot.com>], who wrote in article <9qP5d.3$RZ2.83@news.oracle.com>:
>
>>For the above file, it rightly gives
>>
>>int func1( int x,
>> int y,
>> int z);
>>
>>I am using this string, returned from C::Scan, to match the protoype in the
>>file, and comment it out. Thus, the modified file I have should have the
>>prototype for func1 commented out.
>>
>>However, since C::Scan->get('fdecls') strips of comments, I am having a
>>problem.
>
>
> C::Scan needs to write statement/declaration boundaries. To do this,
> it needs to deal with whatever is "not C code": preprocessor directives,
> comments, literal strings.
>
> The first thing C::Scan does is running the input through
> preprocessor. Then the only (?) thing it needs to work with is literal
> strings (it needs to ignore C code which is embedded in literal
> strings, right?).
>
> As I said, you can use `cat' as a preprocessor; but C::Scan may get
> confused by the unpreprocessed code.
>
I was not aware of the Preprocessing step and thought that C::Scan was
doing everything itself. Thanks to some help from Hugo, we invoked the
preprocessor with the -C switch, which retained the comments in the file.
Its now working like a charm. :)
Thanks for your help
Abhinav
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7189
***************************************