[24246] in Perl-Users-Digest
Perl-Users Digest, Issue: 6437 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 21 03:10:41 2004
Date: Wed, 21 Apr 2004 00:10:13 -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, 21 Apr 2004 Volume: 10 Number: 6437
Today's topics:
more code...(unfinished) <robin @ infusedlight.net>
Re: more code...(unfinished) <robin @ infusedlight.net>
Re: more code...(unfinished) <tassilo.parseval@rwth-aachen.de>
Re: more code...(unfinished) <uri@stemsystems.com>
Re: more code...(unfinished) <uri@stemsystems.com>
Re: need Regular Expression to remove all non-numerical <robin @ infusedlight.net>
Re: Request for program test on different operating syt <t@REMOVETHISbrowse.to>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Apr 2004 23:27:51 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: more code...(unfinished)
Message-Id: <c655f9$s4b$1@reader2.nmix.net>
#!/usr/bin/perl
use Fcntl qw (:flock);
use strict;
use warnings;
use CGI qw(:all);
$CGI::POST_MAX=1024 * 100; # max 100K posts
$CGI::DISABLE_UPLOADS = 1; # no uploads
$" = '';
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
my $homepage = "http://www.infusedlight.net"; #change this to your homepage
my $string = '<--->';
my $string2 = '<---->';
my $version = '1.0.0';
my $bookfile = 'book.txt';
my $headerfile = 'header.txt';
my $footerfile = 'footer.txt';
my $DATE = getdate();
my @head = gethead ($headerfile);
my @foot = getfoot ($footerfile);
if (url_param ('action') eq "sign")
{
sign();
}
elsif (url_param ('action') eq "dosign")
{
dosign();
}
else
{
if (! -e $bookfile)
{
if (open (BOOKFILE, ">$bookfile"))
{
flock (BOOKFILE, LOCK_EX);
print BOOKFILE '';
flock (BOOKFILE, LOCK_UN);
close (BOOKFILE);
}
else
{
print header and print "<center><strong>Viewing Guestbook - Version
$version - No guests</strong><hr><a href=\"$homepage\">To
homepage</a></center>" and exit;
}
}
view (1);
}
sub sign
{
print header;
print (@head);
print <<END;
<div align="center">
<p><strong>GBOOK2 - Sign Guestbook - Version $version</strong></p>
<hr size="1">
<form name="form1" method="post" action="gbook.pl?action=dosign">
<table width="85%" border="1" align="center" cellpadding="3"
cellspacing="0" bordercolor="#660000">
<tr>
<td width="50%" bgcolor="#CCCCCC">Your name:</td>
<td width="50%" bgcolor="#999999">
<div align="center">
<input name="name" type="text" id="name">
</div></td>
</tr>
<tr>
<td bgcolor="#999999">Your email: </td>
<td bgcolor="#CCCCCC"><div align="center">
<input name="email" type="text" id="email">
</div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">Your web site name (not required):</td>
<td bgcolor="#999999"><div align="center">
<input type="text" name="webname">
</div></td>
</tr>
<tr>
<td bgcolor="#999999">Your web site URL (not required):</td>
<td bgcolor="#CCCCCC"><div align="center">
<input name="url" type="text" id="url">
</div></td>
</tr>
<tr>
<td bgcolor="#CCCCCC">Your message: </td>
<td bgcolor="#999999"><div align="center">
<textarea name="message" cols="35" rows="4"
id="message"></textarea>
</div></td>
</tr>
<tr>
<td bgcolor="#333399">
<div align="right">
<input type="submit" name="Submit" value="Submit">
</div></td>
<td bgcolor="#333399">
<div align="left">
<input type="reset" name="Submit2" value="Reset">
</div></td>
</tr>
</table>
</form>
<hr size="1">
</div>
END
print (@foot);
}
sub dosign
{
if (checkforcookie() eq "true")
{
# print header;
# print (@head);
#print ("<center>You have already signed the guestbook once today.
Please sign it again tommorow.<hr></center>");
#print (@foot);
#exit;
}
my $name = param ('name');
my $email = param ('email');
my $website = param ('webname') . $string2 . param ('url');
my $message = param ('message');
if (param ('url') !~ /<.*>/ and param ('webname') !~ /<.*>/ and param
('url') !~ /^\s*$/s and param ('webname') !~ /$string2|$string/ and param
('url') !~ /$string2|$string/)
{
my (@url);
@url = split (/$string2/, $website);
if ($url[1] ne '' and $url[0] eq '')
{
$website = <<END;
<a href="$url[1]">$url[1]</a>
END
}
elsif ($url[0] ne '' and $url[1] ne '')
{
$website = <<END;
<a href="$url[1]">$url[0]</a>
END
}
elsif ($url[0] ne '' and $url[1] eq '')
{
$website = 'None';
}
elsif ($url[0] eq '' and $url[1] eq '')
{
$website = 'None';
}
}
else
{
$website = 'None';
}
if ($name !~ /^\s*$/g and $email !~ /^\s*$/g and $message !~ /^\s*$/g and
$email !~ /<.*>/s and param ('webname') !~ /<.*>/g and param ('url') !~
/<.*>/g and $name !~ /<.*>/s and $name !~ /$string/g and $message !~
/$string/g and $website !~ /$string/g and $email !~ /$string/g and $name !~
/$string2/g and $message !~ /$string2/g and $email !~ /$string2/g and param
('webname') !~ /$string2/g and param ('url') !~ /$string2/g)
{
open (BOOKFILE, ">>$bookfile") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (BOOKFILE, LOCK_EX);
print BOOKFILE <<"END";
<div align="center">
<table width="75%" border="1" cellpadding="3" cellspacing="0"
bordercolor="#660000" align="center">
<tr>
<td>Date of message: </td>
<td>$DATE</td>
</tr>
<tr>
<td width="50%">Name:</td>
<td width="50%">$name</td>
</tr>
<tr>
<td width="50%">Email:</td>
<td width="50%">$email</td>
</tr>
<tr>
<td>Website:</td>
<td>$website</td>
</tr>
<tr>
<td>Message:</td>
<td>$message</td>
</tr>
</table>
<hr size="1">
$string
END
flock (BOOKFILE, LOCK_UN);
close (BOOKFILE);
chmod (0770, $bookfile);
setcookie ("gbook.pl");
exit;
}
else
{
printerror1 ();
}
}
sub view
{
my ($header) = @_;
open (BOOKFILE, $bookfile) or print header and print
"<center><strong>Viewing Guestbook - Version $version - No
guests</strong><hr><a href=\"$homepage\">To homepage</a></center>" and exit;
flock (BOOKFILE, LOCK_SH);
my @contentsofbook=<BOOKFILE>;
flock (BOOKFILE, LOCK_UN);
close (BOOKFILE);
my $contentsofbook=join('', @contentsofbook);
@contentsofbook = split (/$string/, $contentsofbook);
@contentsofbook = reverse (@contentsofbook);
my $len = @contentsofbook;
$len -= 1;
my $s;
$s = 's' if ($len > 1);
print header if ($header);
print (@head);;
print <<END;
<div align="center">
<strong>GBOOK2 - Viewing Guestbook - Version $version - $len
guest$s</strong>
<hr size="1"><a href="$homepage">To homepage</a><br><br>
END
printpages();
print "<br><br>";
if (@contentsofbook)
{
print @contentsofbook;
}
else
{
print "No guests.";
}
if (! @contentsofbook)
{
print "<br>";
}
printpages();
print "<br><br>";
print <<END;
<a href="$homepage">To homepage</a></div>
END
print (@foot);
exit;
}
sub printpages
{
my ($counter, $counter2, $base, $end);
open (BOOKFILE, $bookfile) or print "An error occured during this
operation. Please try again.";
flock (BOOKFILE, LOCK_SH);
my @contentstoprint = <BOOKFILE>;
flock (BOOKFILE, LOCK_UN);
close (BOOKFILE);
$counter = 0;
$counter2 =1;
$base = 0;
$end = 9;
my $contentstoprint = join ('', @contentstoprint);
@contentstoprint = split (/$string/, $contentstoprint);
@contentstoprint = reverse (@contentstoprint);
my $content1;
print "Pages: [ <a href=\"gbook.pl?start=$base&end=$end\">1</a> ] ";
foreach $content1 (@contentstoprint)
{
$counter += 1;
$base += 1;
$end += 1;
if ($counter == 10)
{
$counter2 += 1;
print "[ <a href=\"gbook.pl?start=$base&end=$end\">$counter2</a> ] ";
$counter = 0;
}
}
}
sub printerror1
{
print header;
print (@head);
print ("<center>You did not supply the required fields or you used HTML
tags which are not allowed on this guestbook.<hr></center>");
print (@foot);
exit;
}
sub gethead
{
my ($header) = @_;
my @header;
if (-e "$header")
{
open (HEADER, "$header") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (HEADER, LOCK_SH);
@header = <HEADER>;
flock (HEADER, LOCK_UN);
close (HEADER);
}
else
{
open (HEADER, ">$header") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (HEADER, LOCK_EX);
print HEADER <<END;
<html>
<head>
<title>GBOOK2 Version $version</title>
</head>
<body>
END
flock (HEADER, LOCK_UN);
close (HEADER);
open (HEADER, "$header") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (HEADER, LOCK_SH);
@header = <HEADER>;
flock (HEADER, LOCK_UN);
close (HEADER);
}
chmod (0770, $header);
return @header;
}
sub getfoot
{
my ($footer) = @_;
my @footer;
if (-e "$footer")
{
open (FOOTER, "$footer") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (FOOTER, LOCK_SH);
@footer = <FOOTER>;
flock (FOOTER, LOCK_UN);
close (FOOTER);
}
else
{
open (FOOTER, ">$footer") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (FOOTER, LOCK_EX);
print FOOTER <<END;
</body></html>
END
close (FOOTER);
open (FOOTER, "$footer") or print header and print "An error occured
during this operation: <b>$!</b>. Please press the back button on your
browser and try again.<hr>" and exit;
flock (FOOTER, LOCK_SH);
@footer = <FOOTER>;
flock (FOOTER, LOCK_UN);
close (FOOTER);
}
chmod (0770, $footer);
return @footer;
}
sub getdate
{
open (DATE, "date +%D|") or print header and print "Date could not be
obtained. Please contact your system's administrator.<hr>" and exit;
my $date = <DATE>;
$date =~ s/\n//g;
$date =~ s/\r//g;
close (DATE);
return ($date);
}
sub setcookie
{
my ($redir) = @_;
my $cookie;
$cookie = cookie (-name=>'signed', -value=>"signed", -expires=>'+1d');
print redirect (-url=>"$redir", -cookie=>"$cookie");
}
sub checkforcookie
{
my $cookieflag;
$cookieflag = '';
if (getcookie() eq 'signed')
{
$cookieflag = 'true';
}
return ($cookieflag);
}
sub getcookie
{
my $cookiein;
$cookiein = cookie ('signed');
return $cookiein;
}
begin 666 gbook.pl
M(R$O=7-R+V)I;B]P97)L#0H-"G5S92!&8VYT;"!Q=R H.F9L;V-K*3L-"G5S
M92!S=')I8W0[#0IU<V4@=V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:&UO9" H,#<W,"P@)&9O;W1E<BD[#0H)<F5T=7)N($!F;V]T97([#0H)?0T*
M#0H-"G-U8B!G971D871E#0H)>PT*"6]P96X@*$1!5$4L(")D871E("LE1'PB
M*2!O<B!P<FEN="!H96%D97(@86YD('!R:6YT(")$871E(&-O=6QD(&YO="!B
M92!O8G1A:6YE9"X@4&QE87-E(&-O;G1A8W0@>6]U<B!S>7-T96TG<R!A9&UI
M;FES=')A=&]R+CQH<CXB(&%N9"!E>&ET.PT*"6UY("1D871E(#T@/$1!5$4^
M.PT*"21D871E(#U^(',O7&XO+V<[#0H))&1A=&4@/7X@<R]<<B\O9SL-"@EC
M;&]S92 H1$%412D[#0H)<F5T=7)N("@D9&%T92D[#0H)?0T*#0IS=6(@<V5T
M8V]O:VEE#0H)>PT*"6UY("@D<F5D:7(I(#T@0%\[#0H@(" );7D@)&-O;VMI
M93L-"B @(" D8V]O:VEE(#T@8V]O:VEE("@M;F%M93T^)W-I9VYE9"<L("UV
M86QU93T^(G-I9VYE9"(L("UE>'!I<F5S/3XG*S%D)RD[#0H)<')I;G0@<F5D
M:7)E8W0@*"UU<FP]/B(D<F5D:7(B+" M8V]O:VEE/3XB)&-O;VMI92(I.PT*
M"7T-"@T*#0IS=6(@8VAE8VMF;W)C;V]K:64-"@E[#0H@(" @;7D@)&-O;VMI
M969L86<[#0H))&-O;VMI969L86<@/2 G)SL-"@EI9B H9V5T8V]O:VEE*"D@
M97$@)W-I9VYE9"<I#0H)"7L-"@D))&-O;VMI969L86<@/2 G=')U92<[#0H)
M"7T-"@ER971U<FX@*"1C;V]K:65F;&%G*3L-"@E]#0H-"G-U8B!G971C;V]K
M:64-"@E[#0H);7D@)&-O;VMI96EN.PT*"21C;V]K:65I;B ](&-O;VMI92 H
D)W-I9VYE9"<I.PT*"7)E='5R;B D8V]O:VEE:6X[#0H)?0T*
`
end
------------------------------
Date: Tue, 20 Apr 2004 23:31:38 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: more code...(unfinished)
Message-Id: <c655ma$s5c$1@reader2.nmix.net>
oops totally didn't mean to post the file...sorry for all you...you,
people..
Regards,
-Robin
--
[ webmaster @ infusedlight.net ]
"Robin" <robin @ infusedlight.net> wrote in message
news:c655f9$s4b$1@reader2.nmix.net...
>
> #!/usr/bin/perl
>
> use Fcntl qw (:flock);
> use strict;
> use warnings;
>
> use CGI qw(:all);
>
> $CGI::POST_MAX=1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 1; # no uploads
>
> $" = '';
>
> $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
>
> my $homepage = "http://www.infusedlight.net"; #change this to your
homepage
> my $string = '<--->';
> my $string2 = '<---->';
> my $version = '1.0.0';
> my $bookfile = 'book.txt';
> my $headerfile = 'header.txt';
> my $footerfile = 'footer.txt';
> my $DATE = getdate();
> my @head = gethead ($headerfile);
> my @foot = getfoot ($footerfile);
>
> if (url_param ('action') eq "sign")
> {
> sign();
> }
>
> elsif (url_param ('action') eq "dosign")
> {
> dosign();
> }
> else
> {
> if (! -e $bookfile)
> {
> if (open (BOOKFILE, ">$bookfile"))
> {
> flock (BOOKFILE, LOCK_EX);
> print BOOKFILE '';
> flock (BOOKFILE, LOCK_UN);
> close (BOOKFILE);
> }
> else
> {
> print header and print "<center><strong>Viewing Guestbook -
Version
> $version - No guests</strong><hr><a href=\"$homepage\">To
> homepage</a></center>" and exit;
> }
> }
> view (1);
> }
>
> sub sign
> {
> print header;
> print (@head);
> print <<END;
> <div align="center">
> <p><strong>GBOOK2 - Sign Guestbook - Version $version</strong></p>
> <hr size="1">
> <form name="form1" method="post" action="gbook.pl?action=dosign">
> <table width="85%" border="1" align="center" cellpadding="3"
> cellspacing="0" bordercolor="#660000">
> <tr>
> <td width="50%" bgcolor="#CCCCCC">Your name:</td>
> <td width="50%" bgcolor="#999999">
> <div align="center">
> <input name="name" type="text" id="name">
> </div></td>
> </tr>
> <tr>
> <td bgcolor="#999999">Your email: </td>
> <td bgcolor="#CCCCCC"><div align="center">
> <input name="email" type="text" id="email">
> </div></td>
> </tr>
> <tr>
> <td bgcolor="#CCCCCC">Your web site name (not required):</td>
> <td bgcolor="#999999"><div align="center">
> <input type="text" name="webname">
> </div></td>
> </tr>
> <tr>
> <td bgcolor="#999999">Your web site URL (not required):</td>
> <td bgcolor="#CCCCCC"><div align="center">
> <input name="url" type="text" id="url">
> </div></td>
> </tr>
> <tr>
> <td bgcolor="#CCCCCC">Your message: </td>
> <td bgcolor="#999999"><div align="center">
> <textarea name="message" cols="35" rows="4"
> id="message"></textarea>
> </div></td>
> </tr>
> <tr>
> <td bgcolor="#333399">
> <div align="right">
> <input type="submit" name="Submit" value="Submit">
> </div></td>
> <td bgcolor="#333399">
> <div align="left">
> <input type="reset" name="Submit2" value="Reset">
> </div></td>
> </tr>
> </table>
> </form>
> <hr size="1">
> </div>
> END
> print (@foot);
> }
>
> sub dosign
> {
> if (checkforcookie() eq "true")
> {
> # print header;
> # print (@head);
> #print ("<center>You have already signed the guestbook once today.
> Please sign it again tommorow.<hr></center>");
> #print (@foot);
> #exit;
> }
> my $name = param ('name');
> my $email = param ('email');
> my $website = param ('webname') . $string2 . param ('url');
> my $message = param ('message');
> if (param ('url') !~ /<.*>/ and param ('webname') !~ /<.*>/ and param
> ('url') !~ /^\s*$/s and param ('webname') !~ /$string2|$string/ and param
> ('url') !~ /$string2|$string/)
> {
> my (@url);
> @url = split (/$string2/, $website);
> if ($url[1] ne '' and $url[0] eq '')
> {
> $website = <<END;
> <a href="$url[1]">$url[1]</a>
> END
> }
> elsif ($url[0] ne '' and $url[1] ne '')
> {
> $website = <<END;
> <a href="$url[1]">$url[0]</a>
> END
> }
> elsif ($url[0] ne '' and $url[1] eq '')
> {
> $website = 'None';
> }
> elsif ($url[0] eq '' and $url[1] eq '')
> {
> $website = 'None';
> }
> }
> else
> {
> $website = 'None';
> }
> if ($name !~ /^\s*$/g and $email !~ /^\s*$/g and $message !~ /^\s*$/g and
> $email !~ /<.*>/s and param ('webname') !~ /<.*>/g and param ('url') !~
> /<.*>/g and $name !~ /<.*>/s and $name !~ /$string/g and $message !~
> /$string/g and $website !~ /$string/g and $email !~ /$string/g and $name
!~
> /$string2/g and $message !~ /$string2/g and $email !~ /$string2/g and
param
> ('webname') !~ /$string2/g and param ('url') !~ /$string2/g)
> {
> open (BOOKFILE, ">>$bookfile") or print header and print "An error
occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (BOOKFILE, LOCK_EX);
> print BOOKFILE <<"END";
> <div align="center">
> <table width="75%" border="1" cellpadding="3" cellspacing="0"
> bordercolor="#660000" align="center">
> <tr>
> <td>Date of message: </td>
> <td>$DATE</td>
> </tr>
> <tr>
> <td width="50%">Name:</td>
> <td width="50%">$name</td>
> </tr>
> <tr>
> <td width="50%">Email:</td>
> <td width="50%">$email</td>
> </tr>
> <tr>
> <td>Website:</td>
> <td>$website</td>
> </tr>
> <tr>
> <td>Message:</td>
> <td>$message</td>
> </tr>
> </table>
> <hr size="1">
> $string
> END
> flock (BOOKFILE, LOCK_UN);
> close (BOOKFILE);
> chmod (0770, $bookfile);
> setcookie ("gbook.pl");
> exit;
> }
>
> else
> {
> printerror1 ();
> }
> }
> sub view
> {
> my ($header) = @_;
> open (BOOKFILE, $bookfile) or print header and print
> "<center><strong>Viewing Guestbook - Version $version - No
> guests</strong><hr><a href=\"$homepage\">To homepage</a></center>" and
exit;
> flock (BOOKFILE, LOCK_SH);
> my @contentsofbook=<BOOKFILE>;
> flock (BOOKFILE, LOCK_UN);
> close (BOOKFILE);
> my $contentsofbook=join('', @contentsofbook);
> @contentsofbook = split (/$string/, $contentsofbook);
> @contentsofbook = reverse (@contentsofbook);
> my $len = @contentsofbook;
> $len -= 1;
> my $s;
> $s = 's' if ($len > 1);
> print header if ($header);
> print (@head);;
> print <<END;
> <div align="center">
> <strong>GBOOK2 - Viewing Guestbook - Version $version - $len
> guest$s</strong>
> <hr size="1"><a href="$homepage">To homepage</a><br><br>
> END
> printpages();
> print "<br><br>";
> if (@contentsofbook)
> {
> print @contentsofbook;
> }
> else
> {
> print "No guests.";
> }
> if (! @contentsofbook)
> {
> print "<br>";
> }
> printpages();
> print "<br><br>";
> print <<END;
> <a href="$homepage">To homepage</a></div>
> END
> print (@foot);
> exit;
> }
>
> sub printpages
> {
> my ($counter, $counter2, $base, $end);
> open (BOOKFILE, $bookfile) or print "An error occured during this
> operation. Please try again.";
> flock (BOOKFILE, LOCK_SH);
> my @contentstoprint = <BOOKFILE>;
> flock (BOOKFILE, LOCK_UN);
> close (BOOKFILE);
> $counter = 0;
> $counter2 =1;
> $base = 0;
> $end = 9;
> my $contentstoprint = join ('', @contentstoprint);
> @contentstoprint = split (/$string/, $contentstoprint);
> @contentstoprint = reverse (@contentstoprint);
> my $content1;
> print "Pages: [ <a href=\"gbook.pl?start=$base&end=$end\">1</a> ] ";
> foreach $content1 (@contentstoprint)
> {
> $counter += 1;
> $base += 1;
> $end += 1;
> if ($counter == 10)
> {
> $counter2 += 1;
> print "[ <a href=\"gbook.pl?start=$base&end=$end\">$counter2</a> ] ";
> $counter = 0;
> }
> }
> }
> sub printerror1
> {
> print header;
> print (@head);
> print ("<center>You did not supply the required fields or you used HTML
> tags which are not allowed on this guestbook.<hr></center>");
> print (@foot);
> exit;
> }
>
> sub gethead
> {
> my ($header) = @_;
> my @header;
>
> if (-e "$header")
> {
> open (HEADER, "$header") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (HEADER, LOCK_SH);
> @header = <HEADER>;
> flock (HEADER, LOCK_UN);
> close (HEADER);
> }
> else
> {
> open (HEADER, ">$header") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (HEADER, LOCK_EX);
> print HEADER <<END;
> <html>
> <head>
> <title>GBOOK2 Version $version</title>
> </head>
> <body>
> END
> flock (HEADER, LOCK_UN);
> close (HEADER);
> open (HEADER, "$header") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (HEADER, LOCK_SH);
> @header = <HEADER>;
> flock (HEADER, LOCK_UN);
> close (HEADER);
> }
> chmod (0770, $header);
> return @header;
> }
>
> sub getfoot
> {
> my ($footer) = @_;
> my @footer;
> if (-e "$footer")
> {
> open (FOOTER, "$footer") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (FOOTER, LOCK_SH);
> @footer = <FOOTER>;
> flock (FOOTER, LOCK_UN);
> close (FOOTER);
> }
> else
> {
> open (FOOTER, ">$footer") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (FOOTER, LOCK_EX);
> print FOOTER <<END;
> </body></html>
> END
> close (FOOTER);
> open (FOOTER, "$footer") or print header and print "An error occured
> during this operation: <b>$!</b>. Please press the back button on your
> browser and try again.<hr>" and exit;
> flock (FOOTER, LOCK_SH);
> @footer = <FOOTER>;
> flock (FOOTER, LOCK_UN);
> close (FOOTER);
> }
> chmod (0770, $footer);
> return @footer;
> }
>
>
> sub getdate
> {
> open (DATE, "date +%D|") or print header and print "Date could not be
> obtained. Please contact your system's administrator.<hr>" and exit;
> my $date = <DATE>;
> $date =~ s/\n//g;
> $date =~ s/\r//g;
> close (DATE);
> return ($date);
> }
>
> sub setcookie
> {
> my ($redir) = @_;
> my $cookie;
> $cookie = cookie (-name=>'signed', -value=>"signed", -expires=>'+1d');
> print redirect (-url=>"$redir", -cookie=>"$cookie");
> }
>
>
> sub checkforcookie
> {
> my $cookieflag;
> $cookieflag = '';
> if (getcookie() eq 'signed')
> {
> $cookieflag = 'true';
> }
> return ($cookieflag);
> }
>
> sub getcookie
> {
> my $cookiein;
> $cookiein = cookie ('signed');
> return $cookiein;
> }
>
>
>
>
>
>
------------------------------
Date: 21 Apr 2004 06:33:59 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: more code...(unfinished)
Message-Id: <c654kn$7plg6$1@ID-231055.news.uni-berlin.de>
Also sprach Robin:
> oops totally didn't mean to post the file...sorry for all you...you,
> people..
So why did you then post it again if you didn't mean to?
[ snipped a few hundred lines ]
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Wed, 21 Apr 2004 06:34:43 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: more code...(unfinished)
Message-Id: <x7fzaxon3w.fsf@mail.sysarch.com>
>>>>> "R" == Robin <robin @ infusedlight.net> writes:
R> my $string = '<--->';
R> my $string2 = '<---->';
such descriptive names.
how about
my $string_created_by_bad_perl_coder_who_does_not_get_it ;
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 21 Apr 2004 06:37:41 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: more code...(unfinished)
Message-Id: <x7d661omyz.fsf@mail.sysarch.com>
>>>>> "R" == Robin <robin @ infusedlight.net> writes:
R> else
R> {
R> if (! -e $bookfile)
R> {
R> if (open (BOOKFILE, ">$bookfile"))
R> {
R> flock (BOOKFILE, LOCK_EX);
R> print BOOKFILE '';
R> flock (BOOKFILE, LOCK_UN);
R> close (BOOKFILE);
R> }
R> else
R> {
this is some of the worse indenting i have ever seen (except for no
indenting at all).
1 char indents is so lame. even advocates of small indents use 2 or 3
chars. but NOOO, robin the tiny indenter will spam us with 1 char
indents which makes reading this trash even harder and more painful.
and wtf is that wacko indent on that last else?
and the bracing style is from hell as well.
please learn python and spam their newsgroup.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 20 Apr 2004 18:05:15 -0700
From: "Robin" <robin @ infusedlight.net>
Subject: Re: need Regular Expression to remove all non-numerical
Message-Id: <c64j7i$m0m$2@reader2.nmix.net>
"Robert" <robert@the.com> wrote in message
news:40839733$1@dnews.tpgi.com.au...
>
> I'm trying to come up with a regex that will remove all non-numeric
characters from a string.
> ie: +01-876 003456
>
> to: 01876003456
>
> but am having an amazing amount of trouble - perhaps it's too late.
> but if anyone can point me in theright direction, I'd be most gratefull.
> thanks
> Robert
>
I'd like some of your code... Thanks.
-Robin
--
------------------------------
Date: Wed, 21 Apr 2004 02:55:11 +0000 (UTC)
From: Tom <t@REMOVETHISbrowse.to>
Subject: Re: Request for program test on different operating sytsems
Message-Id: <c64nqe$cu2$1@hercules.btinternet.com>
edgrsprj wrote...
> "Tom" <t@REMOVETHISbrowse.to> wrote in message
> news:c6359b$8if$1@sparta.btinternet.com...
>
>
>>Are those print lines supposed to be the same?
>
>
> No. You are correct on that. I had the Windows 98 command correct
until I
> made a last minute change which somehow eliminated the right one. It
should
> be:
>
> print file 'c:\windows\progman.exe '.$fileresults, "\n";
>
> However, as I said in another note, Although that command appears to
work on
> my system, I cannot get it to produce completely satisfactory results.
>
> The goal here is to have the Perl program tell whatever operating
system you
> are using to use one of its standard text editors to open the results.out
> text file when it is done with a run. That is easy to do with
Windows XP on
> a regular PC. In fact I would say that the results are more than
> satisfactory. The process works great with all types of possible
options.
> But I have not yet been able to find a good way to do that with
Windows 98
> on a regular PC. And I have no idea how to get it to work on any other
> types of system. Hence my original request for other people to give it a
> try.
>
> A Perl program test needs to be run. People can try different types of
> commands and see if they can find one which will tell their operating
> systems to have a regular text editor open some text file. Then if
they let
> me know what that command is and what type of system they are using I
will
> try to store a copy of the command as an option in this scientific
program I
> am starting to circulate.
>
>
>
>>FWIW start.exe is not a file on either my Win98 or Win2000
>>I doubt if it is in XP
>
>
>>it should be something like: %COMPSPEC% /c start ....
>
>
>>FYI on my system, that's E:\WINNT5\system32\CMD.EXE
>>(No C: Drive!)
>
>
> I can't find any of those files or directories on either my regular
Windows
> XP or backup Windows 98 PC computers. Different systems must use
different
> types of directory structures. I have never used Windows on anything
other
> than a standard IBM type PC so I don't know too much about this.
>
> At least with Windows it appears to me to be a little difficult to
have any
> type of batch file direct a Windows program such as Notepad.exe to start
> running. DOS programs seem to be easy to start from batch files or Perl
> programs.
>
My mistake, typo should be %COMSPEC% in that example.
try it:
[Start->Run] %comspec% /k set | find /I "comspec" [OK]
All Windows versions use:
editor.exe filename.txt
in Windows 2000 and XP you can also just use:
start filename.txt
Let me just say that I don't know any perl (I was just passing by)
You don't need people running test programs for you just yet.
ISTM you need to RTM or STFW. progman, start.exe, WTF?
In Windows (even XP) your universal mileage may vary with:
assoc /?
ftype /?
start /?
%comspec% /?
ver
set
help
%windir%\regedit /e output1.txt "HKEY_CLASSES_ROOT\.txt"
regedit /e output2.txt "HKEY_CLASSES_ROOT\txtfile\shell\open\command"
but I bet perl can read the registry on its own, right?
Can you use the FindExecutable or ShellExecute API?
HTH
------------------------------
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 6437
***************************************