[30579] in Perl-Users-Digest
Perl-Users Digest, Issue: 1822 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 27 06:09:40 2008
Date: Wed, 27 Aug 2008 03:09:07 -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, 27 Aug 2008 Volume: 11 Number: 1822
Today's topics:
Re: Can't remove directory <glex_no-spam@qwest-spam-no.invalid>
Re: Can't remove directory <slick.users@gmail.com>
Re: Can't remove directory <1usa@llenroc.ude.invalid>
Re: Can't remove directory <tadmc@seesig.invalid>
Re: Can't remove directory <tadmc@seesig.invalid>
Re: Debugging "exit" <ced@blv-sam-01.ca.boeing.com>
Re: Debugging "exit" <bugbear@trim_papermule.co.uk_trim>
Re: Getting the names for >200 directories <tadmc@seesig.invalid>
Huge perl scripts collection of any kinds for free <lfrogerscobalt@gmail.com>
Re: Huge perl scripts collection of any kinds for free (fidokomik\)
Re: Huge perl scripts collection of any kinds for free <cmic@caramail.com>
new CPAN modules on Wed Aug 27 2008 (Randal Schwartz)
Perl Newbie <robhoyer@alttek.ca>
Re: Perl Newbie <tadmc@seesig.invalid>
Repeating the loop <sajapuram.arun.prakash@gmail.com>
Re: Soap:lite with msdl file crash perl.exe v5.6.1 qa4ever@gmail.com
subprocesses lifecycle <breafk@remove.this.gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Aug 2008 17:32:15 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Can't remove directory
Message-Id: <48b48470$0$48221$815e3792@news.qwest.net>
Slickuser wrote:
> Sorry, it was \\. I try all possible case with directory structure,
> still doesn't work. Even with C:/folderA/..
>
> Those folders do exist. I can delete it manually. It just ask me to
> remove all files. I have to confirm ALL to remove it.
>
> my $dir_del = "C:\\folderA\\ABC\\D\\E";
> #$dir_del = 'C:\folderA\ABC\D\E';
> $dir_del =~ s/\\/\//ig;
Yuck.
my $dir_del = 'C:/folderA/ABC/D/E';
> chmod($dir_del,0755);
Wrong order of arguments.
perldoc -f chmod
Have chmod tell you when it fails and why:
chmod( ..., ... ) or die "chmod failed: $!"
> rmtree($dir_del);
Once you correct chmod, read the documentation for rmtree again
for options on how to get more verbose output so you can see what it
is/isn't deleting.
------------------------------
Date: Tue, 26 Aug 2008 16:21:33 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: Can't remove directory
Message-Id: <f58abccd-f5af-43e1-a2c3-af5855f940ed@o40g2000prn.googlegroups.com>
Error:
Dir exist.
chmod failed: No such file or directory at C:\script\chmod2.pl line
123.
$source =3D "c:/abc/a";
if (-d $source)
{
print "Dir exist.\n";
chmod($source,0644) or die "chmod failed: $!"; #line 123 here
}
On Aug 26, 3:32=A0pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> Slickuser wrote:
> > Sorry, it was \\. I try all possible case with directory structure,
> > still doesn't work. Even with C:/folderA/..
>
> > Those folders do exist. I can delete it manually. It just ask me to
> > remove all files. I have to confirm ALL to remove it.
>
> > my $dir_del =3D "C:\\folderA\\ABC\\D\\E";
> > #$dir_del =3D 'C:\folderA\ABC\D\E';
> > $dir_del =3D~ s/\\/\//ig;
>
> Yuck.
>
> my $dir_del =3D 'C:/folderA/ABC/D/E';
>
> > chmod($dir_del,0755);
>
> Wrong order of arguments.
>
> perldoc -f chmod
>
> Have chmod tell you when it fails and why:
> =A0 =A0 =A0 =A0 chmod( ..., ... ) or die "chmod failed: $!"
>
> > rmtree($dir_del);
>
> Once you correct chmod, read the documentation for rmtree again
> for options on how to get more verbose output so you can see what it
> is/isn't deleting.
------------------------------
Date: Tue, 26 Aug 2008 23:34:06 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Can't remove directory
Message-Id: <Xns9B06C708973DFasu1cornelledu@127.0.0.1>
Slickuser <slick.users@gmail.com> wrote in news:f58abccd-f5af-43e1-a2c3-
af5855f940ed@o40g2000prn.googlegroups.com:
> $source = "c:/abc/a";
> if (-d $source)
> {
> print "Dir exist.\n";
> chmod($source,0644) or die "chmod failed: $!"; #line 123 here
> }
>
This is the third time you have been told this:
perldoc -f chmod
chmod LIST
Changes the permissions of a list of files. The first element
of the list must be the numerical mode
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Tue, 26 Aug 2008 17:48:09 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Can't remove directory
Message-Id: <slrngb9219.r4g.tadmc@tadmc30.sbcglobal.net>
Slickuser <slick.users@gmail.com> wrote:
> Sorry,
Sorry for what?
Please quote some context in your followups like everybody else does.
> it was \\.
What was \\?
> $dir_del =~ s/\\/\//ig;
Are you saying that \\ was supposed to be in the regex there?
Why are you saying it in a followup to my post, where there
was no regex at all?
> chmod($dir_del,0755);
Repetition is the key to learning so,
Did you look as far as the 2nd sentence in the docs for chmod?
... The first element of the list must be the numerical mode
Are you paying any attention to the followups you've been getting?
It sure doesn't look like it.
There is not much point in trying to help you if you are
not going to accept any help.
So long!
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 26 Aug 2008 18:39:22 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Can't remove directory
Message-Id: <slrngb951a.rpi.tadmc@tadmc30.sbcglobal.net>
Slickuser <slick.users@gmail.com> wrote:
> chmod failed: No such file or directory at C:\script\chmod2.pl line
^^^^^^^^^^^^^^^^^^^
>
>
> $source = "c:/abc/a";
^^^^^^^^
> {
> print "Dir exist.\n";
> chmod($source,0644) or die "chmod failed: $!"; #line 123 here
> }
That output clearly did not come from that program.
If you compare the output of one program with the code of a different
program, you will never solve your problem.
If you need help with your program, then we will need to
see *the same program" that you are running!
[ snip upside-down posting.
Please do not top-post.
Quote, snip and interleave comments like everybody else does.
]
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 26 Aug 2008 20:26:30 -0700 (PDT)
From: "C.DeRykus" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Debugging "exit"
Message-Id: <744a2f0b-1b08-4f59-bb6b-20c2b25fbfe2@b2g2000prf.googlegroups.com>
On Aug 25, 6:29 am, Ignoramus9283 <ignoramus9...@NOSPAM.9283.invalid>
wrote:
> We have a script that is supposed to run continuously and never to
> die or exit. And it generally does that, except that sometimes it does
> not and exits mysteriously.
>
> We capture its stdout and stderr and there is "nothing abnormal".
>
> We do use strict and use warnings.
>
> So, I think that possibly some library routine, or some such thing,
> calls "exit". I would like to trap exit globally, and still exit, but
> at least print stack trace or some such, before exiting, is that
> possible?
>
> Is so, how?
>
> thanks
>
> --
> Due to extreme spam originating from Google Groups, and their inattention
> to spammers, I and many others block all articles originating
> from Google Groups. If you want your postings to be seen by
> more readers you will need to find a different means of
> posting on Usenet.
> http://improve-usenet.org/
One other possible stealth threat is an uncaught signal termination
that'll bypass the END block.
A possible unix strategy is a small
wrapper around your primary script which captures and reports $?.
--
Charles DeRykus
------------------------------
Date: Wed, 27 Aug 2008 10:31:56 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Debugging "exit"
Message-Id: <cuqdneb6wtyQgijV4p2dnAA@posted.plusnet>
Ignoramus9283 wrote:
> We have a script that is supposed to run continuously and never to
> die or exit. And it generally does that, except that sometimes it does
> not and exits mysteriously.
>
> We capture its stdout and stderr and there is "nothing abnormal".
>
> We do use strict and use warnings.
>
> So, I think that possibly some library routine, or some such thing,
> calls "exit". I would like to trap exit globally, and still exit, but
> at least print stack trace or some such, before exiting, is that
> possible?
>
> Is so, how?
Run under a cpu level debugger, with a breakpoint on exit?
BugBear
------------------------------
Date: Tue, 26 Aug 2008 18:15:15 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Getting the names for >200 directories
Message-Id: <slrngb93k3.r4g.tadmc@tadmc30.sbcglobal.net>
frankthechicken@gmail.com <frankthechicken@gmail.com> wrote:
> my @dir_names = grep -d "$path/$_", readdir DIR;
^
^
> while (defined(my $file = readdir(DIR))) {
> next if $file =~ /^\.\.?$/;
> if (-d "$path$file"){
^^
Where is the directory separator?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 26 Aug 2008 17:24:22 -0700 (PDT)
From: Albertos <lfrogerscobalt@gmail.com>
Subject: Huge perl scripts collection of any kinds for free
Message-Id: <f9247801-b471-45b7-a029-d2e8fe733926@v57g2000hse.googlegroups.com>
Hello, I've collected huge perl scripts collection of any kinds : work
with text files, database, GUI etc. You can download it here
http://freactor.com/get.php?file=perl+scripts
------------------------------
Date: Wed, 27 Aug 2008 02:55:25 +0200
From: "Petr Vileta \(fidokomik\)" <stoupa@practisoft.cz>
Subject: Re: Huge perl scripts collection of any kinds for free
Message-Id: <g929a7$aft$1@adenine.netfront.net>
Albertos wrote:
> Hello, I've collected huge perl scripts collection of any kinds : work
> with text files, database, GUI etc. You can download it here
> http://freactor.com/get.php?file=perl+scripts
Hmm, good attempt :-) Downloader.Zlob_r.AP, Downloader.FraudLoad.N
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
-- Posted on news://freenews.netfront.net - Complaints to news@netfront.net --
------------------------------
Date: Wed, 27 Aug 2008 02:50:00 -0700 (PDT)
From: cmic <cmic@caramail.com>
Subject: Re: Huge perl scripts collection of any kinds for free
Message-Id: <c47982a9-d2c2-4481-a361-e646c5cb46b6@l42g2000hsc.googlegroups.com>
Hi
On 27 ao=FBt, 02:24, Albertos <lfrogerscob...@gmail.com> wrote:
> Hello, I've collected huge perl scripts collection of any kinds : work
> with text files, database, GUI etc. You can download it herehttp://freact=
or.com/get.php?file=3Dperl+scripts
Please stop sending insane spyware in this newgroup. Try alt.sex or
other garbage group
--
cmic, perl user/fan/etc..
------------------------------
Date: Wed, 27 Aug 2008 04:42:25 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Aug 27 2008
Message-Id: <K68t2p.1C5w@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
AudioFile-Info-MP4-Info-0.5
http://search.cpan.org/~simonw/AudioFile-Info-MP4-Info-0.5/
Perl extension to get info from MP4 files.
----
Business-KontoCheck-2.92
http://search.cpan.org/~michel/Business-KontoCheck-2.92/
Perl extension for checking German and Austrian Bank Account Numbers
----
Business-PayPal-NVP-1.02
http://search.cpan.org/~scottw/Business-PayPal-NVP-1.02/
PayPal NVP API
----
CGI.pm-3.41
http://search.cpan.org/~lds/CGI.pm-3.41/
----
Catalyst-Plugin-SmartURI-0.028
http://search.cpan.org/~rkitover/Catalyst-Plugin-SmartURI-0.028/
Configurable URIs for Catalyst
----
CatalystX-CRUD-YUI-0.002
http://search.cpan.org/~karman/CatalystX-CRUD-YUI-0.002/
YUI for your CatalystX::CRUD view
----
CatalystX-ListFramework-Builder-0.29
http://search.cpan.org/~oliver/CatalystX-ListFramework-Builder-0.29/
Instant AJAX web front-end for DBIx::Class, using Catalyst
----
Chart-Clicker-2.01
http://search.cpan.org/~gphat/Chart-Clicker-2.01/
Powerful, extensible charting.
----
Chart-Clicker-2.02
http://search.cpan.org/~gphat/Chart-Clicker-2.02/
Powerful, extensible charting.
----
Chart-Clicker-2.03
http://search.cpan.org/~gphat/Chart-Clicker-2.03/
Powerful, extensible charting.
----
DBIx-Class-InflateColumn-Boolean-0.001000
http://search.cpan.org/~graf/DBIx-Class-InflateColumn-Boolean-0.001000/
Auto-create boolean objects from columns.
----
DBIx-Class-QueryLog-1.1.2
http://search.cpan.org/~gphat/DBIx-Class-QueryLog-1.1.2/
Log queries for later analysis.
----
DBIx-Class-RDBOHelpers-0.04
http://search.cpan.org/~karman/DBIx-Class-RDBOHelpers-0.04/
DBIC compat with Rose::DBx::Object::MoreHelpers
----
DBIx-Class-RDBOHelpers-0.05
http://search.cpan.org/~karman/DBIx-Class-RDBOHelpers-0.05/
DBIC compat with Rose::DBx::Object::MoreHelpers
----
Data-Compare-1.200_500
http://search.cpan.org/~dcantrell/Data-Compare-1.200_500/
compare perl data structures
----
Data-Transform-0.05_01
http://search.cpan.org/~martijn/Data-Transform-0.05_01/
base class for protocol abstractions
----
Data-Visitor-0.19
http://search.cpan.org/~nuffin/Data-Visitor-0.19/
Visitor style traversal of Perl data structures
----
Document-Writer-0.06
http://search.cpan.org/~gphat/Document-Writer-0.06/
Library agnostic document creation
----
Fey-0.11
http://search.cpan.org/~drolsky/Fey-0.11/
Better SQL Generation Through Perl
----
Filter-Crypto-1.22
http://search.cpan.org/~shay/Filter-Crypto-1.22/
Create runnable Perl files encrypted with OpenSSL libcrypto
----
Filter-SQL-0.07
http://search.cpan.org/~kazuho/Filter-SQL-0.07/
embedded SQL for perl
----
Finance-SE-PPM-0.04
http://search.cpan.org/~erwan/Finance-SE-PPM-0.04/
Retrieve a person's account status from the Swedish PPM
----
Geo-Converter-WKT2KML-0.0.1
http://search.cpan.org/~kokogiko/Geo-Converter-WKT2KML-0.0.1/
Simple converter between WKT and KML
----
Geometry-AffineTransform-1.0
http://search.cpan.org/~liyanage/Geometry-AffineTransform-1.0/
Maps 2D coordinates to other 2D coordinates
----
Graphics-Primitive-0.24
http://search.cpan.org/~gphat/Graphics-Primitive-0.24/
Device and library agnostic graphic primitives
----
Graphics-Primitive-0.25
http://search.cpan.org/~gphat/Graphics-Primitive-0.25/
Device and library agnostic graphic primitives
----
Graphics-Primitive-Driver-Cairo-0.14
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.14/
Cairo backend for Graphics::Primitive
----
Hook-Filter-0.10
http://search.cpan.org/~erwan/Hook-Filter-0.10/
A runtime firewall for subroutine calls
----
InSilicoSpectro-Databanks-0.0.43
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.43/
parsing protein/nucleotides sequence databanks (fasta, uniprot...)
----
LIMS-Controller-1.6b
http://search.cpan.org/~cjones/LIMS-Controller-1.6b/
Perl object layer controlling the LIMS database and its web interface
----
LIMS-MT_Plate-1.17
http://search.cpan.org/~cjones/LIMS-MT_Plate-1.17/
A Perl module for creating and manipulating micro-titre plate objects
----
Lingua-Treebank-0.15
http://search.cpan.org/~kahn/Lingua-Treebank-0.15/
Perl extension for manipulating the Penn Treebank format
----
Net-Interface-0.09
http://search.cpan.org/~miker/Net-Interface-0.09/
Perl extension to access network interfaces
----
Net-LibIDN-0.11
http://search.cpan.org/~thor/Net-LibIDN-0.11/
Perl bindings for GNU Libidn
----
Net-SPAMerLookup-0.04
http://search.cpan.org/~lushe/Net-SPAMerLookup-0.04/
Perl module to judge SPAMer.
----
RTx-EmailCompletion-0.04
http://search.cpan.org/~nchuche/RTx-EmailCompletion-0.04/
Add auto completion on RT email fields
----
Rose-DBx-Object-MoreHelpers-0.02
http://search.cpan.org/~karman/Rose-DBx-Object-MoreHelpers-0.02/
more mixin helpers for RDBO
----
Rose-HTMLx-Form-Related-0.05
http://search.cpan.org/~karman/Rose-HTMLx-Form-Related-0.05/
RHTMLO forms, living together
----
SVN-DumpReloc-0.02
http://search.cpan.org/~salva/SVN-DumpReloc-0.02/
Perl script to rewrite paths inside a Subversion dump
----
Shipwright-1.13_14
http://search.cpan.org/~sunnavy/Shipwright-1.13_14/
Best Practical Builder
----
Sjis-0.26
http://search.cpan.org/~ina/Sjis-0.26/
Source code filter for ShiftJIS script
----
String-RewritePrefix-0.001
http://search.cpan.org/~rjbs/String-RewritePrefix-0.001/
rewrite strings based on a set of known prefixes
----
Win32-SharedFileOpen-3.39
http://search.cpan.org/~shay/Win32-SharedFileOpen-3.39/
Open a file for shared reading and/or writing
----
Win32-SystemInfo-0.11
http://search.cpan.org/~cjohnston/Win32-SystemInfo-0.11/
Memory and Processor information on Win32 systems
----
Win32-UTCFileTime-1.50
http://search.cpan.org/~shay/Win32-UTCFileTime-1.50/
Get/set UTC file times with stat/utime on Win32
----
XML-Compile-0.94
http://search.cpan.org/~markov/XML-Compile-0.94/
Compilation based XML processing
----
YAML-DBH-1.02
http://search.cpan.org/~leocharre/YAML-DBH-1.02/
----
Zucchini-0.0.11
http://search.cpan.org/~chisel/Zucchini-0.0.11/
turn templates into static websites
----
resched-0.7.0
http://search.cpan.org/~jonadab/resched-0.7.0/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Wed, 27 Aug 2008 00:15:58 GMT
From: "Rob Hoyer" <robhoyer@alttek.ca>
Subject: Perl Newbie
Message-Id: <211tk.221806$gc5.17817@pd7urf2no>
Hello,
I am using a free script from thesitewizard.com to sendmail a feedback form.
Everything was working great but I need more input fields on the form. The
HTML was no problem but I busted the script. (please see below my
modifications)
I am not sure how to define variable or even if you need to.
Thanks,
Rob Hoyer
robhoyer@alttek.ca
first modification:
my $user = $form{"user"} ;
if (($user eq "") || ($user =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
my $phone = $form{"phone"} ;
if (($phone eq "") || ($phone =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
second modification:
"------------------------------------------------------------\n" .
"Name of Company: " . $name . "\n"
"Name of Contact: " . $user . "\n"
"Phone Number: " . $phone . "\n" .
"Email of sender: " . $email . "\n" .
**************************************************************
Whole Script:
**************************************************************
#!/usr/local/bin/perl
##!/usr/bin/perl
# chfeedback.pl Feedback Form Perl Script Ver 2.2.3
# Generated by thesitewizard.com's Feedback Form Wizard.
# Copyright 2000-2008 by Christopher Heng. All rights reserved.
#
# thesitewizard and thefreecountry are trademarks of Christopher Heng.
#
# Get the latest version, free, from:
# http://www.thesitewizard.com/wizards/feedbackform.shtml
#
# You can read the Frequently Asked Questions (FAQ) at:
# http://www.thesitewizard.com/wizards/faq.shtml
#
# I can be contacted at:
# http://www.thesitewizard.com/feedback.php
# Note that I do not normally respond to questions that have
# already been answered in the FAQ, so *please* read the FAQ.
#
#
# LICENCE TERMS
#
# 1. You may use this script on your website, with or
# without modifications, free of charge.
#
# 2. You may NOT distribute or republish this script, whether
# modified or not. The script can only be distributed by the author,
# Christopher Heng.
#
# 3. THE SCRIPT AND ITS DOCUMENTATION ARE PROVIDED
# "AS IS", WITHOUT WARRANTY OF ANY KIND, NOT EVEN THE
# IMPLIED WARRANTY OF MECHANTABILITY OR FITNESS FOR A
# PARTICULAR PURPOSE. YOU AGREE TO BEAR ALL RISKS AND
# LIABILITIES ARISING FROM THE USE OF THE SCRIPT,
# ITS DOCUMENTATION AND THE INFORMATION PROVIDED BY THE
# SCRIPTS AND THE DOCUMENTATION.
#
# If you cannot agree to any of the above conditions, you
# may not use the script.
#
# Although it is NOT required, I would be most grateful
# if you could also link to thesitewizard.com at:
#
# http://www.thesitewizard.com/
#
# ---------- USER CONFIGURATION SECTION ---------------
# Before this script will do anything useful, the following
# variables must be set.
#
# MANDATORY VARIABLES
# $mailprog - the location of your mail program and the parameters
# to pass to it.
# eg $mailprog = "/usr/lib/sendmail" ;
# $mailto - email address where the feedback will be sent
# eg, $mailto = 'yourname@example.com' ;
# $subject - the subject line in the email sent by the feedback form
# eg $subject = "Feedback Form" ;
#
# $formurl - the URL of your feedback form
# eg $formurl = "http://www.example.com/feedback.html" ;
# $thankyouurl - the URL of your thank you page
# eg $thankyouurl = "http://www.example.com/thanks.html" ;
# $errorurl - the URL of your error page
# eg $errorurl = "http://www.example.com/error.html" ;
$mailprog = "/usr/lib/sendmail" ;
$mailto = 'support@alttek.ca' ;
$subject = "Web Support Request" ;
$formurl = "http://www.alttek.ca/support.html" ;
$errorurl = "http://www.alttek.ca/error.html" ;
$thankyouurl = "http://www.alttek.ca/thankyou.html" ;
# ---------- END OF USER CONFIGURATION SECTION ------------
# ---------- functions -----------
sub redirect_url {
my ( $url ) = shift ;
print "Location: $url\n\n" ;
}
sub parse_form_data {
my ($request_method, $input_string, $content_length) ;
my (@vars, $indiv_var, $name, $value);
my (%form) ;
$request_method = $ENV{'REQUEST_METHOD'} ;
$content_length = $ENV{'CONTENT_LENGTH'} ;
# load the entire string into $input_string
if ($request_method =~ /post/i) {
$input_string = "" ;
read( STDIN, $input_string, $content_length ) ;
}
else {
$input_string = $ENV{ 'QUERY_STRING' };
}
unless (defined $input_string) {
$input_string = "" ;
}
# put all the variable pairs (name=value) into an array
@vars = split( /&/, $input_string );
# process each individual name, value pair, putting them
# into a hash for easy access
foreach $indiv_var ( @vars ) {
# separate the pair
($name, $value) = split( /=/, $indiv_var, 2 );
# translate encoding
$name =~ s/%([\da-fA-F]{2})/pack("C", hex($1))/eg;
$name =~ tr/+/ /;
unless (defined $value) {
# just in case there was no equals as in ISINDEX
$value = "" ;
}
$value =~ s/%([\da-fA-F]{2})/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
# put the pair in the hash for easy access
$form{$name} = $value ;
}
return wantarray ? %form : undef ;
}
sub send_email {
my ($mailprog, $email, $name, $mailto, $subject, $message) = @_ ;
if (open MAIL, "|$mailprog -t") {
print MAIL "To: $mailto\n" ;
print MAIL "From: \"$name\" <$email>\n" ;
print MAIL "Reply-To: \"$name\" <$email>\n" ;
print MAIL "X-Mailer: chfeedback.pl 2.2.3\n" ;
print MAIL "Subject: $subject\n\n" ;
print MAIL $message ;
close MAIL ;
}
# ignore fails, just don't do anything
return ;
}
# ----------- main program ------
my %form = parse_form_data();
my $email ;
if (exists $form{"email"}) {
$email = $form{"email"} ;
}
else {
redirect_url( $formurl );
exit ;
}
if (($email eq "") || ($email =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
my $name = $form{"name"} ;
if (($name eq "") || ($name =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
my $user = $form{"user"} ;
if (($user eq "") || ($user =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
my $phone = $form{"phone"} ;
if (($phone eq "") || ($phone =~ /[\r\n]/)) {
redirect_url( $errorurl );
exit ;
}
my $comments = $form{'comments'} ;
if ($comments eq "") {
redirect_url( $errorurl );
exit ;
}
my $http_referer = $ENV{ 'HTTP_REFERER' };
my $message =
"This message was sent from:\n" .
"$http_referer\n" .
"------------------------------------------------------------\n" .
"Name of Company: " . $name . "\n"
"Name of Contact: " . $user . "\n"
"Phone Number: " . $phone . "\n" .
"Email of sender: " . $email . "\n" .
"------------------------- COMMENTS -------------------------\n\n" .
$comments .
"\n\n------------------------------------------------------------\n" ;
send_email ( $mailprog, $email, $name, $mailto, $subject, $message );
redirect_url( $thankyouurl );
------------------------------
Date: Tue, 26 Aug 2008 19:49:08 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Perl Newbie
Message-Id: <slrngb9944.s6s.tadmc@tadmc30.sbcglobal.net>
Rob Hoyer <robhoyer@alttek.ca> wrote:
> Subject: Perl Newbie
Please put the subject of your article in the Subject of your article.
Your article is not about you, so you should not say that is
is about you.
> I am using a free script
It is worth less than what you paid for it.
> from thesitewizard.com to sendmail a feedback form.
>
> Everything was working great but I need more input fields on the form.
What happened when you contacted the author for support?
> # I can be contacted at:
> # http://www.thesitewizard.com/feedback.php
Did you contact the author there as suggested?
> # LICENCE TERMS
> # 2. You may NOT distribute or republish this script, whether
> # modified or not. The script can only be distributed by the author,
> # Christopher Heng.
Violating law in a public place is not a good idea.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Wed, 27 Aug 2008 00:53:45 -0700 (PDT)
From: Arun <sajapuram.arun.prakash@gmail.com>
Subject: Repeating the loop
Message-Id: <0d9dcf80-84cd-4cda-ae5d-b414794bdcee@z11g2000prl.googlegroups.com>
Hi,
i am new to perl so i uat wanted some help.
i wanted the followinf loop to be repeated for every 30 seconds.
$send_data = strftime( "::DATA::123456789101112,%d.%m.%Y,%H:%M:%S,
13.0076367,77.5489267,0,933.4,AirTel,31,0 \n", gmtime);
DATA: {while(1)
{
$handle-> send($send_data);
last DATA;
}
}
so how do i do it.
------------------------------
Date: Wed, 27 Aug 2008 01:50:25 -0700 (PDT)
From: qa4ever@gmail.com
Subject: Re: Soap:lite with msdl file crash perl.exe v5.6.1
Message-Id: <328ea757-c62f-4af8-a67f-2af40ffac679@k30g2000hse.googlegroups.com>
On 26 Aug, 19:09, smallpond <smallp...@juno.com> wrote:
> qa4e...@gmail.com wrote:
> > Dear Soap / Perl gurus!
>
> > I'm using Windows Server 2k3 SP1 and Perl v5.6.1
>
> > I see perl.exe crash before I see "connected" text, why?
>
> > The wsdl file describe the soap interface that is found athttp://machin=
ename:2222.
> > (The wsdl file is not found/hosted at the http address, does it need
> > to?, but instead is found on local disk)
>
> > #!perl -w
> > use SOAP::Lite +trace =3D> qw(debug);
>
> > my $soap =3D =A0SOAP::Lite
> > =A0 =A0-> service('file://C:/Code/wsdl/webservice.x.y.1.1.wsdl')
> > =A0 =A0-> proxy('http://machinename:2222');
> > <<<< crash in perl.exe
> > print ">connected";
>
> You go through a proxy to get to your local hard drive?
>
> --S
> ** Posted fromhttp://www.teranews.com**
Thank you for your comment smallpond.
The wsdl file is stored on local disk with the client, separated from
the soap service on the remote machine. There were no implementation
requirement to expose the wsdl file over the Internet. Tests with .Net
client can use this soap interface without problem. Response size is
1-2 k byte of data. (there is no chance wsdl method def. will be put
where soap service is)
I ponder, Perl might crash because method is returning too much data
in one chunk? For example, in .Net a soap buffer-size constant needs
to be increased from default (but I recall its about 64kb by default),
to avoid exceptions.
Is there a method to only download chunks of data using soap:lite or
other method?
Also I would appreciate very much if somebody could post working code
where wsdl (file://) and soap service (http://) is NOT found at same
place, i.e. they are separated. Preferably code that calls any public
Internet soap service.
Thank you,
QA4Ever
------------------------------
Date: Wed, 27 Aug 2008 10:41:30 +0200
From: Matthieu Imbert <breafk@remove.this.gmail.com>
Subject: subprocesses lifecycle
Message-Id: <48b5133a$0$19705$426a74cc@news.free.fr>
hi.
I have a perl script that forks several subprocesses at various times.
I use the open "process_name |" syntax, and then use select to read
multiple process outputs, and have a timeout on all these subprocesses.
If the timeout is reached, I want to immediately exit my script with an
error message.
Currently, when I detect the timeout, I call die "error message". the
message is displayed, but the script does not return until subprocesses
finish (this may take several minutes, depending on what the
subprocesses do).
Is there a way to force the end of all subprocesses when calling die?
best regards,
Matthieu
------------------------------
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 V11 Issue 1822
***************************************