[19654] in Perl-Users-Digest
Perl-Users Digest, Issue: 1849 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 1 11:06:02 2001
Date: Mon, 1 Oct 2001 08:05:11 -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: <1001948711-v10-i1849@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 1 Oct 2001 Volume: 10 Number: 1849
Today's topics:
Appending to a hash <adwr96@dial.pipex.com>
Re: Appending to a hash <Thomas@Baetzler.de>
Re: Appending to a hash <adwr96@dial.pipex.com>
Re: Appending to a hash <bart.lateur@skynet.be>
Re: Appending to a hash <adwr96@dial.pipex.com>
Re: Appending to a hash <Thomas@Baetzler.de>
best regular expression <shanali@singapura.singnet.com.sg>
Re: best regular expression <dtweed@acm.org>
Re: best regular expression <JPFauvelle@Colt-Telecom.fr>
Re: best regular expression <dtweed@acm.org>
Re: best regular expression <darkon@one.net>
Re: best regular expression <Laocoon@eudoramail.com>
Re: best regular expression <bart.lateur@skynet.be>
Bug or Error in Perl Compiler? (Mark)
Re: Bug or Error in Perl Compiler? (Garry Williams)
Re: Bug or Error in Perl Compiler? <Thomas@Baetzler.de>
Re: Can't find unicode character <irpag@gmx.net>
Re: Can't find unicode character <Thomas@Baetzler.de>
Re: cgi-llib.pl and 'use strict' <JPFauvelle@Colt-Telecom.fr>
Converting XML::Parser::EasyTree arrays back into wml <joonas@olen.to>
Re: current dir. <bart.lateur@skynet.be>
Date and Time calculations. <andytolley@hotmail.com>
Re: Date and Time calculations. <jbritain@home.com>
Re: Date and Time calculations. (John J. Trammell)
Embed Sound into cgi? <casey1@adelphia.net>
Re: Embed Sound into cgi? <Thomas@Baetzler.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 1 Oct 2001 15:21:30 +0100
From: "linkster" <adwr96@dial.pipex.com>
Subject: Appending to a hash
Message-Id: <mY_t7.29421$uM2.4336069@monolith.news.easynet.net>
hi
I have what I thought would be a fairly easily requirement, but I simply
can't find any way to do it.
I'm using a cookie to store input from a form, so that I don't have to write
sensitive information back to a web page as hidden fields during a
transaction process covering several pages. What I want to be able to do is
check the contents of my cookie, which is in a hashtable, against the hash
containing input posted to the form and, if necessary, append to the cookie
hash if new elements are added.
Problem is, I can't find any straightforward way to simply grow the hash
table - all I can find are ways to append to existing elements.
Can anyone help?
------------------------------
Date: Mon, 01 Oct 2001 16:39:14 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Appending to a hash
Message-Id: <51vgrt4bhet5g7sd2sq84n8lc7goq5fsaj@4ax.com>
On Mon, 1 Oct 2001, "linkster" <adwr96@dial.pipex.com> wrote:
>I'm using a cookie to store input from a form, so that I don't have to write
>sensitive information back to a web page as hidden fields during a
>transaction process covering several pages. What I want to be able to do is
From a security standpoint, using hidden fields isn't necessarily worse
than using cookies - both get transmitted from client to server and vice
versa. Neither is safe from tampering or eavesdropping if you're not
using a secured session.
>check the contents of my cookie, which is in a hashtable, against the hash
>containing input posted to the form and, if necessary, append to the cookie
>hash if new elements are added.
>
>Problem is, I can't find any straightforward way to simply grow the hash
>table - all I can find are ways to append to existing elements.
If you're using CGI::Cookie, you can use "my $c = new CGI::Cookie" to
create a new Cookie object, which you can then manipulate. If you want
to add such a newly created cookie to the cookie hash you created using
"my %cookies = fetch CGI::Cookie", you could do it this way:
$cookies{ $c->name } = $c;
You'd still have to make sure you send all the relevant cookies back.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Mon, 1 Oct 2001 15:45:53 +0100
From: "linkster" <adwr96@dial.pipex.com>
Subject: Re: Appending to a hash
Message-Id: <dj%t7.29430$uM2.4340774@monolith.news.easynet.net>
Thanks. It'll be on a secure server, just from a user prsepective I'd rather
they didn't view source and start worrying because all their details are
embedded in the page.
I'm not using CGI::cookie, so leaving the cookie part of it aside for a
moment, is there a way of simply appending the contents of one hash to
another?
"Thomas Bätzler" <Thomas@Baetzler.de> wrote in message
news:51vgrt4bhet5g7sd2sq84n8lc7goq5fsaj@4ax.com...
> On Mon, 1 Oct 2001, "linkster" <adwr96@dial.pipex.com> wrote:
> >I'm using a cookie to store input from a form, so that I don't have to
write
> >sensitive information back to a web page as hidden fields during a
> >transaction process covering several pages. What I want to be able to do
is
>
> From a security standpoint, using hidden fields isn't necessarily worse
> than using cookies - both get transmitted from client to server and vice
> versa. Neither is safe from tampering or eavesdropping if you're not
> using a secured session.
>
> >check the contents of my cookie, which is in a hashtable, against the
hash
> >containing input posted to the form and, if necessary, append to the
cookie
> >hash if new elements are added.
> >
> >Problem is, I can't find any straightforward way to simply grow the hash
> >table - all I can find are ways to append to existing elements.
>
> If you're using CGI::Cookie, you can use "my $c = new CGI::Cookie" to
> create a new Cookie object, which you can then manipulate. If you want
> to add such a newly created cookie to the cookie hash you created using
> "my %cookies = fetch CGI::Cookie", you could do it this way:
>
> $cookies{ $c->name } = $c;
>
> You'd still have to make sure you send all the relevant cookies back.
>
> HTH,
> --
> use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
> split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
> '"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
> $_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Mon, 01 Oct 2001 14:52:38 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Appending to a hash
Message-Id: <cm0hrt430d9muaun28v43vigi7f0gr814f@4ax.com>
linkster wrote:
>Problem is, I can't find any straightforward way to simply grow the hash
>table - all I can find are ways to append to existing elements.
Adding elements to a hash is even easier. Just set that hash element.
%hash = ( a => 'alpha', b => 'beta');
# add an element:
$hash{'g'} = 'gamma';
# see what we got:
use Data::Dumper;
print Dumper \%hash;
Result:
$VAR1 = {
'g' => 'gamma',
'a' => 'alpha',
'b' => 'beta'
};
--
Bart.
------------------------------
Date: Mon, 1 Oct 2001 16:03:15 +0100
From: "linkster" <adwr96@dial.pipex.com>
Subject: Re: Appending to a hash
Message-Id: <uz%t7.29434$uM2.4344262@monolith.news.easynet.net>
Thank you. I could have sworn I tried that already. D'oh.
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:cm0hrt430d9muaun28v43vigi7f0gr814f@4ax.com...
> linkster wrote:
>
> >Problem is, I can't find any straightforward way to simply grow the hash
> >table - all I can find are ways to append to existing elements.
>
> Adding elements to a hash is even easier. Just set that hash element.
>
> %hash = ( a => 'alpha', b => 'beta');
> # add an element:
> $hash{'g'} = 'gamma';
> # see what we got:
> use Data::Dumper;
> print Dumper \%hash;
>
> Result:
> $VAR1 = {
> 'g' => 'gamma',
> 'a' => 'alpha',
> 'b' => 'beta'
> };
>
>
> --
> Bart.
------------------------------
Date: Mon, 01 Oct 2001 17:03:56 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Appending to a hash
Message-Id: <441hrtof0jlqgaeu1flo7842vecd3nneem@4ax.com>
On Mon, 1 Oct 2001, "linkster" <adwr96@dial.pipex.com> wrote:
[...]
>I'm not using CGI::cookie, so leaving the cookie part of it aside for a
>moment, is there a way of simply appending the contents of one hash to
>another?
Please don't use "jeopardy style" quoting - just quote what is relevant
from the previous post(s) and post your remarks below. That makes it
easier for others to follow the thread. Thank you!
Assuming you want to add all keys from hash %src to %dest that are not
already set, you could do it this way:
my %src = ...
my %dest = ...
foreach my $key ( keys %src ){
if( exists $dest{ $key } ){
# mabye compare values?
} else {
$dest{ $key } = $src{ $key };
}
}
__END__
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: 1 Oct 2001 13:07:43 GMT
From: Shan Ali Khan <shanali@singapura.singnet.com.sg>
Subject: best regular expression
Message-Id: <9p9pqv$8sp$1@violet.singnet.com.sg>
Hi,
Being a newbie to perl regex need suggestions on the following:
- regular expr to identify a 10 digit no. always beginning with 75 (7545632212, 7545632213 etc)
- regular expr to strip 75 whenever it's received in a 10 digit no. and let the rest be
selected (54632212 and 45632213 in the above case
hope to learn a few things here for all of you.
thanks
------------------------------
Date: Mon, 01 Oct 2001 13:23:21 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: best regular expression
Message-Id: <3BB86CFD.594E262A@acm.org>
Shan Ali Khan wrote:
> - regular expr to identify a 10 digit no. always beginning with 75
> (7545632212, 7545632213 etc)
> - regular expr to strip 75 whenever it's received in a 10 digit no.
> and let the rest be selected (54632212 and 45632213 in the above case
$string = "xxx 7545632212, 7545632213 yyy";
foreach (split ' ', $string) {
if (/75(\d{8})/) {
warn "found $1\n";
}
}
-- Dave Tweed
------------------------------
Date: Mon, 01 Oct 2001 15:28:17 +0200
From: Jean-Philippe Fauvelle <JPFauvelle@Colt-Telecom.fr>
Subject: Re: best regular expression
Message-Id: <23rgrtkrtqstliio95psd7cebivvfga12m@4ax.com>
Le 1 Oct 2001 13:07:43 GMT, Shan Ali Khan
<shanali@singapura.singnet.com.sg> +AOk-crit:
>
>Hi,
>
>Being a newbie to perl regex need suggestions on the following:
>
>- regular expr to identify a 10 digit no. always beginning with 75 (7545632212, 7545632213 etc)
>- regular expr to strip 75 whenever it's received in a 10 digit no. and let the rest be
> selected (54632212 and 45632213 in the above case
>
>hope to learn a few things here for all of you.
>
>thanks
$n = '7545632212';
print "$n starts with 75 and is 10 bytes long+AFw-n" if $n =+AH4-/^75+AFw-d{8}$/;
$n = '7545632212';
($postfix) = ($n =+AH4- /^75(+AFw-d{8})$/); # found '45632212'
print defined($postfix)
? "$n ends with $postfix+AFw-n"
: "$n malformed+AFw-n";
$n = '2245632212';
($postfix) = ($n =+AH4- /^75(+AFw-d{8})$/); # not found
print defined($postfix)
? "$n ends with $postfix+AFw-n"
: "$n malformed+AFw-n";
hope that helps...
Jean-Philippe Fauvelle
------------------------------
Date: Mon, 01 Oct 2001 13:28:59 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: best regular expression
Message-Id: <3BB86E50.11E2495B@acm.org>
$string = "xxx 7545632212, 7545632213 yyy";
foreach ($string =~ /75(\d{8})/g) {
warn "found $_\n";
}
-- Dave Tweed
------------------------------
Date: Mon, 01 Oct 2001 14:03:15 -0000
From: David Wall <darkon@one.net>
Subject: Re: best regular expression
Message-Id: <Xns912D662E0E9BBdarkononenet@207.126.101.97>
Jean-Philippe Fauvelle <JPFauvelle@Colt-Telecom.fr> wrote on 01 Oct
2001:
>
> $n = '7545632212';
> print "$n starts with 75 and is 10 bytes long+AFw-n" if $n
> =+AH4-/^75+AFw-d{8}$/;
>
> $n = '7545632212';
> ($postfix) = ($n =+AH4- /^75(+AFw-d{8})$/); # found '45632212'
> print defined($postfix)
> ? "$n ends with $postfix+AFw-n"
> : "$n malformed+AFw-n";
>
> $n = '2245632212';
> ($postfix) = ($n =+AH4- /^75(+AFw-d{8})$/); # not found
> print defined($postfix)
> ? "$n ends with $postfix+AFw-n"
> : "$n malformed+AFw-n";
>
> hope that helps...
Looks to me like your post got garbled somewhere, with every \ turned into
+AFw- and every ~ into +AH4-
--
David Wall
darkon@one.net
------------------------------
Date: Mon, 1 Oct 2001 16:20:22 +0200
From: Laocoon <Laocoon@eudoramail.com>
Subject: Re: best regular expression
Message-Id: <Xns912DA78EBB0C1Laocooneudoramailcom@62.153.159.134>
$string =~ /\D75(\d{8})\D/;
That will "identify" all 10 digits number("75" + 8 digits)
and store the last 8 in the variable $1
------------------------------
Date: Mon, 01 Oct 2001 14:33:35 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: best regular expression
Message-Id: <7avgrto1ert5pcvn0npu3cdvje26v4tb2a@4ax.com>
Laocoon wrote:
>>Being a newbie to perl regex need suggestions on the following:
>>
>>- regular expr to identify a 10 digit no. always beginning with 75 (7545632212, 7545632213 etc)
>>- regular expr to strip 75 whenever it's received in a 10 digit no. and let the rest be
>> selected (54632212 and 45632213 in the above case
>
>$string =~ /\D75(\d{8})\D/;
>
>That will "identify" all 10 digits number("75" + 8 digits)
>and store the last 8 in the variable $1
Close but not perfect. What if the number is at the start or the end of
the string?
Negative lookahead/lookbehind is better.
$_ = qq/I've got 7512345678 bottles of beer on the wall.\n/;
s/(?<!\d)75(\d{8})(?!\d)/$1/g;
print;
--
Bart.
------------------------------
Date: Mon, 01 Oct 2001 11:33:54 GMT
From: mark@artwarren.co.ukNOSPAM (Mark)
Subject: Bug or Error in Perl Compiler?
Message-Id: <3bb85486.14183887@news.screaming.net>
Bug or Error in Perl Compiler?
Hi,
I use the following format in a perl script to print data to an HTML
document and usually it works fine.
##start the html page
print "Content-type: text/html\n\n";
print<<"HTML CONTENTS";
<HTML>
<head>
<title>CURRENT USER NAMES</title>
<meta http-equiv="expires" content="0">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache,
must-revalidate, max_age=0">
<meta name="GENERATOR" content="Arachnophilia 4.0">
<meta name="FORMATTER" content="Arachnophilia 4.0">
</head>
<body bgcolor="#0387A3" text="#D7F9FA" link="#D7F9FA"
vlink="#D7F9FA" alink="#D7F9FA">
$print<br>
</BODY>
</HTML>
HTML CONTENTS
However, sometimes when building a new script I get a persistent error
on compiling that I cannot get rid of. The error message reads;
Can't find string terminator "HTML CONTENTS" anywhere before EOF at
filename.pl line xxx.
No matter what I do I cannot get rid of this error. I have even taken
ALL of the code out of the file to leave only a basic HTML format as
shown below, yet still the error re-occurs.
print "Content-type: text/html\n\n";
print<<"HTML CONTENTS";
<HTML>
<head>
<title>CURRENT USER NAMES</title>
</head>
<body>
<br>print me
</BODY>
</HTML>
HTML CONTENTS
I find that the only solution is to go to a file where the HTML header
is working fine, rename it and copy all the code from the corrupted
file to the new file, excluding of course the non-working HTML code.
Can anyone explain this problem and suggest a simple solution? Thanks
for you interest.
Mark
------------------------------
Date: Mon, 01 Oct 2001 12:16:13 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Bug or Error in Perl Compiler?
Message-Id: <slrn9rgnkd.c1v.garry@zfw.zvolve.net>
On Mon, 01 Oct 2001 11:33:54 GMT, Mark <mark@artwarren.co.ukNOSPAM>
wrote:
> Bug or Error in Perl Compiler?
Neither.
> I use the following format in a perl script to print data to an HTML
> document and usually it works fine.
>
> ##start the html page
>
>
> print "Content-type: text/html\n\n";
>
> print<<"HTML CONTENTS";
> <HTML>
> <head>
[snip]
> </HTML>
>
> HTML CONTENTS
[snip]
> Can anyone explain this problem and suggest a simple solution?
Use a proper identifier for the here document quoting:
print<<HTML_CONTENTS;
--
Garry Williams
------------------------------
Date: Mon, 01 Oct 2001 15:35:40 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Bug or Error in Perl Compiler?
Message-Id: <cvrgrt8u34qfs8fuajvdtgn0u03k3vdogj@4ax.com>
On Mon, 01 Oct 2001, mark@artwarren.co.ukNOSPAM (Mark) wrote:
>Bug or Error in Perl Compiler?
Just a simple wetware problem :-P
[...]
>Can't find string terminator "HTML CONTENTS" anywhere before EOF at
>filename.pl line xxx.
This is a "feature" - your string terminator is on the last line, and
you don't have a CR on that line. A simple work-around that prevents
this from happening is always ending your code with an __END__ tag.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Mon, 1 Oct 2001 12:33:11 +0200
From: "Reinhard Pagitsch" <irpag@gmx.net>
Subject: Re: Can't find unicode character
Message-Id: <9p9gop$hd807$1@ID-86832.news.dfncis.de>
Hello,
I found out how it works: I changed the two variables
my $unixpath = "/mnt/detest/PWATEST/TEST";
my $ntpath = "q:\\PWATEST\\TEST";
to
my $unixpath = "/mnt/detest";
my $ntpath = "q:";
And for the Trailing problem I changed the substitution to s/\\/\//g.
Now my, maby silly, questions:
1) Why I can not use "q:\\PWATEST\\TEST" in a substituition?
2) why I can not use the variable $xx = "\\"; in a substitution?
What are the differences between the first and the secound solution? Or
better why Perl does not accept the first solution?
regards
Reinhard
--
Reinhard
"Reinhard Pagitsch" <irpag@gmx.net> wrote in message
news:9p9dn6$h194n$1@ID-86832.news.dfncis.de...
> Hello,
>
> I have a problem with the s///.
>
> my $unixpath = "/mnt/detest/PWATEST/TEST";
> my $ntpath = "q:\\PWATEST\\TEST";
>
> open(INFILE, $infile) or die "cant open infile: $infile $!\n";
> my @lines = <INFILE>;
> close(INFILE);
> open(OUTFILE, ">$outfile") or die "cant open outfile $!\n";
> foreach $line (@lines)
>
>
> my $xx = "\\";
> chomp $line;
> $line =~ s/$ntpath/$unixpath/g;
> $line =~ s/$xx/\//g if($line =~ /\\/);
> print OUTFILE $line;
> }
> close(OUTFILE);
>
> And if I run the script I get the message
> Can't find unicode character property definition via main->W or W.pl at
> unicode/
> Is/W.pl line 0
>
> If I remove the line $line =~ s/$ntpath/$unixpath/g;
> I get the message
> Trailing \ in regex m/\/ at Q:\PWATEST\TEST\tools\createux.pl line 94.
>
> Does anyone know what I am doing wrong?
>
>
> Thank you,
> Reinhard
>
>
> The text file I read in looks as follow:
> PPMFInputName="Q:\PWATEST\TEST\afpds\resdat2.afp"
> PPMFLib="Q:\PWATEST\TEST\T1000\default.lbp"
> DefaultFontLib="Q:\PWATEST\TEST\T1000\default.lbp"
> PPMFPPI="300"
> InputMode="AFP_AFP"
> TargetMode="afptlect"
> AddTimeStamp="No"
> AddFileName="Yes"
> Archive="FileArchive"
> Automatic="2"
> XMLFile="Q:\PWATEST\TEST\T1000\results\resdat.xml"
> TempDir="R:\temp"
> ResourceManagement="AppendResources"
> TargetType="AFP_GIF"
> GroupRelatedDirectory="Q:\PWATEST\TEST\T1000\results\resdat2.GIF"
> AFPCodepage="500"
> CodepagePath="Q:\TEST\RESOURCE\CPTS"
> MinFreeDiskSpace = "0"
> JournalPath="Q:\PWATEST\TEST\T1000\results"
> DocFrom="1"
> DocTo="20"
> * GIF parameters
> GifNoShade="0"
> GifResolution="300"
> GifFnetmode="0"
> GifRotation="0"
> GifUseLongFilenames="1"
> GifBuildHTML="No"
> GifHTMLOutput="Q:\temp\O1demo.html"
> GifHTMLHeader="Q:\temp\HEADER.TPL"
> GifHTMLBody="Q:\temp\BODY.TPL"
> GifHTMLFooter="Q:\temp\FOOTER.TPL"
> GifAddTimeStamp="Yes"
>
>
>
------------------------------
Date: Mon, 01 Oct 2001 12:55:24 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Can't find unicode character
Message-Id: <8migrt4ri6nmq03oj1645879g6vmq0kfra@4ax.com>
On Mon, 1 Oct 20010, "Reinhard Pagitsch" <irpag@gmx.net> wrote:
>1) Why I can not use "q:\\PWATEST\\TEST" in a substituition?
>2) why I can not use the variable $xx = "\\"; in a substitution?
>
>What are the differences between the first and the secound solution? Or
>better why Perl does not accept the first solution?
Your backslashes are interpolated twice: Once during the assignment of
the variables, and once during parsing of the pattern. Replacing your
double backslashes with quadruple backslashes would've worked, too.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Mon, 01 Oct 2001 12:37:02 +0200
From: Jean-Philippe Fauvelle <JPFauvelle@Colt-Telecom.fr>
Subject: Re: cgi-llib.pl and 'use strict'
Message-Id: <hehgrtshh8157kkii4h3h7306e671ef7v5@4ax.com>
>> BTW, has anyone actually benchmarked CGI.pm vs. cgi-lib.pl?
>
>With no libraries: 16 executions/sec
>With cgi-lib.pl: 15 executions/sec
>With CGI.pm 4 executions/sec
>With mod_perl 64 executions/sec
>
>So use mod_perl if possible. Use cgi-lib.pl if you only want to parse cgi
>variables, use cgi.pm only if you want the additional features (or
>complexity depending on your viewpoint:-)
CGI.pm suffers from a looooong compile/run time.
If your main interest is speed, then try to migrate from CGI to
fast-CGI.
Adding 5 small lines to your existing scripts will make them fast-CGI
compatible, and will then get rid of the huge compile/launch time.
Your scripts will then run [3 up to 50 times] faster.
Regards.
Jean-Philippe Fauvelle
------------------------------
Date: Mon, 01 Oct 2001 11:27:27 GMT
From: Joonas Paalasmaa <joonas@olen.to>
Subject: Converting XML::Parser::EasyTree arrays back into wml
Message-Id: <3BB8538A.9A6FAA0B@olen.to>
How can I convert this XML::Parser::EasyTree array back to xml.
The array was created with XML::Parser::EasyTree and dumped with
Data::Dumper::Dumper.
$VAR1 = {
'attrib' => {},
'content' => [
{
'attrib' => {},
'content' => [
{
'content' => '
######################
',
'type' => 't'
}
],
'type' => 'e',
'name' => 'p'
}
],
'type' => 'e',
'name' => 'card'
};
------------------------------
Date: Mon, 01 Oct 2001 13:05:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: current dir.
Message-Id: <l9qgrt4115u9gmvav5dbbufc00drvlqn07@4ax.com>
Philip Newton wrote:
>> I hope you meant
>> Cwd::cwd
>> which would be portable and the perlish way to do it.
>
>Not Cwd::getcwd? That's what I generally use.
>
>Partly because the docs imply that cwd runs pwd(1) and captures the
>output, while getcwd uses a system call rather than spawning an external
>process.
The docs also say:
The cwd() is the most natural and safe form for the current
architecture. For most systems it is identical to `pwd` (but without
the trailing line terminator).
The code comments add:
# The 'natural and safe form' for UNIX (pwd may be setuid root)
So for Unix, there's a difference, but cwd() is gegerally the safest.
For (all?) non-unix platforms, all functions are synonyms.
How often do you plan on calling cwd() anyway?
--
Bart.
------------------------------
Date: Mon, 1 Oct 2001 11:21:01 +0100
From: "IICS" <andytolley@hotmail.com>
Subject: Date and Time calculations.
Message-Id: <1001931509.15057.0.nnrp-08.c1ed7194@news.demon.co.uk>
Hi all,
Can anyone point me in the direction of some tutorials for date and time
manipulation. More specifically im trying to work out if a date read in
from a database is between two dates entered by a user in a html form.
Thanks in Advance.
Andrew Tolley / [CHS]InflatableIceCreamSheep
www.clan-chs.co.uk
"Computer Games dont effect us as kids, I mean if pacman had effected us as
kids we would all run around in darkened rooms, munching pills and listening
to repetative music"
- Marcus Brigstock.
"I do not know what weapons will be used in World War three, but World War
four will be fought with sticks and stones".
- Albert Einstein.
------------------------------
Date: Mon, 01 Oct 2001 10:42:21 GMT
From: Jim Britain <jbritain@home.com>
Subject: Re: Date and Time calculations.
Message-Id: <87hgrt40pcmdiortdbng42eoandissg3rr@4ax.com>
On Mon, 1 Oct 2001 11:21:01 +0100, "IICS" <andytolley@hotmail.com>
wrote:
>Hi all,
>
>Can anyone point me in the direction of some tutorials for date and time
>manipulation. More specifically im trying to work out if a date read in
>from a database is between two dates entered by a user in a html form.
Read the DOC files, and study the code in:
http://search.cpan.org/search?dist=Date-Calc
and
http://search.cpan.org/search?dist=DateManip
------------------------------
Date: Mon, 1 Oct 2001 09:07:30 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: Date and Time calculations.
Message-Id: <slrn9rgu52.h64.trammell@haqq.hypersloth.net>
On Mon, 1 Oct 2001 11:21:01 +0100, IICS <andytolley@hotmail.com> wrote:
> Hi all,
>
> Can anyone point me in the direction of some tutorials for date and time
> manipulation. More specifically im trying to work out if a date read in
> from a database is between two dates entered by a user in a html form.
Look in Perl FAQ 4.
--
[W]hen the manager knows his boss will accept status reports without
panic or preeemption, he comes to give honest appraisals.
- F. Brooks, _The Mythical Man-Month_
------------------------------
Date: Mon, 01 Oct 2001 11:27:39 GMT
From: christo <casey1@adelphia.net>
Subject: Embed Sound into cgi?
Message-Id: <tnkgrt8k0knjt83b6ttqecvrhlvljrlsc7@4ax.com>
I have a free chat cgi script im running and would like to know if a
beep sound can be embeded somehow to advise me when someone logs in to
the chat room. any help would be appreciated.
------------------------------
Date: Mon, 01 Oct 2001 15:28:24 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: Embed Sound into cgi?
Message-Id: <joqgrt4juegam6ehk1pknpvdr15ot9gjoi@4ax.com>
On Mon, 01 Oct 2001 11:27:39 GMT, christo <casey1@adelphia.net> wrote:
>I have a free chat cgi script im running and would like to know if a
>beep sound can be embeded somehow to advise me when someone logs in to
>the chat room. any help would be appreciated.
I guess comp.infosystems.www.authoring.cgi would be a better place to
ask questions like this, because this is less of a Perl and more of a
CGI question.
There is nothing specific that anybody could say without knowing more
about your CGI script and your specific needs. I do suspect that you do
not want a sound played on the web server (unless it is sitting under
your desk, which I doubt) but instead in your browser. In that case, you
should probably modify the page generating code in the CGI to include
something like a BGSOUND attribute for the BODY tag whenever somebody
new has logged in since your last page update. This might or might not
be trivial depending on what kind of backend storage you're using.
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
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 1849
***************************************