[25454] in Perl-Users-Digest
Perl-Users Digest, Issue: 7699 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 27 09:05:50 2005
Date: Thu, 27 Jan 2005 06:05:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 27 Jan 2005 Volume: 10 Number: 7699
Today's topics:
Re: Arbitrary decimal places in addition <wksmith@optonline.net>
Bug in perl v5.8.5 Built for sun4-solaris. Any patch a <ganesh_tiwari@hotmail.com>
Re: Compare string and eventually store <nobull@mail.com>
Error with script - internal error or misconfiguration sino74@hotmail.com
Re: Error with script - internal error or misconfigura <no@email.com>
Re: Error with script - internal error or misconfigura <spamtrap@dot-app.org>
Re: Error with script - internal error or misconfigura <1usa@llenroc.ude.invalid>
Re: Error with script - internal error or misconfigura <1usa@llenroc.ude.invalid>
Free Random Password Generator Spam2@Sharewareisland.com
Re: How can I call a subroutine / function and not wait <nobull@mail.com>
Re: Net::SSH::Perl sending output to STDOUT ryanmhuc@yahoo.com
Re: Old tutorial - now corrected <ebohlman@omsdev.com>
Pawan Deshpande - Need Help Automating Configuration of aditya_r_d@yahoo.com
Perl Script <padmakumarp@gmail.com>
Re: Perl Script <nobull@mail.com>
Re: Perl Script <nobull@mail.com>
Re: Perl Script <spamtrap@dot-app.org>
Re: Regex for finding email addresses inside text file <terrylr@blauedonau.com>
Re: Regex for finding email addresses inside text file <toreau@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 27 Jan 2005 00:29:17 -0500
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Arbitrary decimal places in addition
Message-Id: <I__Jd.15$F7.2@fe12.lga>
"Matthew Keene" <dfg778@yahoo.com.au> wrote in message
news:bb27253c.0501261721.214b3b52@posting.google.com...
--snip
> guess we could find the greatest number of decimal places in the input
> and round to that, but this seems to be getting a bit silly).
>
If you want the input format to control the output format, yes, you do
have to do it explicitly.
This is not a limitation of perl, but rather of binary floating point
arithmetic. Nearly all computers do arithmetic with some variation of
this. All general purpose languages such as perl use the computer's
arithmethic instructions.
Bill
------------------------------
Date: 27 Jan 2005 05:21:52 -0800
From: "Gancy" <ganesh_tiwari@hotmail.com>
Subject: Bug in perl v5.8.5 Built for sun4-solaris. Any patch availabale?
Message-Id: <1106832112.930486.16010@z14g2000cwz.googlegroups.com>
Hello All,
Today I have posted a question regrdaing a core dump issue. I did more
investigation on this and I found some more information.
1. I have a HPUX 11i box and the perl version and other information is
as follows:
*******************************************************
This is perl, v5.6.1 built for PA-RISC1.1-thread-multi
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2001, Larry Wall
Binary build 633 provided by ActiveState Corp.
http://www.ActiveState.com
Built 21:04:57 Jun 17 2002
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
******************************************************
With this version of perl I DONT see core dump problem. But with the
perl which I have on my SunOS box, I do see core dump.
*******************************************************
This is perl, v5.8.5 built for sun4-solaris
Copyright 1987-2004, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
********************************************************
Here is the stack trace:
[24376] S_regmatch(0x0, 0x128468, 0x1, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24377] S_regmatch(0x0, 0x128460, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24378] S_regmatch(0x0, 0x128450, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4934
[24379] S_regmatch(0x0, 0x128438, 0x0, 0x117400, 0x11a000,
0xffffffff), at 0xd4714
[24380] S_regtry(0x1283c8, 0x16288b, 0x12e531, 0x18cf56, 0x18cf57,
0x1627ef), at 0xd0a78
[24381] Perl_regexec_flags(0x1283c8, 0x1627ef, 0x18cf55, 0x161da0,
0x0, 0x16288b), at 0xd0554
[24382] Perl_pp_match(0x1283c8, 0x12d878, 0x100, 0x12d878, 0x18cf65,
0x13), at 0x819e4
[24383] Perl_runops_standard(0x117400, 0x1223e0, 0x127420, 0x0,
0x11ff94, 0x0), at 0x7de70
[24384] S_run_body(0x1, 0x117c00, 0x117c00, 0x0, 0xffbefa4c, 0x3), at
0x28490
[24385] perl_run(0x0, 0xfffffffc, 0x3, 0xffbefa3c, 0x0, 0x0), at
0x280c0
[24386] main(0x3, 0xffbefa3c, 0xffbefa4c, 0x1176a8, 0x0, 0x0), at
0x24e34
Has anyone faced similar problem?? If any patch is available then
please let me know.
******************************
My previous question was....
Here is the snipet of the perl script, I have perl version v5.8.5 built
for sun4-solaris. I have run this script on thousands of 'c','C++'
headers and source files. Runs smoothly as my new ESTEEM car. But i
have one surce file toke.c in my test case. soon this scripts hits this
file at it dumps. I have tried and still trying to debug, but still no
solutions. If anybody can help me with this would be of great
appreciation. I can uploaded source file (toke.c) as well as core file
frames(core), if needed.
#!/usr/bin/perl
$np = qr{
\(
(?:
(?>[^()]+ )
|
(??{ $np })
)*
\)
}x;
$funpat = qr/((\W)?(\*?\*?\w+)\s*($np))/;
my $temp;
open (FILE, "toke.c") || die "Cannot open file";
while($temp = <FILE>)
{
$tstring.=$temp;
}
close FILE;
get_fn_call($tstring);
sub get_fn_call($){
my ($cur_str) = @_;
while( $cur_str =~ m/$funpat/g )
{
$4 =~ /^\(((.*\n*.*)*)\)$/;
get_fn_call($1);
}
}
Thanks
-Ganesh
------------------------------
Date: Thu, 27 Jan 2005 13:03:38 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Compare string and eventually store
Message-Id: <ctaohf$nme$1@sun3.bham.ac.uk>
Jacks wrote:
> I would like to read in one line from file1 and check whether this
> line exists in somewhere in file2. If it doesnt I would like to write
> the line in file1 that did not find at match in file2 in a file called
> e.g. "diff.test"
Much as I like Perl and even though this is a Perl newshroup this is
really a job for grep not perl:
grep -Fxvf file2 file1 >diff.test
This is using GNU grep. Some lesser implementations may not support all
those switches.
------------------------------
Date: 27 Jan 2005 04:09:26 -0800
From: sino74@hotmail.com
Subject: Error with script - internal error or misconfiguration
Message-Id: <1106827765.983457.52050@z14g2000cwz.googlegroups.com>
Hi
I'm been having this error nad can't seem to locate the source of the
problem. I though the the error was the variables but even after
isolating them, the error message:
<<The server encountered an internal error or misconfiguration and was
unable to complete your request.>>
Still shows up. Does any have any idea what the cause is. Any help
would be appreciated.
HTML FILE________________________________________________________
<!-- ** INFORMATION ON THE PAGE ****************************
Page name _________________ : PY_iPass.html
Version ___________________ : 1.2
CSS used __________________ :
http://webcat.mt.cgi.ca/z_class_file/styles.css
Inputs ____________________ :
Outputs ___________________ :
Scripts used ______________ :
****** END OF INFORMATION ON THE PAGE ******************** -->
<html><head>
<!-- These 2 lines must be there for the character set and the Cascaded
Style Sheet -->
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<LINK REL="stylesheet"
HREF="http://webcat.mt.cgi.ca/z_class_file/styles.css" TYPE="TEXT/CSS">
<title>iPass Form</title>
<script LANGUAGE="JavaScript">
<!--
function doUser()
{
document.frmpending.msg2.value = "";
document.frmpending.msg2.value = "\n\tHere is your iPass / VPN
username: " + document.frmpending.user.value;
document.frmpending.msg2.value = document.frmpending.msg2.value +
"\n\tYour iPass / VPN and Token usage costs will be charged to the
following business unit: " + document.frmpending.bu.value + "\n";
}
function doLoad()
{
document.frmpending.msg3.value = "\nThe password to use with your
account is a combination of a PIN and a Token code (from the Token you
will receive soon). To set your PIN, you need to access the following
link : \nhttps://web.globalace.alcan.com/securidtest\n\nThis link is
only accessible from the Pechiney network, if you don't access, please
call the Helpdesk. If you have not already taken the interactive
tutorial for iPass, please go to the following webpage for iPass
training.\nhttp://www.intranet.plastics.pechiney.com/is/User_Audience/Remote_default.htm\n\nYou
can view an iPass User Guide or save it to your desktop for reference
while you are traveling. Click on \"iPass User Guide\" from the Remote
Usage webpage. Then click File, Save As. Give it a name and save it
to your desktop or C:\ drive. It will be saved as an .htm
document.\nhttp://www.intranet.plastics.pechiney.com/is/User_Audience/Remote_Usage/iPass_Usage_Guide.htm\n\nAfter
reviewing the interactive tutorial or User Guide, if you have any
questions about using iPass contact the Help Desk at
1-888-557-3400.\n\n-iPass has been added to your software profile. If
it does not automatically install the next time that you login, please
do the following:";
document.frmpending.msg3.value = document.frmpending.msg3.value +
"\n\n1. Double click on the \"ZenApplication\" icon on your
desktop\n\n2. Double click on the \"All\" icon\n\n3. Now you should
see iPass Install icon, if you double click on the icon, the software
should install.\n\nPlease let us know if the application is
working.\n\nIf we have not heard from you within two business days, we
will assume the install was completed successfully and your ticket will
be closed.\n\n\nSincerely,\nPechiney Americas Help
Desk\n1-888-557-3400\nhelpdesk.pyamericas@pechiney.com";
}
function echeck(str)
{
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if(-1 == str.indexOf("@pechiney.com") && -1 ==
str.indexOf("@alcan.com") && -1 == str.indexOf("@PECHINEY.COM") && -1
== str.indexOf("@ALCAN.COM"))
{
alert("Your email must have a '@pechiney.com' or
'@alcan.com'.");
return false;
}
if (str.indexOf(at)==-1)
{
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 ||
str.indexOf(at)==lstr)
{
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 ||
str.indexOf(dot)==lstr)
{
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1)
{
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot ||
str.substring(lat+1,lat+2)==dot)
{
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1)
{
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1)
{
alert("Invalid E-mail ID")
return false
}
return true
}
function ValidateForm(){
var emailID=document.frmpending.MIN_NUMBER
if ((emailID.value==null)||(emailID.value==""))
{
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false)
{
emailID.value=""
emailID.focus()
return false
}
return true
}
-->
</script>
</head>
<body >
<FORM name="frmpending"
ACTION="http://webcat.mt.cgi.ca/cgi-bin/xipassfollowup.cgi"
METHOD="post" onSubmit="return ValidateForm();">
<INPUT TYPE="hidden" NAME="TEMPLATE"
VALUE="/img/tnpp-fr/general/outbox/messageConfirmation.html">
<INPUT TYPE="hidden" NAME="EXCEPTION_TEMPLATE"
VALUE="/img/tnpp-fr/imgHtmlException.html">
<INPUT TYPE="HIDDEN" NAME="SMTP_RETURNPATH">
<INPUT TYPE="HIDDEN" NAME="MIN_RETURNPATH">
<INPUT TYPE="HIDDEN" NAME="FROM">
<INPUT TYPE="HIDDEN" NAME="CALLBACK_NUMBER">
<INPUT TYPE="HIDDEN" NAME="STATUS_REQUEST">
<basefont FACE="Arial,Helvetica">
<table width="100%" border="0">
<tr>
<td width="15%">To :</td>
<td width="85%"> <input name="MIN_NUMBER" type="text"
id="MIN_NUMBER" size="50">
</td>
</tr>
<tr>
<td>Subject:</td>
<td><input class="TXTR" name="MESSAGE_SUBJECT" type="text"
id="MESSAGE_SUBJECT" value="iPass Account Creation - Software Push -
Help Desk Ticket: " size="75" readonly="true"></td>
</tr>
<tr>
<td>AR Number:</td>
<td><input name="AR_NUMBER" type="text" id="AR_NUMBER"></td>
</tr>
<tr>
<td>User Name:</td>
<td><input name="user" type="text" id="user" value="" size="75"
onBlur="doUser();"></td>
</tr>
<tr>
<td>Department:</td>
<td><input name="bu" type="text" id="bu" value="" size="75"
onBlur="doUser();"></td>
</tr>
<tr>
<td>Site:</td>
<td><input name="site" type="text" id="site" size="75"></td>
</tr>
<tr>
<td>Group to which the user is assigned:</td>
<td>
<select name="group" id="group">
<option value="py-americas">RSA py-americas</option>
<option value="Neenah Customer Service Shared">RSA Neenah
Customer Service
Shared</option>
<option value="CGI">RSA CGI</option>
<option value="SOHO (Home User)">RSA SOHO (Home
User)</option>
<option value="Akron Shared">RSA Akron Shared</option>
</select></td>
</tr>
<tr>
<td> </td>
<td><input name="submit" type="submit" value="submit">
<br><input class="TXTD" name="CAT_PEOPLE" type="text"
value="helpdesk.pyamericas@pechiney.com">
</td>
</tr>
</table>
</form>
</body>
</html>
___________________________________________________________________
CGI Script_________________________________________________________
#!/usr/bin/perl
#
==================================================================
# This script is for to use with the form followup.html
# ==================================================================
# Variables From the Form :
#
# CAT_PEOPLE : (FORM)HelpDesk, client company.
# (SCRIPT)For the field "From" in the e-mail sent.
#
# MIN_NUMBER: (FORM)Email address for message to be sent to.
# (SCRIPT)For the field "To" in the e-mail sent.
#
# MESSAGE_SUBJECT: (FORM) Subject line
# (SCRIPT) For the field "Subject" in the e-mail sent
#
# MESSAGE_BODY : (FORM) TextArea with all information about the case
to sent to support
# (SCRIPT) For the boby, where the text is in the
e-mail sent
#
=======================================================================================
# Others Variables
#
# time, months, days, day, year, timestamp : Not use in this script
# $content : Contains the text Message: to be concatenate with main
text in the body of the mail.
# $formdata : containt pair Key/Value (Key=name of field from the form
field, Value=text in that field)
#
=======================================================================================
# Parameter to setup
#
# #!/usr/bin/perl : Path where perl is locate
# open (MAIL, "|/usr/lib/sendmail -t -i") : Path where sendmail is
locate (to sent e-mail without e-mail client).
#
#
######################
#variable declarations
@time = localtime;
#Date manipulations
($hour, $min, $sec) = sprintf ('%02d:%02d:%02d', $time[2], $time[1],
$time[0]);
@months = qw(January February Mach April May June July August September
October November December);
#Making 2 Scalars
$month = $months[$time[4]];
$day = $time[3];
$year = $time[5] + 1900;
$timestamp = "$day, le $time[3] $month, $year $hour$min$sec";
#read for POST method to $buffer
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair ( @pairs ) {
($key,$val) = split(/=/,$pair);
$key =~ tr/+/ /;
$key =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ tr/+/ /;
$val =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
$val =~ s/<!--(.|\n)*-->//g;
$val =~ s/%(..)/pack("c",hex($1))/ge;
if($formdata{$key}){
$formdata{$key} .= ", $val";
}
else{
$formdata{$key} = $val;
}
}
$content="";
print 'Content-type: text/html ', "\n\n";
# Creating the TO, FROM, and SUBJECT fields
#formating email content
if ($formdata{'problem'} =~ "--Veuillez") {
print "<P><center> Vous n'avez pas choisi de contrainte.<BR> No
email has been sent out.</center>";
exit;
}
else {
open (MAIL, "|/usr/lib/sendmail -t -i") || &ErrorMessage;
print MAIL "To: $formdata{'MIN_NUMBER'}\n";
print MAIL "Cc: $formdata{'CAT_PEOPLE'}\n";
print MAIL "From: $formdata{'CAT_PEOPLE'}\n";
print MAIL "Subject: $formdata{'MESSAGE_SUBJECT'}
$formdata{'AR_NUMBER'}\n\n";
print MAIL $content . "The following iPass account was created:\n\nUser
name: $formdata{'user'}\nSite: $formdata{'site'}\nDevision:
$formdata{'bu'}\nGroup to which user is assignd: $formdata{'group'}\n";
close (MAIL);
print "E-mail follow up procedure has been started. The following text
has been e-mailed:<BR><BR>";
print "To: $formdata{'MIN_NUMBER'}<BR>";
print "Cc: $formdata{'CAT_PEOPLE'}<BR>";
print "From: $formdata{'CAT_PEOPLE'}<BR>";
print "Subject: $formdata{'MESSAGE_SUBJECT'}
$formdata{'AR_NUMBER'}<BR><BR>";
print $content . "The following iPass account was created:<BR><BR>User
name: $formdata{'user'}<BR>Site: $formdata{'site'}<BR>Devision:
$formdata{'bu'}<BR>Group to which user is assignd:
$formdata{'group'}<BR>";
sub ErrorMessage {
print "<P>The server has a problem. Aborting script.\n";
exit;
}}
------------------------------
Date: Thu, 27 Jan 2005 12:27:08 -0000
From: "Brian Wakem" <no@email.com>
Subject: Re: Error with script - internal error or misconfiguration
Message-Id: <35s50uF4nildhU1@individual.net>
<sino74@hotmail.com> wrote in message
news:1106827765.983457.52050@z14g2000cwz.googlegroups.com...
<snipped loads of stuff>
Do yourself a favour and
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
------------------------------
Date: Thu, 27 Jan 2005 07:33:01 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Error with script - internal error or misconfiguration
Message-Id: <6OudnVane6TiQmXcRVn-jA@adelphia.com>
sino74@hotmail.com wrote:
> I'm been having this error nad can't seem to locate the source of the
> problem. I though the the error was the variables but even after
> isolating them, the error message:
>
> <<The server encountered an internal error or misconfiguration and was
> unable to complete your request.>>
You are asking a Frequently Asked Question. Have a look at:
perldoc -q 500
First and foremost, do what the error message tells you to do, and look in
your web server logs. Perl has extensive diagnostics and error reporting
available - but none of it will help if you disable it and/or ignore what
it tells you.
Also, please read and follow the posting guidelines that appear here twice a
week. More to the point, please don't post a bunch of irrelevant HTML and
JavaScript - no one here is going to wade through all that.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Thu, 27 Jan 2005 13:05:16 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Error with script - internal error or misconfiguration
Message-Id: <Xns95EB524F7F5BBasu1cornelledu@127.0.0.1>
"Brian Wakem" <no@email.com> wrote in news:35s50uF4nildhU1@individual.net:
>
> <sino74@hotmail.com> wrote in message
> news:1106827765.983457.52050@z14g2000cwz.googlegroups.com...
>
> <snipped loads of stuff>
>
> Do yourself a favour and
>
> use strict;
> use warnings;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
This is also a very good time for the OP to read the posting guidelines
for this group. The guidelines contain valuable information on diagnosing
and describing problems that help one either fix the problem oneself or
describe it in a way that helps others help.
Sinan.
------------------------------
Date: Thu, 27 Jan 2005 13:26:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Error with script - internal error or misconfiguration
Message-Id: <Xns95EB55E9143E8asu1cornelledu@127.0.0.1>
sino74@hotmail.com wrote in
news:1106827765.983457.52050@z14g2000cwz.googlegroups.com:
> Hi
>
> I'm been having this error nad can't seem to locate the source of the
> problem. I though the the error was the variables but even after
> isolating them, the error message:
>
> <<The server encountered an internal error or misconfiguration and was
> unable to complete your request.>>
You should consult the Perl FAQ
perldoc -q 500
perldoc -q CGI
> Still shows up. Does any have any idea what the cause is. Any help
> would be appreciated.
Then you should help others help you. Please read the posting guidelines.
> HTML FILE________________________________________________________
> <!-- ** INFORMATION ON THE PAGE ****************************
Don't clutter your posting with useless information. It makes it harder
for others to read.
...
> <title>iPass Form</title>
> <script LANGUAGE="JavaScript">
> <!--
>
>
> function doUser()
Please don't :) Also, note that this is a Perl forum and there is no point
to posting Javascript here.
...
> CGI Script_________________________________________________________
OK, so, after I don't know how many irrelevant lines, we finally come to
your Perl script.
> #!/usr/bin/perl
> #
> ==================================================================
> # This script is for to use with the form followup.html
> # ==================================================================
> # Variables From the Form :
> #
> # CAT_PEOPLE : (FORM)HelpDesk, client company.
> # (SCRIPT)For the field "From" in the e-mail sent.
I have the distinct impression that this is something you are planning to
sell or otherwise make money off of. There is absolutely nothing wrong
with that. You just cannot expect people to then donate their time in
support of your business when you have not put any effort into posing your
question.
Note that this is still useless information that clutters your post and
makes it harder for others to read it.
> # #!/usr/bin/perl : Path where perl is locate
I realize this line is commented out in the script you posted, but do you
realize that if it were not, ": Path where perl is locate" would very
likely be passed to perl when this script is run?
> # open (MAIL, "|/usr/lib/sendmail -t -i") : Path where sendmail is
> locate (to sent e-mail without e-mail client).
Extra long comments that extend beyond the right margin have a tendency to
wrap around at most inopportune moments.
By the way, you are better off using a module such as Mime::Lite or
similar (see the past discussions on this newsgroup as well as the FAQ:
perldoc -q "send mail"
).
use strict;
use warnings;
missing.
> @time = localtime;
>
> #Date manipulations
>
> ($hour, $min, $sec) = sprintf ('%02d:%02d:%02d', $time[2], $time[1],
> $time[0]);
See
perldoc -f sprint
to find out that sprintf returns a single string. What do _you_ think the
line above does?
> @months = qw(January February Mach April May June July August
> September October November December);
> #Making 2 Scalars
> $month = $months[$time[4]];
> $day = $time[3];
>
> $year = $time[5] + 1900;
> $timestamp = "$day, le $time[3] $month, $year $hour$min$sec";
http://www.faqs.org/rfcs/rfc3339.html
> #read for POST method to $buffer
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair ( @pairs ) {
> ($key,$val) = split(/=/,$pair);
> $key =~ tr/+/ /;
> $key =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
> $val =~ tr/+/ /;
> $val =~ s/%([a-fA-F0-9][a-fA-F0-9]) /pack("C",hex($1)) /ge;
> $val =~ s/<!--(.|\n)*-->//g;
> $val =~ s/%(..)/pack("c",hex($1))/ge;
You copied and pasted this from somewhere and I would venture to guess
that you do not have the foggiest idea what it does.
use CGI;
and throw away this crap.
> open (MAIL, "|/usr/lib/sendmail -t -i") || &ErrorMessage;
Do you know what calling a sub with & does and do you need that? My guess
is that you don't. Also, your ErrorMessage subroutine does not do anything
useful. A simple:
open my $mail, "|/usr/lib/sendmail -t -i" or
die "Cannot open pipe to sendmail: $!";
would provide you with invaluable information in the server logs.
(You could also use CGI::Carp to have these error messages displayed in
the browser but I tend to avoid that for fear of accidentally leaving it
in when the script is deployed.)
> sub ErrorMessage {
> print "<P>The server has a problem. Aborting script.\n";
> exit;
> }}
Why do you have two braces at the end of the sub definition???
Sinan.
------------------------------
Date: 26 Jan 2005 21:08:16 -0800
From: Spam2@Sharewareisland.com
Subject: Free Random Password Generator
Message-Id: <1106802496.859719.34490@c13g2000cwb.googlegroups.com>
Free Random Password Generator
http://www.sharewareisland.com/randompasswords.aspx
------------------------------
Date: Thu, 27 Jan 2005 12:59:25 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: How can I call a subroutine / function and not wait for it to return?
Message-Id: <ctao9h$ndn$3@sun3.bham.ac.uk>
Jay Tilton wrote:
> bayxarea-usenet@yahoo.com wrote:
>
> : Uh ... no.. it is NOT that I don't want to use the tools .. it is that
> : AFAIK (as far as I know) these are not relevant
>
> You want a portion of the program to perform its assigned task while the
> larger portion of the program carries on its own processing. You exactly
> describe the type of problem that forking was designed to solve.
>
> : IPC - will allow me to call communicate with another process - ok -
> : great - but this isn't another process.
>
> It needs to be.
No, it could be a thread. But given the way threads are implemented in
Perl a fork would be better on Unix.
------------------------------
Date: 27 Jan 2005 06:04:18 -0800
From: ryanmhuc@yahoo.com
Subject: Re: Net::SSH::Perl sending output to STDOUT
Message-Id: <1106834658.299149.256400@f14g2000cwb.googlegroups.com>
The code is in the first post.
> > $ssh = Net::SSH::Perl->new($ip);
> > $ssh->login($user, $pass);
> > ($out, $err, $ext) = $ssh->cmd("ls -l");
When it is run it the output are being sent to STDOUT while it should
be returning it to the $out variable according to Net::SSH::Perl docs.
YYusenet wrote:
> ryanmhuc@yahoo.com wrote:
> > I'm using Net::SSH::Perl to connect to remote server but when every
I
> > run commands it is sending output to STDOUT.
> >
> > $ssh = Net::SSH::Perl->new($ip);
> > $ssh->login($user, $pass);
> > ($out, $err, $ext) = $ssh->cmd("ls -l");
> >
> > So when I run the command instead of the the command output being
put
> > into $out it goes straight to STDOUT. Furthermore if the password
is
> > incorrect the $ssh->cmd stops my program. Anyone know how to get
> > around this?
> >
> Are you using 'print OUT "what to send";' ? And it would help to see
> the code that you are trying to run.
>
> ****************
> k g a b e r t (at) x m i s s i o n (dot) c o m
------------------------------
Date: 27 Jan 2005 08:26:17 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Old tutorial - now corrected
Message-Id: <Xns95EB1A0C76EA9ebohlmanomsdevcom@130.133.1.4>
binnyva@hotmail.com wrote in news:1106766522.966545.9750
@z14g2000cwz.googlegroups.com:
> I admit that I should correct those scirpts - I will.
> But please not that those are functional scirpt -
> just not perfect. They have some bugs. The most
Most people with any experience in programming wouldn't consider
"functional" to be a useful way of saying "works only when conditions are
just right." A "functional" program works properly regardless of the
phase of the moon or the particular variety of goat you sacrifice.
The big issue here is your intended audience. By definition, a beginner
in any subject is someone who doesn't know enough about that subject to
be able to tell bad examples apart from good examples. Therefore, anyone
who writes a tutorial really, really, needs to make sure that all their
examples are as close to perfect as is humanly possible. If you present
beginners with half-assed examples, they'll internalize them and that
will put a big stumbling block in front of their future learning. It's
*much* harder for someone to unlearn The Wrong Way To Do It and
subsequently learn the Right Way To Do It than it is to learn the Right
Way from scratch.
You should make every possible effort *not* to expose beginners to
example code that contains bugs except as part of efforts to teach them
how to recognize bugs.
> noted problem was that I did not use CGI.pm
> module. One should remember that not everyone
> has the CGI.pm module. They should be having it -
> but its not a perlfect(sic) world.
CGI.pm has been part of the default Perl distribution for at least 7
years. Therefore, if someone doesn't have it, either they haven't
updated their Perl distribution since the mid-90s or they didn't install
the distribution properly. Under such circumstances, learning any aspect
of Perl programming is going to be unnecessarily difficult.
------------------------------
Date: 27 Jan 2005 01:39:07 -0800
From: aditya_r_d@yahoo.com
Subject: Pawan Deshpande - Need Help Automating Configuration of Routers and Firewalls?
Message-Id: <1106818747.632914.103370@c13g2000cwb.googlegroups.com>
I found a really slick tool that can help you automate configurations
for Cisco routers, PIX firewall, as well as Linux iptables and ip
route. It's called NetSPoC, which I believe is short for Network
Security Policy Compiler.
The developers say it's basically a replace for the Cisco Secure Policy
Manager (CSPM). According the compartison on the NetSPoC Web site,
NetSPoC is written in Perl so it runs on any platform that can run
Perl, and it's also much faster the CSPM. However there are some
drawbacks too. For example, there is no GUI for NetSPoC and it doesn't
support IPSec policies at this time.
You can learn more about the overall drawbacks and capabilities at the
NetSPoC Web site.
Aditya Desh Deshpande
------------------------------
Date: 27 Jan 2005 04:52:55 -0800
From: "padmakumar" <padmakumarp@gmail.com>
Subject: Perl Script
Message-Id: <1106830375.582686.291980@f14g2000cwb.googlegroups.com>
Hello
I'm new to Perl.
I have a one standard directory structure(Root directory and its sub
directories).
I'vebeen asked to write a perl script to create a database which
maintains directory structure
I am very much confused how to start for this .
could you pls guide me.how to start for this
Thanks a lot for your help
padmakumar
------------------------------
Date: Thu, 27 Jan 2005 12:56:38 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl Script
Message-Id: <ctao4a$ndn$2@sun3.bham.ac.uk>
padmakumar wrote:
> Subject: Perl Script
Please put the subject of your post in the Subject of your post.
------------------------------
Date: Thu, 27 Jan 2005 13:04:41 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl Script
Message-Id: <ctaojc$nme$2@sun3.bham.ac.uk>
padmakumar wrote:
> I'm new to Perl.
> I am very much confused how to start for this .
http://learn.perl.org/
------------------------------
Date: Thu, 27 Jan 2005 08:05:50 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Perl Script
Message-Id: <JOKdnUCG84KzemXcRVn-uQ@adelphia.com>
padmakumar wrote:
> I am very much confused how to start for this .
> could you pls guide me.how to start for this
A great place to get started learning Perl is:
<http://learn.perl.org>
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Thu, 27 Jan 2005 00:14:35 -0600
From: "terry l. ridder" <terrylr@blauedonau.com>
Subject: Re: Regex for finding email addresses inside text file
Message-Id: <Pine.LNX.4.61.0501262357450.25620@johann.blauedonau.com>
On Thu, 27 Jan 2005, Doug Wells wrote:
> Can anyone help me with a regex that looks through an entire text file
> which might have multiple email addresses in it, and writes those email
> addresses out to a second file?
>
just to give you some idea of how difficult that would be consider for a
moment just how many top level domains there are.
hint: 200+
there are 247 ccTLD
from .ac - Ascension Island through .zw - Zimbabwe
consider the ccTLD .us
there are numerous 2nd-level sub domains. the 50 states and the numerous
terroritories.
then there are the generic TLDs.
.aero, .biz, .com, .coop, .info, .museum, .name, .net, .org, .pro,
.gov, .edu, .mil, and .int
to learn more please refer to http://www.iana.org and look under domain
name services.
this is a nontrivial task.
>
> Thanks for the help
> Doug
>
--
terry l. ridder ><>
------------------------------
Date: Thu, 27 Jan 2005 11:46:06 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: Regex for finding email addresses inside text file
Message-Id: <MD3Kd.6239$IW4.132935@news2.e.nsc.no>
Doug Wells wrote:
> Can anyone help me with a regex that looks through an entire text file
> which might have multiple email addresses in it, and writes those email
> addresses out to a second file?
Take a look at the Mail::Address module on CPAN. It will let you can
text for email addresses;
#!/usr/bin/perl
#
use strict;
use warnings;
use Mail::Address;
my $text = '...';
my @addresses = Mail::Address->parse( $text );
my %addresses;
foreach ( @addresses ) {
$addresses{ $_->address() }++;
}
The rest is up to you, as it really is very simple.
--
Tore Aursand <tore@aursand.no>
"Those people who think they know everything are a great annoyance to
those of us who do." (Isaac Asimov)
------------------------------
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 7699
***************************************