[18708] in Perl-Users-Digest
Perl-Users Digest, Issue: 876 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 11 11:05:31 2001
Date: Fri, 11 May 2001 08:05:08 -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: <989593508-v10-i876@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 11 May 2001 Volume: 10 Number: 876
Today's topics:
ANNOUNCE: Regexp::Common 0.10 (Damian Conway)
Re: CGI=HASH(0x176ef80) Help Please! <bart.lateur@skynet.be>
Re: CGI=HASH(0x176ef80) Help Please! (Anno Siegel)
Re: CGI=HASH(0x176ef80) Help Please! (M.J.T. Guy)
Re: CGI=HASH(0x176ef80) Help Please! (Anno Siegel)
Re: DES-CBC without Crypt::CBC <jlcooke@engsoc.carleton.ca>
Re: Existing Script To Add Time <godzilla@stomp.stomp.tokyo>
Re: format Question (M.J.T. Guy)
I'M A NEWBIE PLEASE HELP! <deminem@gmx.de>
Re: I'M A NEWBIE PLEASE HELP! <bart.lateur@skynet.be>
Re: I'M A NEWBIE PLEASE HELP! <pne-news-20010511@newton.digitalspace.net>
Re: Large environment stops processes spawning (Anno Siegel)
Re: multi thread sockets <dan@tuatha.sidhe.org>
Re: multi thread sockets <bart.lateur@skynet.be>
Re: Proposed new pragma: caution. (Anno Siegel)
Re: Proposed new pragma: caution. (Bernard El-Hagin)
Re: Q: eval and bypassing ctrl-flow cases nobull@mail.com
Re: Q: eval and bypassing ctrl-flow cases <pedroni@inf.ethz.ch>
Re: Question about Const package (Anno Siegel)
Re: secure file download? <andras@mortgagestats.com>
Re: times function (Anno Siegel)
Re: use Apache::Htpasswd <starfire@zipcon.net>
Re: use Apache::Htpasswd <starfire@zipcon.net>
Re: weird error on @array syntax <bart.lateur@skynet.be>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 May 2001 13:10:40 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Regexp::Common 0.10
Message-Id: <9dgocg$d0b$1@towncrier.cc.monash.edu.au>
Keywords: perl, module, release
==============================================================================
Release of version 0.10 of Regexp::Common
==============================================================================
NAME
Regexp::Common - Provide commonly requested regular expressions
SYNOPSIS
use Regexp::Common;
while (<>) {
/$RE{num}{real}/
and print q{a number\n};
/$RE{quoted}
and print q{a ['"`] quoted string\n};
/$RE{delimited}{-delim=>'/'}/
and print q{a /.../ sequence\n};
/$RE{balanced}{-parens=>'()'}/
and print q{balanced parentheses\n};
/$RE{profanity}/
and print q{a #*@%-ing word\n};
}
DESCRIPTION
By default, this module exports a single hash (`%RE') that stores or
generates commonly needed regular expressions. Patterns currently
provided include:
* balanced parentheses and brackets
* delimited text (with escapes)
* integers and floating-point numbers in any base (up to 36)
* comments in C, C++, Perl, and shell
* offensive language
* lists of any pattern
* IPv4 addresses
Future releases of the module will also provide patterns for the
following:
* email addresses
* HTML/XML tags
* mail headers (including multiline ones),
* URLS (various genres)
* telephone numbers of various countries
* currency (universal 3 letter format, Latin-1, currency names)
* dates
* binary formats (e.g. UUencoded, MIMEd)
INSTALLATION
It's all pure Perl, so just put the .pm file in its appropriate
local Perl subdirectory.
AUTHOR
Damian Conway (damian@cs.monash.edu.au)
COPYRIGHT
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 0.10
- Fixed pod bug (thanks to all who reported it)
- Removed modification to C<$;>, added multiple flags per key
facility (Many thanks, Tim)
- Fixed ->matches and ->subs (thanks Todd)
- Fixed bad corner cases in $RE{num} (thanks David)
==============================================================================
AVAILABILITY
Regexp::Common has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Regexp-Common.tar.gz
==============================================================================
------------------------------
Date: Fri, 11 May 2001 13:05:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: CGI=HASH(0x176ef80) Help Please!
Message-Id: <stonftort7r2ondf21ngg71flk50e5e24d@4ax.com>
Anno Siegel wrote:
>According to Bart Lateur <bart.lateur@skynet.be>:
>> Anno Siegel wrote:
>>
>> >If the result is a scalar, ${ \ $query-param( 'fname')} works too.
>>
>> Even without the ">"?
>
>Hmmm? Maybe I'm dense, but what ">"?
Exactly.
IMO there should be a "->" between '$query' and 'param'.
--
Bart.
------------------------------
Date: 11 May 2001 13:07:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CGI=HASH(0x176ef80) Help Please!
Message-Id: <9dgo73$s3q$5@mamenchi.zrz.TU-Berlin.DE>
According to Bart Lateur <bart.lateur@skynet.be>:
> Anno Siegel wrote:
>
> >According to Bart Lateur <bart.lateur@skynet.be>:
> >> Anno Siegel wrote:
> >>
> >> >If the result is a scalar, ${ \ $query-param( 'fname')} works too.
> >>
> >> Even without the ">"?
> >
> >Hmmm? Maybe I'm dense, but what ">"?
>
> Exactly.
>
> IMO there should be a "->" between '$query' and 'param'.
Oh dear. Yes, I'm dense.
Anno
------------------------------
Date: 11 May 2001 13:15:36 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: CGI=HASH(0x176ef80) Help Please!
Message-Id: <9dgolo$2al$1@pegasus.csx.cam.ac.uk>
In article <9dgnc3$s3q$2@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>According to M.J.T. Guy <mjtg@cus.cam.ac.uk>:
>> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> >
>> >If the result is a scalar, ${ \ $query-param( 'fname')} works too.
>>
>> But be aware that there is currently a bug in this construct, in that
>> $query->param is evaluated in list context instead of scalar context.
>> This may or may not matter in the particular example.
>
>Oh. I wasn't aware of that. Is it that an outside list context
>is erroneously propagated, or will the inside of ${ ...} always
>be in list context? A cursory test seems to show that the latter
>is the case.
It's not the ${} - the content of {} will be evaluated in scalar
context. The bug is with \ EXPR in scalar context - in current Perls
EXPR will be evaluated in list context.
But you can always force it if it matters:
${ \ scalar $query->param( 'fname')}
Mike Guy
------------------------------
Date: 11 May 2001 13:23:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: CGI=HASH(0x176ef80) Help Please!
Message-Id: <9dgp4n$s3q$7@mamenchi.zrz.TU-Berlin.DE>
According to M.J.T. Guy <mjtg@cus.cam.ac.uk>:
> In article <9dgnc3$s3q$2@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >According to M.J.T. Guy <mjtg@cus.cam.ac.uk>:
> >> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> >
> >> >If the result is a scalar, ${ \ $query-param( 'fname')} works too.
> >>
> >> But be aware that there is currently a bug in this construct, in that
> >> $query->param is evaluated in list context instead of scalar context.
> >> This may or may not matter in the particular example.
> >
> >Oh. I wasn't aware of that. Is it that an outside list context
> >is erroneously propagated, or will the inside of ${ ...} always
> >be in list context? A cursory test seems to show that the latter
> >is the case.
>
> It's not the ${} - the content of {} will be evaluated in scalar
> context. The bug is with \ EXPR in scalar context - in current Perls
> EXPR will be evaluated in list context.
That's pretty bad. Amazing it doesn't bite more people.
> But you can always force it if it matters:
>
> ${ \ scalar $query->param( 'fname')}
I guess I'll stick with
my $qp = $query->param( 'fname');
print " ... $qp ...";
:)
Anno
------------------------------
Date: 11 May 2001 14:50:29 GMT
From: jlcooke <jlcooke@engsoc.carleton.ca>
Subject: Re: DES-CBC without Crypt::CBC
Message-Id: <3AFBFD72.3E610EA1@engsoc.carleton.ca>
Are you aware that CBC is an mode of operation for DES and not a cipher
per se?
Cipher Block Chaining. It should be part of a good DES impl'n. If not:
CBC = {0,0...};
loop:
M = {M[0]^CBC[0], M[1]^CBC[1], ...};
C = DES(M,KEY);
CBC = C;
So the nth block is dependent on all the previous blocks. My added
suggestion is to encrypt a message M' = {RAND, M[0], M[1], ...}. And
when decrypting, throw away the first block. This will prevent people
from being able to use knowledge of the first block of M as a starting
point for an attack.
JLC
Super-Simon wrote:
>
> Hi all,
>
> I have to encrypt / decrypt strings using DES-CBC. On my hostingserver is
> Crypt::DES installed, but not Crypt::CBC (the only Crypt modules installed
> are DES and Blowfish).
>
> Where can I get a .pl file doing this (without using another Crypt-module
> than Crypt::DES)??????
>
> With kind regards,
>
> Simon
------------------------------
Date: Fri, 11 May 2001 06:56:29 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Existing Script To Add Time
Message-Id: <3AFBEF8D.62573E8B@stomp.stomp.tokyo>
grasshopper wrote:
> Wondering if anyone has a script (bourne or perl) available which can
> calculate the elapsed time between two given times such as: 08:00 16:30
> which would be an elapsed time of 08:30.
You could approach this by simply converting your
times to total minutes and calculating from there
using basic arithmetic. This would be the most
easy and, perhaps the most logical approach.
However, this would not be as much fun as solving
this as a classic advanced primary grade level
word problem.
I've tested this script of mine below my signature
quite a bit. Nonetheless, there is a good chance
certain combinations of days and times will cop
a bug or two. I am leaving exhaustive testing and
writing correction code to you. This will, however,
provide you a basis upon which to build, if you
enjoy word problems. My suggestion would be to
work out any bugs you find, then work on adding
"my" and "our" variable declarations. Usually
easier to keep all variables global until you
have solved bugs and glitches.
$days is your span of days in typical human perspective
based on calendar dates, ignoring relative time. You can
modify this to total hours rather than days, but this
would be to cheat a word problem solution. A fancy print
would include number of days, then hours and minutes.
However, this doesn't suit my mathematical fancy, perhaps
yours though. Easy enough to modify to print elapsed days.
$time1 and $time2 are your start and end times, respectively.
Either have fun with this or toss it. Your choice.
Godzilla!
--
#!perl
print "Content-type: text/plain\n\n";
$days = 2;
$time1 = "23:59";
$time2 = "00:00";
if ($days < 0)
{ print "Time Travel Into The Past Is Not Allowed"; exit; }
if (($time1 == $time2) & ($days == 0))
{ print "There Is No Difference In Time."; exit; }
($hour1, $minute1) = split (/:/, $time1);
($hour2, $minute2) = split (/:/, $time2);
if ($hour1 > $hour2)
{
$hour1 = 24 - $hour1;
$hour_diff = $hour1 + $hour2;
}
else
{ $hour_diff = $hour2 - $hour1; }
if ($minute1 > $minute2)
{
$hour_diff--;
$minute1 = 60 - $minute1;
$minute_diff = $minute1 + $minute2;
}
else
{ $minute_diff = $minute2 - $minute1; }
if (($days > 0) & ($hour1 > $hour2))
{ $days--; }
if ($days > 0)
{ $hour_diff = $hour_diff + ($days * 24); }
if ($hour_diff < 0)
{ print "Time Travel Into The Past Is Not Allowed"; exit; }
if ($hour_diff < 10)
{ $hour_diff = "0$hour_diff"; }
if ($minute_diff < 10)
{ $minute_diff = "0$minute_diff"; }
print "Time Difference:\n Hours: $hour_diff\n Minutes:$minute_diff";
exit;
------------------------------
Date: 11 May 2001 13:21:14 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: format Question
Message-Id: <9dgp0a$2p3$1@pegasus.csx.cam.ac.uk>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "M" == M J T Guy <mjtg@cus.cam.ac.uk> writes:
>
>M> Or indeed, exploiting the wondrous facilities of y///
>
>M> $pwd =~ y/A-Za-z/22233344455566677788899900/;
>M> # abcdefghijklmnopqrstuvwxyz
>
>Meaning that A-Z becomes those digits (2's through 0's), and
>everything after that becomes the last digit repeated, making them all
>0's? I don't understand how that's "wonderous". Why would I want all
>lowercase characters to be 0?
Ooops. Sorry. I'd somehow got it into my head that the entire
replacement string got repeated, not just the last character.
Mike Guy
------------------------------
Date: Fri, 11 May 2001 16:04:17 +0200
From: "Fabian Klein" <deminem@gmx.de>
Subject: I'M A NEWBIE PLEASE HELP!
Message-Id: <9dgr96$i2r89$1@ID-68671.news.dfncis.de>
i programmed a counter for a websiede in perl..it works fine ubt the
proeblem is that i do not knoew how to start the script via a html page...
thanks Fabian
------------------------------
Date: Fri, 11 May 2001 14:24:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: I'M A NEWBIE PLEASE HELP!
Message-Id: <3btnft042tubgo8duuloplesqubhddeofq@4ax.com>
Fabian Klein wrote:
>i programmed a counter for a websiede in perl..it works fine ubt the
>proeblem is that i do not knoew how to start the script via a html page...
<http://web.stonehenge.com/merlyn/WebTechniques/col13.html>
Another way is for your script to output an image, that the browser can
show.
HTML:
<img src="mycounter.cgi">
But in that case, you need to use a scriptable graphics program that can
combine several digit images into one number image.
--
Bart.
------------------------------
Date: Fri, 11 May 2001 16:38:39 +0200
From: Philip Newton <pne-news-20010511@newton.digitalspace.net>
Subject: Re: I'M A NEWBIE PLEASE HELP!
Message-Id: <33unft0npdkq2q9ic3jea0eu4vott1gh5b@4ax.com>
On Fri, 11 May 2001 16:04:17 +0200, "Fabian Klein" <deminem@gmx.de>
wrote:
> i programmed a counter for a websiede in perl..it works fine ubt the
> proeblem is that i do not knoew how to start the script via a html page...
Does it output an image? Then the HTML page probably contains an <img
src="http://www.example.com/yourscript" height="12" width="48"
alt="[counter]" /> tag. Install your script so that it can be called
via HTTP and, probably, CGI. How to do this depends on your web
server: it may have to go into a particular directory, you may need to
set certain permissions on the directory the script lives, you may
need to add mappings to the Windows registry, or make sure the first
line of the script contains a correct shebang line. Ask in a group
about webservers (e.g. comp.infosystems.www.servers.unix or one of its
siblings).
Does it output text? Then you might be able to use server-side
includes (SSI). How this works depends, again, on your web server. Try
another group.
In either case, comp.infosystems.www.authoring.cgi may be able to help
you further, since the procedure will undoubtedly be very similar,
regardless of whether your script is written in Perl or in C or in
Lisp --> hence, it's not a Perl question.
Hope this helps.
Oh, and please choose a more descriptive subject line next time.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 11 May 2001 13:17:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Large environment stops processes spawning
Message-Id: <9dgopt$s3q$6@mamenchi.zrz.TU-Berlin.DE>
According to Chris Jack <donotreply@interbulletin.bogus>:
>
> I am using perl, version 5.004_04 built for PA-RISC2.0 on an
> HP machine running Unix version10.20.
>
> If the size of the environment gets beyond about 20K, Perl stops
> being able to spawn processes: e.g. the following program prints
> nothing:
> $ENV{a} = "a" x 40000;
> system("echo hi");
>
> For various reasons, it is difficult for me to reduce the size
> of the environment or upgrade the Perl version.
>
> Does anyone have any suggestions or workarounds?
That looks more like a HP_UX kernel limitation than one of perl.
Can you fork from a shell? What is in $! after the failed attempt?
Anno
------------------------------
Date: Fri, 11 May 2001 14:01:41 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: multi thread sockets
Message-Id: <9hSK6.55680$Ce4.4780289@news1.rdc1.ct.home.com>
novastar <root@novastar.dtdns.net> wrote:
> Hello all,
> I am scannining my network with 10 threaded sockets each time. When all
> these 10 threads have been terminated I have to go for the next 10 sockets
> and so on. My problem is that I can not figure out if all these10 threads
> have been terminated for sure in order to go for the next.
Write your code so they tell you. Or join the threads, if you're spawning
off fresh threads every time.
Dan
------------------------------
Date: Fri, 11 May 2001 14:16:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: multi thread sockets
Message-Id: <6usnftolnvm3edljp0j4pmjjhoss0jqu60@4ax.com>
novastar wrote:
>I am scannining my network with 10 threaded sockets each time. When all
>these 10 threads have been terminated I have to go for the next 10 sockets
>and so on. My problem is that I can not figure out if all these10 threads
>have been terminated for sure in order to go for the next.
Threads, or forks?
In case of the latter, waitpid() can tell you if there are still any
children alive. Er, "on some systems", that's what "perlfunc -f waitpid"
says.
--
Bart.
------------------------------
Date: 11 May 2001 13:06:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Proposed new pragma: caution.
Message-Id: <9dgo45$s3q$4@mamenchi.zrz.TU-Berlin.DE>
According to <194.203.215.187 [demerphq@hotmail.com]>:
>
> Hello All
>
> I have just applied for a CPAN id to release a new pragma.
> This pragma is intended for those of us that are too lazy to put
>
> use strict;
> use warnings;
[...]
> Any thoughts are welcome...
Superfluous.
Anno
------------------------------
Date: Fri, 11 May 2001 13:58:49 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Proposed new pragma: caution.
Message-Id: <slrn9fnrho.90p.bernard.el-hagin@gdndev25.lido-tech>
On 11 May 2001 11:43:26 GMT, 194.203.215.187 [demerphq@hotmail.com]
<194.203.215.187[demerphq@hotmail.com]> wrote:
>
>Hello All
>
>I have just applied for a CPAN id to release a new pragma.
>This pragma is intended for those of us that are too lazy to put
>
>use strict;
>use warnings;
>
>at the start of their scripts, and who do not like the command line switch
>style of doing the same. Instead with this module you can simply type
>
>use caution;
>
>And likewise if you wish to diable all strict and warnings options, and thus
>throw caution to the wind you may
>
>no caution;
[snip]
If you're joking - haha. If you're not - no comment.
Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,";print \Bernard'
------------------------------
Date: 11 May 2001 13:50:01 +0100
From: nobull@mail.com
Subject: Re: Q: eval and bypassing ctrl-flow cases
Message-Id: <u9pudg3v9i.fsf@wcl-l.bham.ac.uk>
Samuele Pedroni <pedroni@inf.ethz.ch> writes:
> Subject: Q: eval and bypassing ctrl-flow cases
Actually eval() if not relevant here.
> for my (first) perl program I would like to use eval to evaluate
> perl single liner but I have been biten by the following behaviour:
> print eval('1 unless 666'),"\n"
>
> prints 666
So do:
print eval{ 1 unless 666 },"\n";
print do{ 1 unless 666 },"\n";
print sub { 1 unless 666 }->(),"\n";
print map( { 1 unless 666 } 99 ),"\n";
In all cases the value of the statement "1 unless 666" is 666.
> Is this behaviour idiomatic, funny, ill-defined or a difficult to remove
> implementation (buggy?) corner case?
All of the above :-)
This is because the compiler treats "foo unless bar" as the same as
"bar || foo".
$ perl -MO=Deparse -e 'print do { bar() || foo() }'
-e syntax OK
print do { foo unless bar };
> I have tried the following workaround:
>
> eval('return ' . $expr . '; undef')
>
> it is not very general but basically it's ok for my needs; is there a
> better way?
You say "I would like to use eval to evaluate perl single liner".
Well since the value of the Perl single line "1 unless 666" _is_ 666
why do anything?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Fri, 11 May 2001 16:04:51 +0200
From: Samuele Pedroni <pedroni@inf.ethz.ch>
Subject: Re: Q: eval and bypassing ctrl-flow cases
Message-Id: <3AFBF183.7638583E@inf.ethz.ch>
nobull@mail.com wrote:
> Samuele Pedroni <pedroni@inf.ethz.ch> writes:
>
> > Subject: Q: eval and bypassing ctrl-flow cases
>
> Actually eval() if not relevant here.
>
> > for my (first) perl program I would like to use eval to evaluate
> > perl single liner but I have been biten by the following behaviour:
>
> > print eval('1 unless 666'),"\n"
> >
> > prints 666
>
> So do:
>
> print eval{ 1 unless 666 },"\n";
> print do{ 1 unless 666 },"\n";
> print sub { 1 unless 666 }->(),"\n";
> print map( { 1 unless 666 } 99 ),"\n";
>
> In all cases the value of the statement "1 unless 666" is 666.
I imagined something along this line.
>
> > Is this behaviour idiomatic, funny, ill-defined or a difficult to remove
> > implementation (buggy?) corner case?
>
> All of the above :-)
>
> This is because the compiler treats "foo unless bar" as the same as
> "bar || foo".
>
> $ perl -MO=Deparse -e 'print do { bar() || foo() }'
> -e syntax OK
> print do { foo unless bar };
>
Makes sense, but It's a bit ill-defined anyway (IMHO).
Thanks for clarifying this out.
>
> > I have tried the following workaround:
> >
> > eval('return ' . $expr . '; undef')
> >
> > it is not very general but basically it's ok for my needs; is there a
> > better way?
>
> You say "I would like to use eval to evaluate perl single liner".
> Well since the value of the Perl single line "1 unless 666" _is_ 666
> why do anything?
I have some kind of configuration script, the idea was to evaluate each line
(so that I can
use some of the power of perl there) and then gather the results (scalar or
lists) in a list, skipping undefs. Having 'EXPR unless COND' and 'EXPR if
COND' returning undef would be nicer for my job, that was the point.
Samuele Pedroni.
------------------------------
Date: 11 May 2001 14:52:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about Const package
Message-Id: <9dgubi$4u8$1@mamenchi.zrz.TU-Berlin.DE>
According to Benjamin Goldberg <goldbb2@earthlink.net>:
> I don't have perl on my system, so I can't test it out right now, but...
> Consider the following:
>
> use Tie::Const;
>
> my (%h);
> const \%h, { 1 => 2, 3 => 4 };
>
> my $x = \$h{1};
> $$x = 5;
>
> Unless I'm mistaken, this works without error. Somebody please tell me
> I'm wrong?
Is there a module Tie::Const, and what is its described behavior? I
can't find it on CPAN. So I can't be sure what your gripe is about.
You probably expected everything declared "const" to be read-only.
But if Tie::Const is anything like the standard const pragma, I
wouldn't expect that. Look at this:
use constant HREF => { 1 => 2, 3 => 4 };
my $before = ${ &HREF}{ 3};
${ &HREF}{ 3} = 99;
my $after = ${ &HREF}{ 3};
When "use constant" happens, Perl evaluates the right side which
happens to return a hashref. This value is frozen in the constant
HREF (which really is a parameterless sub) and can't be changed (or
indeed accessed) later in the program. The hash it points to,
however, is a regular hash and can be changed at will.
If you want a read-only hash, you currently would have to tie it
to a class that rejects write attempts. Apparently Tie::Const
doesn't do that.
Anno
------------------------------
Date: Fri, 11 May 2001 09:57:47 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: secure file download?
Message-Id: <3AFBEFDB.A84C21C9@mortgagestats.com>
Dave Calhoun wrote:
> I have a linux webserver that I need to transfer file from to a Win98
> pc. I've heard this is possible using perl but don't know how. Also, the
> files need to be transfered securely since they contain sensitive data.
> I do have a ssl certificate. Can anyone point me in the right direction?
>
> Thanks,
>
> Dave
Check out the LWP module. Be sure to read lwpcook. Both should be installed
on your machine along with Perl.
------------------------------
Date: 11 May 2001 13:58:57 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: times function
Message-Id: <9dgr71$1l0$1@mamenchi.zrz.TU-Berlin.DE>
According to Mark Lybrand <markyesme@home.com>:
> Hello,
>
> Just need a bit of clarification on the times function.
>
> Okay. I understand that times returns an array of four elements:
>
> $user = which is the cpu time that the process uses
> $system = which is the cpu time where the process interacts with the system
...or rather, the time the system spent on behalf of your process.
> $cuser = which is the cpu time that the child process uses.
> $csystem = which is the cpu time where the child process interacts with the
> system
These are the accumulated times of all children if there are more
than one.
> I am probably a bit mistaken on the $system and $csystem elements, hence my
> confusion.
>
> Am I correct? What about idle time? Should I use the POSIX times
> function, which provides the fifth element $realtime, so I can calculate
> idle time (which I take to be that the process and system wait for networks
> or other processes to respond).
You don't really care about "idle time" in a multi-tasking system. This
would just be the time the system gives to other processes and has little
to do with properties of your program. Actually, you have no way of
knowing if the system is actually idle (waiting for IO, say) or running
another process while your process doesn't run.
> Please let me know if I have completely mis-interpreted the information
> that this function provides.
You were basically correct.
Anno
------------------------------
Date: 11 May 2001 07:28:03 -0700
From: starfire <starfire@zipcon.net>
Subject: Re: use Apache::Htpasswd
Message-Id: <989591328.520749@news.zipcon.net>
You might also want to look at Apache::AuthCookie and its brethren ...
In comp.lang.perl.modules Mike Song <Mike.Song@usa.net> wrote:
> Hello;
> I know very little about Perl and want to set a web page with
> password protection. I already installed module use Apache::Htpasswd
> on my Linux box.
> Anyone know of a complete example of using use Apache::Htpasswd?
> Thanks
> Mike
--
Richard Anderson, Ph.D. www.unixscripts.com
Perl / Java / SQL / Unix Richard.Anderson@raycosoft.com
Raycosoft, LLC Seattle, WA, USA
------------------------------
Date: 11 May 2001 07:30:12 -0700
From: starfire <starfire@zipcon.net>
Subject: Re: use Apache::Htpasswd
Message-Id: <989591457.558461@news.zipcon.net>
You might also want to look at Apache::AuthCookie and its brethren ...
In comp.lang.perl.modules Mike Song <Mike.Song@usa.net> wrote:
> Anyone know of a complete example of using use Apache::Htpasswd?
--
Richard Anderson, Ph.D. www.unixscripts.com
Perl / Java / SQL / Unix Richard.Anderson@raycosoft.com
Raycosoft, LLC Seattle, WA, USA
------------------------------
Date: Fri, 11 May 2001 13:06:51 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: weird error on @array syntax
Message-Id: <01pnfto62o6i5sudm5i1htdi7vns82lmat@4ax.com>
M.J.T. Guy wrote:
>I didn't say do() doesn't detect *any* errors. The problem is that it
>doesn't detect *all* possible errors. Suppose the file didn't exist, or
>wasn't readable?
Aha.
Maybe that's the reason why require() demands that the code in the file
returns a true value?
--
Bart.
------------------------------
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 876
**************************************