[18661] in Perl-Users-Digest
Perl-Users Digest, Issue: 829 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 3 18:05:45 2001
Date: Thu, 3 May 2001 15:05:07 -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: <988927507-v10-i829@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 3 May 2001 Volume: 10 Number: 829
Today's topics:
[Fwd: ANNOUNCE: Lingua::Romana::Perligata 0.50] <terrence.brannon@oracle.com>
Re: [OT: language religion ] Re: Should Perl be first? <flavell@mail.cern.ch>
Alorithm ? addendum <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
Re: fork (Rudolf Polzer)
Re: fork (Rudolf Polzer)
Re: FTP->new (Anno Siegel)
help with parsing files <joycefive@earthlink.net>
Re: How do I find the OS? (Arek P)
need help with editing files <joycefive@earthlink.net>
Parsing (Barry Allwood)
Re: Parsing (Abigail)
Peculiar output from 'top' command <djberge@uswest.com>
Re: Peculiar output from 'top' command (Dave Bailey)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <webmaster@webdragon.unmunge.net>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <webmaster@webdragon.unmunge.net>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <bart.lateur@skynet.be>
Re: prevent empty message being sent? <bing-du@tamu.edu>
Printing HTTP headers/body in perl <mail@NOSPAMericmarques.net>
Re: Recursing a directory tree <centreman_19@NOSPAMyahoo.com>
Re: Test for integer? (Anno Siegel)
Trying to find SSH or SSL interface for Perl <rlf@proimages.net>
Re: Trying to find SSH or SSL interface for Perl <djberge@uswest.com>
Re: Trying to find SSH or SSL interface for Perl (Tad McClellan)
Re: Trying to find SSH or SSL interface for Perl <rlf@proimages.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 03 May 2001 12:12:29 -0700
From: Terrence Monroe Brannon <terrence.brannon@oracle.com>
Subject: [Fwd: ANNOUNCE: Lingua::Romana::Perligata 0.50]
Message-Id: <3AF1AD9D.D38B09A2@oracle.com>
-------- Original Message --------
Subject: ANNOUNCE: Lingua::Romana::Perligata 0.50
Date: 3 May 2001 03:56:09 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Organization: Monash Uni
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules
==============================================================================
Release of version 0.50 of Lingua::Romana::Perligata
==============================================================================
NOMEN
Lingua::Romana::Perligata -- Perl in Latin
DESCRIPTIO
The Lingua::Romana::Perligata makes it makes it possible to write
Perl
programs in Latin. (If you have to ask "Why?", then the answer
probably
won't make any sense to you either.)
The linguistic principles behind Perligata are described in:
http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html
The module is `use'd at the start of the program, and installs a
filter
which allows the rest of the program to be written in (modified)
Latin,
as described in the accompanying documentation.
EXEMPLUM
#! /usr/bin/perl -w
use Lingua::Romana::Perligata;
adnota Illud Cribrum Eratothenis
maximum tum val inquementum tum biguttam tum stadium egresso
scribe.
vestibulo perlegementum da meo maximo.
maximum tum novumversum egresso scribe.
da II tum maximum conscribementa meis listis.
dum damentum nexto listis decapitamentum fac sic
lista sic hoc tum nextum recidementum cis vannementa da
listis.
next tum biguttam tum stadium tum nextum tum novumversum
scribe egresso.
cis.
SCRIPTOR
Damian Conway (damian@conway.org)
IUS TRANSCRIBENDI
Copyright (c) 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.50
- Fixed handling of 'posterus', 'ultimus' etc.
- Fixed handling of 'si' (thanks James)
- Added 'itera' for 'x' (thanks James)
- Added the 'dictum sic..cis' construct for q{...} (thanks Peter)
- Added "consocia" for &, "interseca" for |, and "discerne" for ^.
- Add "cum" as precedence disambiguator
- Fixed "sere" so that it doesn't space what it joins (thanks Philip)
- Numerous documentation patches (thanks Todd and Philip)
- Added "come" to convert numbers to roman numerals (thanks Anselm)
- Added roman numerals up to 9,999,999,999 (thanks Anselm)
==============================================================================
AVAILABILITY
Lingua::Romana::Perligata has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Lingua-Romana-Perligata.tar.gz
==============================================================================
------------------------------
Date: Thu, 3 May 2001 21:36:17 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: [OT: language religion ] Re: Should Perl be first?
Message-Id: <Pine.LNX.4.30.0105032133490.15464-100000@lxplus003.cern.ch>
On Thu, 3 May 2001, Abigail wrote:
> :) > On Unix the most appropriate language is my first choice
> :) I found it far easier on MS Windows to feel sure that Perl was
> :) the right choice ;-))
>
> I'd phrase that as "Unix the the appropriate choice".
I meant, of course, in a situation where the choice of OS was
dictated by some other criterion.
--
Caution: product may contain traces of nut.
------------------------------
Date: Thu, 03 May 2001 20:31:01 GMT
From: Doug O'Leary <dkoleary@ro05-24-29-232-217.ce.mediaone.net>
Subject: Alorithm ? addendum
Message-Id: <9ejI6.411$qPc.47775888@news.randori.com>
Hey, all;
Thanks again for the help yesterday. I finally have something
working. The question is how come what I had originally
wasn't working?
Here's the functioning snippet:
01: $SIG{CHLD} = &reaper;
02:
03: sub reaper
04: {
05: my $stiff;
06: while ($stiff = waitpid(-1,&WNOHANG) > 0)
07: { $num--; }
08: $SIG{CHLD} = &reaper;
09: }
10:
11: open (In,"< $file" ) || die "Can't open $file - ($!)";
12: @lines = <In>;
13: close In;
14:
15: while (! $konets && scalar(@lines))
16: {
17: while ($num < $degree && ! $konets )
18: {
19: # if (defined($line = <In>))
20: if (defined($line = shift @lines))
21: { $count++;
22: next if ($line =~ /^#/);
23: chomp $line;
24: ($node, $gw, $type, $comm) = split(',',$line);
25: ### Fork!
26: if ($pid = fork) ### Parent
27: { $num++;
28: # sleep 2;
29: }
30: elsif (defined $pid) ### Child
31: {
32: # close (In);
33: printf ("%-16s %5s %5s %s\n",$node, $gw, $type, $comm);
34: exit 0; # Normal exit
35: }
36: elsif ($! =~ /No more processes/) ### Error
37: { die "Ran out of process table entries...\n"; }
38: else ### Unknown error
39: { die "Chto-to slyuchilos'!\n"; }
40: }
41: else
42: { $konets = 1; }
43: }
44: if ( $count > 610 && ! $konets )
45: { printf "Something's seriously eb'ed here!\n\n";
46: exit 99;
47: }
48: }
This works; I was originally reading each line within the loop
as shown on line 19. Doing that, however, my output was
completely mucked - lines munged together and other lines in the
file were duplicated several times.
Once I read the file into an array (#12/13), then iterated through the
array, it worked perfectly.
I guess it's a moot point, but I'm curious what happened with the
file handle between the various forks.
Thanks.
Humerous: you'd be *really amazed* at what not putting the "exit 0"
in the client portion of the fork did to my poor little ultra 10...
Doug
--
------------------------
Douglas K. O'Leary
Senior System Administrator
dkoleary@mediaone.net
------------------------------
Date: Thu, 3 May 2001 22:39:01 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: fork
Message-Id: <slrn9f3gf5.esm.eins@www42.t-offline.de>
AvA <a.v.a@home.nl> wrote:
> hi all,
>
> i need to fork a program but i just cant figure fork() out.
>
> i want to exec ("mpg123", $somesong);
>
> could someone show me how fork works
You could perhaps use fork() for this, but you want to use system() instead.
perldoc -f system
--
#!/usr/bin/perl -- Exercise: prove _or_ disprove that _all_ digits
############################ displayed are 1! s/^/4711081542426/g;
use strict;$|=@_=$0=2;for(;;){do{++$0}while('@'x$0)=~/^(..+)\1+$/;
push@_,$0;for((2-@_)..0){$_[-$_]=abs($_[-$_]-$_[1-$_])}print$_[0]}
------------------------------
Date: Thu, 3 May 2001 23:15:42 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Re: fork
Message-Id: <slrn9f3ijt.kmv.eins@www42.t-offline.de>
Mark Jason Dominus <mjd@plover.com> wrote:
> fork() is only for unusual circumstances.
Example:
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
> @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
^^^^
> ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
--
#!/usr/bin/perl -- Exercise: prove _or_ disprove that _all_ digits
############################ displayed are 1! s/^/4711081542426/g;
use strict;$|=@_=$0=2;for(;;){do{++$0}while('@'x$0)=~/^(..+)\1+$/;
push@_,$0;for((2-@_)..0){$_[-$_]=abs($_[-$_]-$_[1-$_])}print$_[0]}
------------------------------
Date: 3 May 2001 18:36:06 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FTP->new
Message-Id: <9cs8em$is7$2@mamenchi.zrz.TU-Berlin.DE>
According to Milton Road <miltonroad@btinternet.com>:
> Ravi Krishna wrote:
>
> > I am using perl FTP.
> >
> > my $ftp = Net::FTP->new($machineName,Timeout => 300) ;
> >
> > The timeout is in minutes right. So the default of 120 is 2 hours.
>
> Your timeout is in seconds, Ravi. Therefore the default of 120 is two
> minutes.
>
> Amazingly, the Net::FTP docs on the constructor don't seem to specify
> seconds - possibly because its reasonably self-explanatory.
No, it isn't self-explanatory. The computer community is largely
unaware of the necessity to specify both the numeric value and the unit
if there *is* a unit. This goes for documentation as well as program
output, and it's an annoying waste of time.
Anno
------------------------------
Date: Thu, 03 May 2001 18:19:17 GMT
From: "Patrick Joyce" <joycefive@earthlink.net>
Subject: help with parsing files
Message-Id: <FihI6.5109$Cq3.518542@newsread1.prod.itd.earthlink.net>
I want to create a perl program that will search through a bunch of html
files
outside of my root directory, find logo_small.gif and add the following
after that line.
<div align="right"><a href="http://207.244.72.79"><img
src="../pix/checkout.gif" width="120" height="20" alt="Go to Checkout"
border="0"></a></div>
This is what i have so far but it still doesnt
seem to be working.
it goes through all the folders but doesnt modify any files. If anybody can
help me please reply
or E-Mail me at joycefive@earthlink.net
$sss_path = 'c:/webpages/somespecial';
opendir (SSS, $sss_path);
while (defined ($dir = readdir SSS)) {
ChangeFile ("$sss_path/$dir") unless ($dir =~ /\./);
}
closedir (SSS);
exit;
sub ChangeFile {
local $path = shift;
print "$path\n";
foreach $file (<"$path/*.html">) {
open (OLD, $file);
open (NEW, ">$file.x");
while (<OLD>) {
print NEW $_;
if (/logo_small\.gif/) {
print NEW "<div align=\"right\"><a href=\"http://207.244.72.79\"><img
src=\"../pix/checkout.gif\" width=\"120\" height=\"20\" alt=\"Go to
Checkout\" border=\"0\"></a></div>\n";
}
}
close (OLD);
close (NEW);
unlink $file;
rename "$file.x", $file;
}
}
------------------------------
Date: Thu, 3 May 2001 14:39:21 EDT
From: Arek@nospam.tv (Arek P)
Subject: Re: How do I find the OS?
Message-Id: <9cs8kp$2t3v$1@earth.superlink.net>
On Wed, 02 May 2001 19:56:15 GMT, James Barcelona <barce@slip.net>
wrote:
or use special variable
perl -e 'print "I am runinng under $^O \n";'
ArekP
>Stuart Moore <stumo@bigfoot.com> wrote:
>> How can I most easily find the OS from within a Perl script?
>
>here's one way:
> print $ENV{"OSTYPE"};
>
>--
>http://www.slip.net/~barce
>
------------------------------
Date: Thu, 03 May 2001 20:00:26 GMT
From: "Patrick Joyce" <joycefive@earthlink.net>
Subject: need help with editing files
Message-Id: <uNiI6.5400$Cq3.543875@newsread1.prod.itd.earthlink.net>
I want to create a perl program that will search through a bunch of html
files
outside of my root directory, find logo_small.gif and add the following
after that line.
<div align="right"><a href="http://207.244.72.79"><img
src="../pix/checkout.gif" width="120" height="20" alt="Go to Checkout"
border="0"></a></div>
This is what i have so far but it still doesnt
seem to be working.
it goes through all the folders but doesnt modify any files. If anybody can
help me please reply
or E-Mail me at joycefive@earthlink.net
$sss_path = 'c:/webpages/somespecial';
opendir (SSS, $sss_path);
while (defined ($dir = readdir SSS)) {
ChangeFile ("$sss_path/$dir") unless ($dir =~ /\./);
}
closedir (SSS);
exit;
sub ChangeFile {
local $path = shift;
print "$path\n";
foreach $file (<"$path/*.html">) {
open (OLD, $file);
open (NEW, ">$file.x");
while (<OLD>) {
print NEW $_;
if (/logo_small\.gif/) {
print NEW "<div align=\"right\"><a href=\"http://207.244.72.79\"><img
src=\"../pix/checkout.gif\" width=\"120\" height=\"20\" alt=\"Go to
Checkout\" border=\"0\"></a></div>\n";
}
}
close (OLD);
close (NEW);
unlink $file;
rename "$file.x", $file;
}
}
------------------------------
Date: 03 May 2001 21:16:58 GMT
From: barryallwood@aol.com (Barry Allwood)
Subject: Parsing
Message-Id: <20010503171658.03330.00002312@ng-mn1.aol.com>
Hey,
Ive Created A Program It works fine but the parsing has stopped working, The
form has a hidden value called "Action" which when the form is submitted it
will process the request for the subroutine (look at the top) but I always
get a blank page for some reason, Im completely stumped and so is my Friend
who Op's Undernet's Perl
Here are the errors
Name "main::action" used only once: possible typo at scenemail.cgi line 213.
Name "main::USERS" used only once: possible typo at scenemail.cgi line 55.
Name "main::version" used only once: possible typo at scenemail.cgi line 90.
Content-type: text/html
Use of uninitialized value at scenemail.cgi line 21.
Here's the code:-
#!/usr/bin/perl -w
require "var_settings.cgi";
require "var_users.cgi";
$thiscgi = "SceneMail.cgi";
$Action = $FORM{'ACTION'};
$username = $FORM{'USERNAME'};
$pass = $FORM{'PASSWORD'};
print "Content-type: text/html\n\n";
if ( &readparse ) {
if ($Action eq "admin") {&AdminMenu
} else {&DoStart}
}
#----------Form Parsing Start----------#
sub readparse {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} =
$value;
}
}
#----------Form Parsing End----------#
sub DoStart {
print &DoAdminHead, &DoAdminAction, qq{
<form method="POST" action="$thiscgi">
<input type="hidden" name="action" value="admin">
<p align="center"> <font color="#303C48">Username
<input type="text" name="username">
<br>
Password </font>
<input type="password" name="password">
<br>
<input type="submit" name="Submit" Value="Submit">
</p>
</form>
};
print &DoAdminFoot, qq{
};
}
sub AdminMenu {
if ($pass != $USERS{$username}->{password}) {&bail("I Suck!")}
if ($pass eq "") {&bail("No Password Has Been Submitted, Please Press Your
Back Button And Enter A Password : $!")
} elsif ($username eq "") {&bail("No Username Has Been Submitted, Please
Press Your Back Button And Enter A Username : $!")}
print &DoAdminHead, &DoAdminAction, qq{
<blockquote>
<div align="left">
<p><font size="4"><b><font face="Verdana"><br>
Welcome To the Admin $username</font><br>
<br>
</b> <font size="1" face="Verdana">Here You can control all of
SceneMails
Settings and Users, Chose and Option from the menu above or the
list
below.</font><font size="1"><br>
<br>
<b><font face="Verdana">[<a href="$thiscgi">Settings</a>]</font>
</b><font face="Verdana">- [--General Properties Of The Script
e.g.
file locations--]<b><br>
[<a href="$baseurl/$thiscgi?DoAddUser">Add User</a>] -</b>
[--Manually
Add a User To The Database--]<b><br>
[<a href="$baseurl/$thiscgi?DoDeleteUser">Delete User</a>] -
</b>[--Remove
User From The Database--]<b><br>
[<a href="$baseurl/$thiscgi?DoEditUser">Edit User</a>] -
</b>[--Edit
User Properties--]<b><br>
[<a href="$baseurl/$thiscgi?DoTextAdd">Add An Anouncement</a>] -
</b>[--Add
An Anouncement For All User--] </font></font></font></p>
</div>
</blockquote>
};
print &DoAdminFoot, qq{
};
}
#-----Error Messages
sub bail {
my $errormessage = "@_";
print qq{
<html>
<head>
<title>SceneMail $version Error!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#062F16" text="#007979">
<table width="100%" border="1" cellspacing="0" cellpadding="1"
bordercolor="#000000">
<tr bordercolor="#117B3C">
<td width="100%" bgcolor="#117B3C"><font color="#FFFFFF" face="Verdana"
size="5"><b><font color="#000000"><i><font face="Arial">Scene
Mail $Version Error</font></i></font></b></font></td>
</tr>
<tr bgcolor="#004D26" bordercolor="#000000">
<td height="252"><font color="#CCCCCC" face="verdana" size="2"> </font>
<table width="95%" border="0" cellspacing="0" cellpadding="6"
align="center">
<tr bordercolor="#000000">
<td height="168">
<div align="left">
<p align="left"><font color="#CCCCCC" face="verdana"
size="2"><font size="5">Error
:<font size="3"> $errormessage</font></font><br>
</font></p>
<hr noshade>
<p align="left"><font color="#CCCCCC" face="verdana" size="2">
<b><font size="3"><i>Requested
Method </i></font></b></font><i><b><font color="#000000"
face="verdana" size="3">$ENV{'REQUEST_METHOD'}<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b><font size="3"><i>Scenemail
Version </i></font></b></font><i><b><font color="#000000"
face="verdana" size="3">$Version</font></b></i><font color="#000000"
face="verdana" size="3">
</font></b></i><i><b><font color="#000000" face="verdana"
size="3"><br>
</font></b></i><font color="#CCCCCC" face="verdana"
size="2"><b><br>
Server Type </b><font
color="#000000">$ENV{'SERVER_SOFTWARE'}<br>
</font></font><font color="#CCCCCC" face="verdana"
size="2"><b>Server
Name </b></font><font color="#000000" face="verdana"
size="2">$ENV{'SERVER_NAME'}
<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b>Server
Port Number </b></font><font color="#000000" face="verdana"
size="2">$ENV{'SERVER_PORT'}
</font><font color="#000000" face="verdana" size="2"><br>
</font><font color="#CCCCCC" face="verdana" size="2"><b>Path
Information
</b></font><font color="#000000" face="verdana"
size="2">$ENV{'PATH_INFO'}
<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b>Query
String </b></font><font color="#000000" face="verdana"
size="2">$ENV{'QUERY_STRING'}
<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b>Remote
Host/Server </b></font> <font color="#000000" face="verdana"
size="2">$ENV{'REMOTE_HOST'}
<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b>I.P.</b></font>
<font color="#000000" face="verdana"
size="2">$ENV{'REMOTE_ADDR'}
<br>
</font><font color="#CCCCCC" face="verdana"
size="2"><b>Browser
</b></font><font color="#000000" face="verdana"
size="2">$ENV{'HTTP_USER_AGENT'}
<br>
<br>
</font><font color="#CCCCCC" face="verdana" size="2">
</font></p>
</div>
</td>
</tr>
</table>
<font color="#CCCCCC" face="verdana" size="2"> </font> </td>
</tr>
<tr bgcolor="#006633" bordercolor="#006633">
<td height="2">
<div align="center"><font color="#000000" face="Verdana"
size="2">Scenemail
Is © ElBazo (Barry Allwood) 2001 No content must be
reproduced!</font>
</div>
</td>
</tr>
</table>
<div align="center"><font color="#006633"> <br>
</font></div>
</body>
</html>
};
die $errormessage;
exit(0);
}
#----Templates Below----#
sub DoAdminHead {
print qq{
<html>
<head>
<title>SceneMail $Version Admin</title>
<STYLE TYPE="text/css">
<!--
A { color: #000000; text-decoration: none}
A:hover { color: #CCCCCC text-decoration: underline}
a.action:link { color: #303C48; text-decoration: none}
a.action:hover { color: #FFFFFF; text-decoration: underline}
//-->
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#333333">
<table width="100%" border="1" cellspacing="0" cellpadding="0"
bordercolor="#000000">
<tr bgcolor="#303C48" bordercolor="#333333">
<td colspan="2" height="23">
<div align="center"><font size="5"><b><font color="#9098A0"
face="Arial, Helvetica, sans-serif">SceneMail
$Version - Admin</font></b></font></div>
}
}
sub DoAdminAction {
print qq{
</td>
</tr>
<tr bordercolor="#999999" bgcolor="#999999">
<td colspan="2" height="2">
<div align="center"><font color="#303C48" face="Arial, Helvetica,
sans-serif" size="2">[
<a href="$baseurl/$thiscgi?DoSettings" class="action">Settings</a> |
<a href="$baseurl/$thiscgi?DoAddUser" class="action">Add
User</a> | <a href="$baseurl/$thiscgi?DoDeleteUser"
class="action">Delete
User</a> | <a href="$baseurl/$thiscgi?DoEditUser"
class="action">Edit
User</a> | <a href="$baseurl/$thiscgi?DoTextAdd" class="action">Add
An
Anouncement</a> ] </font></div>
</td>
</tr>
<tr bordercolor="#333333" bgcolor="#999999">
<td colspan="2">
}
}
sub DoAdminFoot {
print qq{
</td>
</tr>
<tr bgcolor="#303C48" bordercolor="#333333">
<td colspan="2">
<div align="center"><font color="#9098A0">The Current Action Is
$action</font></div>
</td>
</tr>
</table>
</body>
</html>
}
}
Thanks In Advance,
Barry
------------------------------
Date: Thu, 3 May 2001 21:35:35 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Parsing
Message-Id: <slrn9f3jp7.ed5.abigail@tsathoggua.rlyeh.net>
Barry Allwood (barryallwood@aol.com) wrote on MMDCCCII September MCMXCIII
in <URL:news:20010503171658.03330.00002312@ng-mn1.aol.com>:
() Hey,
()
() Ive Created A Program It works fine but the parsing has stopped working, The
That's because you rolled your own (or rather, cut-and-pasted some cargo
cult in your program) instead of using the CGI module.
() form has a hidden value called "Action" which when the form is submitted it
() will process the request for the subroutine (look at the top) but I always
() get a blank page for some reason, Im completely stumped and so is my Friend
() who Op's Undernet's Perl
()
() Here are the errors
()
() Name "main::action" used only once: possible typo at scenemail.cgi line 213.
() Name "main::USERS" used only once: possible typo at scenemail.cgi line 55.
() Name "main::version" used only once: possible typo at scenemail.cgi line 90.
() Content-type: text/html
()
() Use of uninitialized value at scenemail.cgi line 21.
Those are all warnings, not errors. Warnings are explained in the perldiag
manpage.
You included way over 200 lines of code, yet you don't say what's wrong.
Do you really expect a useful answer? Noone here is going through 200
lines of code trying to spot an undisclosed bug. Specially if you don't
use "use CGI;". And you should be using "use strict;" as well. And -T.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Thu, 03 May 2001 13:30:43 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Peculiar output from 'top' command
Message-Id: <3AF1A3D3.A6753443@uswest.com>
Hi all,
Perl 5.6 on Bughat 6.2
I'm doing some system monitoring by sending the output of the 'top'
command to a web page via CGI.pm. For now, I'm just trying to print the
headers (PID, USER, etc) into an HTML table. When sent to the command
line, the headers appear as expected. When sent to the web page, I'm
getting two anomalies.
The first result is showing up in the web page as "[7m" - I've no idea
what that is
The last result is showing up as "COMMAND[K[m" - The 'COMMAND' is
correct, but what are those end characters?
Thanks in advace for any help.
Mr. Sunray
Code snippet below
...
if($^O eq "solaris"){ @results = `top -n 10` }
else{ @results = `top -n 1` }
$html .= "<TABLE width='92\%' border='1'>\n";
print $socket $html;
my $found = 0;
foreach my $row(@results){
next if($row =~ /^\s*$/); # Skip blank lines
if(($found != 1) && ($row =~ /^.*?PID.*?$/)){
@headers = split(/\s+/, $row);
$found = 1;
next;
}
next unless($found == 1); # Skip all data until headers found
}
foreach my $header(@headers){
next if($header eq "");
$html = "<TR valign=top>\n";
$html .= "<TD>$header</TD></TR>\n";
print $socket $html;
}
$html = "</TABLE>\n";
print $socket $html;
print $socket "EOF\n"; # Let client know we're done
------------------------------
Date: 03 May 2001 19:38:15 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: Peculiar output from 'top' command
Message-Id: <slrn9f32l1.7kb.dave@sydney.daveb.net>
On Thu, 03 May 2001 13:30:43 -0500, Mr. Sunray <djberge@uswest.com> wrote:
>Hi all,
>I'm doing some system monitoring by sending the output of the 'top'
>command to a web page via CGI.pm. For now, I'm just trying to print the
>headers (PID, USER, etc) into an HTML table. When sent to the command
>line, the headers appear as expected. When sent to the web page, I'm
>getting two anomalies.
>
>The first result is showing up in the web page as "[7m" - I've no idea
>what that is
>The last result is showing up as "COMMAND[K[m" - The 'COMMAND' is
>correct, but what are those end characters?
[...]
>else{ @results = `top -n 1` }
Try adding this:
map {s/\x0f|\x1b\x5b.*?[\x48\x4b\x6d]//g} @results;
The extra characters are escape sequences to make reverse and bold text.
I don't know what all of the sequences are but the regex above gets rid
of all of them for me. I figure you might also want to get rid of \r.
Here is the scriptlet I wrote to help figure out the regex, in case your
top command produces other escape sequences the one above doesn't cover:
#!/usr/bin/perl -w
use strict;
my @results = `top -n 1`;
#map {s/\x0f|\x1b\x5b.*?[\x48\x4b\x6d]//g} @results;
foreach ( @results ) {
next if !/\S/;
print join "\t", split /\s+/;
print "\n";
print join ' ', map {(ord==0x1b)?"[ESC]":ord} split //;
print "\n";
}
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: 3 May 2001 19:25:31 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9csbbb$ik3$0@216.155.32.28>
In article <uBdI6.206669$lj4.5935761@news6.giganews.com>,
clpmisc@dfw.pm.org wrote:
| Social faux pas to avoid
| - Asking a Frequently Asked Question
| - Asking a question easily answered by a cursory doc search
| - Asking for emailed answers
- 'stealth cc:ing' your answers (i.e. e-mailing AND posting
a reply without indicating in the body of the message
that you have done so, as a courtesy to the reader.)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: 3 May 2001 19:27:08 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9csbec$ik3$1@216.155.32.28>
In article <slrn9f2pnh.pb7.tadmc@tadmc26.august.net>,
tadmc@augustmail.com (Tad McClellan) wrote:
| clpmisc@dfw.pm.org <clpmisc@dfw.pm.org> wrote:
|
| >Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
|
| >[snip for testing]
|
|
| Oh crud!
|
| This was supposed to be going to a 'test' newsgroup.
|
| I messed up. Sorry.
Look at it this way -- you're getting some preliminary peer review,
gratis. :D
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Thu, 03 May 2001 20:17:57 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <l8f3ft8tfona2qk0g1lmn98qaluq675gpl@4ax.com>
clpmisc@dfw.pm.org wrote:
> Social faux pas to avoid
> - Asking for emailed answers
Especially, asking for emailed answers and only providing a munged email
address.
--
Bart.
------------------------------
Date: Thu, 03 May 2001 14:25:09 -0500
From: Bing Du <bing-du@tamu.edu>
Subject: Re: prevent empty message being sent?
Message-Id: <3AF1B095.DF0B3AFC@tamu.edu>
Part of my $message is dynamically generated and formatted. The rest is
static. Now I need to figure out how to put them all in one variable.
Thanks for the help.
Bing
Andras Malatinszky wrote:
> Bing Du wrote:
>
> > Hi,
> >
> > In the following snippet of code, if RESULT is closed normally, then the
> > stuff printed to it can get sent out. What if the script aborts before
> > close(RESULT), so RESULT will still be closed, but this time, an empty
> > message will be sent to user@tamu.edu.
> > How should I do to prevent empty message being sent?
> >
> > open(RESULT,"|/usr/sbin/mailx -s 'a test message' user\@tamu.edu");
> > # print stuff to RESULT
> > close(RESULT);
> >
> > Thanks,
> >
> > Bing
>
> How's this?
>
> #Put the stuff you want to send out in a variable called $message
> #Check if $message is in a decent enough shape to be sent out, and send only
> if
> #yes, e.g.
>
> if ($message){
> open(RESULT,"|/usr/sbin/mailx -s 'a test message' user\@tamu.edu");
> # print stuff to RESULT
> close(RESULT)};
>
> #or maybe
>
> if ($message=~m/\S/){
> open(RESULT,"|/usr/sbin/mailx -s 'a test message' user\@tamu.edu");
> # print stuff to RESULT
> close(RESULT)};
------------------------------
Date: Thu, 03 May 2001 20:25:13 GMT
From: "Eric" <mail@NOSPAMericmarques.net>
Subject: Printing HTTP headers/body in perl
Message-Id: <J8jI6.30316$PF4.55292@news.iol.ie>
I want to make a perl script
to show the headers/content the browser sends to the script in the http
request
i dont mean to just print the environment variables
i want to read the exact headers/body everything the browser sends to the
script
i have an idea that this info is in the STDIN
i tried
print STDIN;
but it didnt work printed nothing
please help
--
Eric Marques
mail@ericmarques.net
------------------------------
Date: Thu, 3 May 2001 14:39:12 -0700
From: "Brandon Thornburg" <centreman_19@NOSPAMyahoo.com>
Subject: Re: Recursing a directory tree
Message-Id: <9csjf5$n9t$1@fremont.ohsu.edu>
> According to Brandon Thornburg <centreman_19@NOSPAMyahoo.com>:
> Yikes! A book suggestion on Usenet!
Point taken, but the way it was presented (i.e. the ISBN number, etc.)
seemed 1) like an advertisement or 2) like RTFM, which is what I really
protest against.
> There are good books about Perl, and there are crappy books. Advice
> on what books to buy is high in demand among Perl novices. PCB is
> one of the good ones, that's why it deserves recommendation.
No argument there.
> There is no simple code for recursing down a directory structure,
Good point as well. I was trying to make a generic point, as in "If you
don't want to help _________ with __________, just don't respond, or respond
with how he or she can get help.
> O'Reilly is known for the fact that the code from their books is
> available on their web site. I'd be surprised if PCB was an exception.
I have no challenge for that, if true, and I will be the first to admit I
have a lot to learn about Perl and its support.
> I'm all for keeping commercialism out of Usenet, but you're, uh...
> what's it they say about the baby and the bath water?
I think I get so tired of seeing RTFM-ism that perceiving that combined with
what seemed like blatant commercialism, that I snapped...I am fully aware
that there ARE people out there who do no research on their own and want all
their questions answered with no responsiblity. It's just that lately I also
see a lot of times when all appearances point to a poster just lying in wait
for any chance to show how blind someone is for not finding something in the
perldocs. It's starting to look like the first post phenomenon, and it
drives me nuts. So, my point is, you're right, Anno, but I stand behind the
initial impulse that made me post what I did.
Brandon Thornburg
------------------------------
Date: 3 May 2001 21:03:29 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Test for integer?
Message-Id: <9csh31$o2o$1@mamenchi.zrz.TU-Berlin.DE>
According to <nobull@mail.com>:
> "Dodger" <dodger@necrosoft.net> writes:
>
> > "Rob" <"relaxedrob@optushome.com.au"> wrote in message
> > news:2t6I6.1899$76.7930@news1.rdc1.nsw.optushome.com.au...
> > > Hi all!
> > >
> > > Is there a way for me to test if a scalar holds an integer value (positive
> > > or negative)?
> > >
> > > Thanks!
> >
> > Saw a lot of replies, some very elabourate. However, it seems to me that:
> > ($val == int $val)
> > should do the trick fine...
>
> So "banana" is an integer in your book?
No, but the question "Is a scalar an integer" has been treated a bit
one-sided as "does it contain the decimal representation of an integer".
The simpler interpretation of "I know it's a number, but is it integer"
is also legitimate. If we twist it to mean, "is it a native integer",
it isn't even that simple anymore.
Anno
------------------------------
Date: Thu, 03 May 2001 11:33:49 -0700
From: Robert Fonda <rlf@proimages.net>
Subject: Trying to find SSH or SSL interface for Perl
Message-Id: <3AF1A48D.77FE395A@proimages.net>
I am trying to find a Perl module for either SSH or SSL. I didn't see
one on the CPAN site, maybe I missed something. Thoughts?
Robert
------------------------------
Date: Thu, 03 May 2001 14:03:20 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: Trying to find SSH or SSL interface for Perl
Message-Id: <3AF1AB78.EF8FB105@uswest.com>
Robert Fonda wrote:
> I am trying to find a Perl module for either SSH or SSL. I didn't see
> one on the CPAN site, maybe I missed something. Thoughts?
>
> Robert
Yep, it's there. See Net::SSH by Benjamin Trott (now with support for
SSH2 as well). I think there's an SSL module as well.
Mr. Sunray
------------------------------
Date: Thu, 3 May 2001 15:10:33 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Trying to find SSH or SSL interface for Perl
Message-Id: <slrn9f3b99.12u.tadmc@tadmc26.august.net>
Robert Fonda <rlf@proimages.net> wrote:
>I am trying to find a Perl module for either SSH or SSL. I didn't see
>one on the CPAN site, maybe I missed something. Thoughts?
I think you missed something :-)
Searching for "ssh" (without the quotes) at search.cpan.org
finds 42 modules.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 03 May 2001 14:35:39 -0700
From: Robert Fonda <rlf@proimages.net>
Subject: Re: Trying to find SSH or SSL interface for Perl
Message-Id: <3AF1CF2B.F1B0D645@proimages.net>
Robert Fonda wrote:
>
> I am trying to find a Perl module for either SSH or SSL. I didn't see
> one on the CPAN site, maybe I missed something. Thoughts?
>
> Robert
Yup, apparently I missed allot! Thanks.
Robert
------------------------------
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 829
**************************************