[31223] in Perl-Users-Digest
Perl-Users Digest, Issue: 2468 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 10 06:09:48 2009
Date: Wed, 10 Jun 2009 03:09:11 -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, 10 Jun 2009 Volume: 11 Number: 2468
Today's topics:
Re: Counting the total number of keys in a hash of hash <brian.d.foy@gmail.com>
Re: FAQ 2.2 How can I get a binary version of perl? <brian.d.foy@gmail.com>
Re: FAQ 4.59 How can I know how many entries are in a h <brian.d.foy@gmail.com>
new CPAN modules on Wed Jun 10 2009 (Randal Schwartz)
Re: perl and CGI <FiNaR76@gmail.com>
Re: perl and CGI <RedGrittyBrick@spamweary.invalid>
Re: perl and CGI <FiNaR76@gmail.com>
sendmail doesn't work, but no error on the screen... <FiNaR76@gmail.com>
Re: sendmail doesn't work, but no error on the screen.. <RedGrittyBrick@spamweary.invalid>
Re: sendmail doesn't work, but no error on the screen.. <Andrzej.Filip@gmail.com>
Re: sendmail doesn't work, but no error on the screen.. <FiNaR76@gmail.com>
Re: Strawberry and Vanilla Perl <sisyphus359@gmail.com>
Re: understanding \Q \E <tadmc@seesig.invalid>
Re: understanding \Q \E <jurgenex@hotmail.com>
Re: What happened to perl doc <brian.d.foy@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Jun 2009 04:07:51 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: Counting the total number of keys in a hash of hashes
Message-Id: <100620090407516935%brian.d.foy@gmail.com>
In article
<05ae3a52-0f59-412e-8ee8-9a435e43d50a@i6g2000yqj.googlegroups.com>,
Mahurshi Akilla <mahurshi@gmail.com> wrote:
> Is there an easy way to count the # of keys in a hash of hashes?
You might want to see "Traversing a multi-dimensional hash in Perl" on
Stackoverflow:
http://stackoverflow.com/questions/160175/traversing-a-multi-dimensional-
hash-in-perl
------------------------------
Date: Wed, 10 Jun 2009 03:25:23 -0500
From: brian d foy <brian.d.foy@gmail.com>
To: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: FAQ 2.2 How can I get a binary version of perl?
Message-Id: <100620090325234081%brian.d.foy@gmail.com>
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <050620091256276990%jimsgibson@gmail.com>, Jim Gibson
<jimsgibson@gmail.com> wrote:
> In article <5o6of6-q39.ln1@blue.stonehenge.com>, PerlFAQ Server
> <brian@stonehenge.com> wrote:
> > 2.2: How can I get a binary version of perl?
> What about IndigoPerl for Windows? I haven't used it, but some people
> here recommend it.
I added it recently, but it didn't make it in for this cycle.
Thanks,
------------------------------
Date: Wed, 10 Jun 2009 03:30:28 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 4.59 How can I know how many entries are in a hash?
Message-Id: <100620090330282359%brian.d.foy@gmail.com>
In article <slrnh2o5lh.28vp.willem@snail.stack.nl>, Willem
<willem@snail.stack.nl> wrote:
> jidanni@jidanni.org wrote:
> ) PerlFAQ Server <brian@stonehenge.com> writes:
> )> 4.59: How can I know how many entries are in a hash?
f you mean ALL the entries, even recursively, then try e.g.,
> )
> ) use Data::Walk; #from CPAN
> ) my $count = 0;
> ) walkdepth( sub {$count++;}, %HoH );
> ) print "count=$count\n";
>
> There's nothing F about the A-ing of that Q.
As I noted to jidanni in private email, the code doesn't even work.
The Data::Walk module doesn't have any way to tell you how many
keys it saw. It would take a lot of surgery to give it that capability.
I gave up on it after about half an hour.
Too bad too, because that would have been a nice feature.
------------------------------
Date: Wed, 10 Jun 2009 04:42:28 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jun 10 2009
Message-Id: <KL0AEt.14M@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.
App-Munchies-0.2.750
http://search.cpan.org/~pjfl/App-Munchies-0.2.750/
Catalyst example application using food recipes as a data set
----
Bot-BasicBot-Pluggable-Module-Log-0.07
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-Module-Log-0.07/
Provide logging for Bot::BasicBot::Pluggable
----
Bundle-Thread-1.11
http://search.cpan.org/~jdhedden/Bundle-Thread-1.11/
A bundle of modules for supporting threads in Perl
----
CPANPLUS-Dist-Arch-0.11
http://search.cpan.org/~juster/CPANPLUS-Dist-Arch-0.11/
CPANPLUS backend for building Archlinux pacman packages
----
CPANPLUS-YACSmoke-0.36
http://search.cpan.org/~bingos/CPANPLUS-YACSmoke-0.36/
Yet Another CPANPLUS Smoke Tester
----
CPANPLUS-YACSmoke-0.38
http://search.cpan.org/~bingos/CPANPLUS-YACSmoke-0.38/
Yet Another CPANPLUS Smoke Tester
----
Catalyst-Controller-SOAP-1.19
http://search.cpan.org/~druoso/Catalyst-Controller-SOAP-1.19/
Catalyst SOAP Controller
----
CatalystX-DynamicComponent-0.000000_01
http://search.cpan.org/~bobtfish/CatalystX-DynamicComponent-0.000000_01/
Parameterised Moose role providing functionality to build Catalyst components at runtime.
----
CatalystX-Usul-0.2.571
http://search.cpan.org/~pjfl/CatalystX-Usul-0.2.571/
A base class for Catalyst MVC components
----
DBD-CSV-0.24_01
http://search.cpan.org/~hmbrand/DBD-CSV-0.24_01/
DBI driver for CSV files
----
Data-Dumper-2.122
http://search.cpan.org/~smueller/Data-Dumper-2.122/
stringified perl data structures, suitable for both printing and eval
----
DateTime-Event-Cron-Quartz-0.01
http://search.cpan.org/~vad/DateTime-Event-Cron-Quartz-0.01/
OpensSymphony Quartz cron expression processor
----
DateTime-Event-Cron-Quartz-0.02
http://search.cpan.org/~vad/DateTime-Event-Cron-Quartz-0.02/
OpensSymphony Quartz cron expression processor
----
Digest-1.16
http://search.cpan.org/~gaas/Digest-1.16/
Modules that calculate message digests
----
Digest-MD5-2.39
http://search.cpan.org/~gaas/Digest-MD5-2.39/
Perl interface to the MD5 Algorithm
----
Dist-Zilla-1.091610
http://search.cpan.org/~rjbs/Dist-Zilla-1.091610/
distribution builder; installer not included!
----
Email-Send-2.196
http://search.cpan.org/~rjbs/Email-Send-2.196/
Simply Sending Email
----
Event-Lite-0.001
http://search.cpan.org/~johnd/Event-Lite-0.001/
Distributed Event Broadcast System for Perl
----
File-Glob-Slurp-0.01
http://search.cpan.org/~dankogai/File-Glob-Slurp-0.01/
The great new File::Glob::Slurp!
----
File-Map-0.15
http://search.cpan.org/~leont/File-Map-0.15/
Memory mapping made simple and safe.
----
Filter-1.37
http://search.cpan.org/~pmqs/Filter-1.37/
----
FindBin-libs-1.38
http://search.cpan.org/~lembark/FindBin-libs-1.38/
Locate and 'use lib' directories along the path of $FindBin::Bin to automate locating modules. Uses File::Spec and Cwd's abs_path to accomodate multiple O/S and redundant symlinks.
----
GD-Sparkline-0.03
http://search.cpan.org/~rpettett/GD-Sparkline-0.03/
----
GD-Sparkline-0.04
http://search.cpan.org/~rpettett/GD-Sparkline-0.04/
----
HTTP-Proxy-Selective-0.001
http://search.cpan.org/~bobtfish/HTTP-Proxy-Selective-0.001/
Simple HTTP Proxy which serves some paths from locations on local disk.
----
IO-Pty-HalfDuplex-0.01
http://search.cpan.org/~sorear/IO-Pty-HalfDuplex-0.01/
Treat interactive programs like subroutines
----
IO-Vec-0.03
http://search.cpan.org/~leont/IO-Vec-0.03/
writev and readv in perl
----
Jifty-Plugin-Authentication-CAS-0.10
http://search.cpan.org/~yvesago/Jifty-Plugin-Authentication-CAS-0.10/
JA-SIG CAS authentication plugin for Jifty
----
Jifty-Plugin-Authentication-Facebook-0.9
http://search.cpan.org/~yvesago/Jifty-Plugin-Authentication-Facebook-0.9/
Facebook authentication plugin for Jifty
----
Jifty-Plugin-Authentication-Ldap-0.10
http://search.cpan.org/~yvesago/Jifty-Plugin-Authentication-Ldap-0.10/
LDAP Authentication Plugin for Jifty
----
Jifty-Plugin-OpenID-0.10
http://search.cpan.org/~yvesago/Jifty-Plugin-OpenID-0.10/
Provides OpenID authentication for your jifty app
----
Jifty-Plugin-SiteNews-0.9
http://search.cpan.org/~yvesago/Jifty-Plugin-SiteNews-0.9/
Provide site news in your app
----
Jifty-Plugin-Userpic-0.9
http://search.cpan.org/~yvesago/Jifty-Plugin-Userpic-0.9/
Provides user pictures for Jifty
----
Lingua-Concordance-0.01
http://search.cpan.org/~emorgan/Lingua-Concordance-0.01/
Keyword-in-context (KWIC) search interface
----
Locale-Maketext-Utils-0.17
http://search.cpan.org/~dmuey/Locale-Maketext-Utils-0.17/
Adds some utility functionality and failure handling to Local::Maketext handles
----
MIME-Base64-3.08
http://search.cpan.org/~gaas/MIME-Base64-3.08/
Encoding and decoding of base64 strings
----
Math-GMPf-0.28
http://search.cpan.org/~sisyphus/Math-GMPf-0.28/
perl interface to the GMP library's floating point (mpf) functions.
----
Math-GMPq-0.28
http://search.cpan.org/~sisyphus/Math-GMPq-0.28/
perl interface to the GMP library's rational (mpq) functions.
----
Math-GMPz-0.28
http://search.cpan.org/~sisyphus/Math-GMPz-0.28/
perl interface to the GMP library's integer (mpz) functions.
----
MooseX-StrictAttributes-0.0001
http://search.cpan.org/~bobtfish/MooseX-StrictAttributes-0.0001/
A collection of Attribute and Class traits to turn on various 'strict' features of attributes.
----
MooseX-Traits-Pluggable-0.04
http://search.cpan.org/~rkitover/MooseX-Traits-Pluggable-0.04/
an extension to MooseX::Traits
----
Nagios-Plugin-WWW-Mechanize-0.12
http://search.cpan.org/~tonvoon/Nagios-Plugin-WWW-Mechanize-0.12/
Login to a web page as a user and get data as a Nagios plugin
----
NetAddr-IP-4.027
http://search.cpan.org/~miker/NetAddr-IP-4.027/
Manages IPv4 and IPv6 addresses and subnets
----
PDF-Report-1.32
http://search.cpan.org/~aorr/PDF-Report-1.32/
A wrapper written for PDF::API2
----
Parallel-Depend-4.07
http://search.cpan.org/~lembark/Parallel-Depend-4.07/
: Parallel-dependent dispatch of perl or shell code.
----
Pod-Inherit-0.01
http://search.cpan.org/~jmastros/Pod-Inherit-0.01/
auto-create pod sections listing inherited methods
----
Pod-Inherit-0.02
http://search.cpan.org/~jmastros/Pod-Inherit-0.02/
auto-create pod sections listing inherited methods
----
SQL-Translator-0.09005_05
http://search.cpan.org/~jrobinson/SQL-Translator-0.09005_05/
manipulate structured data definitions (SQL and more)
----
StoredHash-0.029
http://search.cpan.org/~ohollmen/StoredHash-0.029/
Minimalistic, yet fairly complete DBI Persister
----
Sub-Pipe-0.03
http://search.cpan.org/~fujiwara/Sub-Pipe-0.03/
chain subs with | (pipe)
----
Task-Padre-Plugins-0.22
http://search.cpan.org/~fayland/Task-Padre-Plugins-0.22/
Get many Plugins of Padre at once
----
Template-Declare-Bricolage-0.01
http://search.cpan.org/~dwheeler/Template-Declare-Bricolage-0.01/
Perlish XML Generation for Bricolage's SOAP API
----
Text-ASCIIMathML-0.8
http://search.cpan.org/~nodine/Text-ASCIIMathML-0.8/
Perl extension for parsing ASCIIMathML text into MathML
----
Text-MultiMarkdown-1.0.25
http://search.cpan.org/~bobtfish/Text-MultiMarkdown-1.0.25/
Convert MultiMarkdown syntax to (X)HTML
----
Versionify-Dispatch-0.0.3
http://search.cpan.org/~cebjyre/Versionify-Dispatch-0.0.3/
A function dispatcher that respects versions, with fallback.
----
Win32-Lglcd-0.03-dist
http://search.cpan.org/~xlat/Win32-Lglcd-0.03-dist/
Perl extension for writting perl's app for logitech devices.
----
threads-1.73
http://search.cpan.org/~jdhedden/threads-1.73/
Perl interpreter-based threads
----
xcruciate-018
http://search.cpan.org/~melonman/xcruciate-018/
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: Tue, 9 Jun 2009 23:50:03 -0700 (PDT)
From: Vit <FiNaR76@gmail.com>
Subject: Re: perl and CGI
Message-Id: <d8f1fd4c-5bf5-443c-893f-f303ec49c171@o36g2000vbi.googlegroups.com>
On 10 Giu, 08:22, "Guy" <some...@somewhere.nb.ca> wrote:
> "Vit" <FiNa...@gmail.com> wrote:
>
> Hi All,
>
> I'm new to the perl language....
>
> I'm trying to understand how this language work and I hav develop the
> following code:
>
> in the webpage:
> <form action=3D"\cgi-bin\my_email.cgi" method=3D"post">
> <input type=3D"submit" name=3D"Submit" =A0value=3D"Submit" style=3D"width=
:
> 93px" />
>
> in the cgi-bin directori the "my_email.cgi" file:
> #!/usr/bin/perl
> print "Content-type: text/html\n\n";
> print "Hello, world!\n";
>
> I'm using this file just to test.... and the result is that is not
> working....
>
> when I click to the "submit" button, I get the following message:
>
> Server error!
> The server encountered an internal error and was unable to complete
> your request.
>
> Error message:
> Premature end of script headers: my_email.cgi
>
> If you think this is a server error, please contact the webmaster.
>
> Error 500
> Tue Jun 9 14:11:00 2009
> Apache/2.0.55 (Ubuntu) mod_ldap_userdir/1.1.11 PHP/4.4.2-1.1
> mod_vhost_ldap/1.0.0
>
> what can I do?? do you know what can I cahe to find out the issue???
>
> thanks
>
> Vit
>
> -----------------------------
> Did you solve your problem?
>
> 1. Make sure you upload your Perl script to the correct folder on your we=
b
> server, which I think would be something like /cgi-bin. Otherwise you may
> get a 404 error, saying it can't find the file.
>
> 2. Once on the server, ensure that you change the file's properties to
> executable, otherwise, I think you'll get error 403, something about
> refusing to display web page.
>
> 3. I get the 500 Internal Server Error when I have an error in my code. T=
he
> following script for example works fine:
> =A0 =A0 #!/usr/bin/perl
> =A0 =A0 $command=3D $];
> =A0 =A0 $title =3D "Perl Version";
> =A0 =A0 print "Content-type: text/html\n\n";
> =A0 =A0 print "<html><head><title>$title</title></head><body>";
> =A0 =A0 print "<h1>$title</h1>\n";
> =A0 =A0 print "Perl version : ".$command;
> =A0 =A0 print "<HR> \n";
> =A0 =A0 system 'perl -v';
>
> It displays the following -- yes I know it would be great if I had Perl 1=
0
> :(
>
> Perl Version
> Perl version : 5.006001
> -----------------------
> This is perl, v5.6.1 built for i686-linux Copyright 1987-2001, 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 k=
it.
> 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 athttp://www.perl.com/, the Perl Home Page.
>
> If however, I forget a semi colon like:
> =A0 =A0 #!/usr/bin/perl
> =A0 =A0 $command=3D $] # <--- Forgot Semicolon
> =A0 =A0 $title =3D "Perl Version";
> =A0 =A0 print "Content-type: text/html\n\n";
> =A0 =A0 print "<html><head><title>$title</title></head><body>";
> =A0 =A0 print "<h1>$title</h1>\n";
> =A0 =A0 print "Perl version : ".$command;
> =A0 =A0 print "<HR> \n";
> =A0 =A0 system 'perl -v';
>
> I get the following:
> 500 Internal Server Error
> The server encountered an internal error or misconfiguration and was unab=
le
> to complete your request.
> Please contact the server administrator, or webmaster and inform them of =
the
> time the error occurred, and anything you might have done that may have
> caused the error.
> More information about this error may be available in the server error lo=
g.
>
> 4. You can also access your perl scripts directly instead of submitting a
> form, for example, type the following in your address bar, and also use
> /cgi-bin/my_email.cgi instead of \cgi-bin\my_email.cgi like Sinan said.
> =A0 =A0http://yourserver/cgi-bin/my_email.cgi
>
> 5. On a side note, I use the .pl extension instead of .cgi, but I may be =
a
> minority? I think I even read that it was better to not use any extension
> claiming that people don't have to know that the script is Perl or whatev=
er?
>
> 6. Your print code looks ok, so perhaps the trouble is in your (pound ban=
g)
> line? Like you, mine is:
> =A0 =A0 #!/usr/bin/perl
> But perhaps you require it like this: (user) instead of (usr)???
> =A0 =A0 #!/user/bin/perl
>
> 7. Are you sure your system supports Perl? If so, check if there are some
> default Perl scripts in the /cgi-bin folder and check if they work, and i=
f
> they do, start with them.
>
> Finally, I'm quite new to this group and Perl so I expect to be corrected
> here!
>
> PS. I recently learned that instead of uploading my scripts to test them,=
I
> could install Strawberry Perl on my Windows XP and test my scripts locall=
y.
> I upload them to the server only once the bugs are out.
>
> Cheers,
> Guy D.
Thanks for the answer!!! really appreciate!!!
I have solve the issue!!! was the permission on the .pl file (I set
utp the permission on the falder, but not on the file...
now I'm trying to debug my file.... it works (no error in the
browser!!!), but it is not doing what I'd like to...
#!/usr/bin/perl
&send_email;
sub send_email
{
$to =3D "vit\@domain.com";
open(MAIL, "|/usr/sbin/sendmail");
print MAIL "From: bob\@domain.com\n";
print MAIL "To: $to\n";
print MAIL "Subject: Web Enqiry\n\n";
close (MAIL);
}
print "Content-type: text/html\n\n";
print "Hello World2"
it doesn't give me an error, but I dont receive any mail....
any suggestion???
thanks
Vit
------------------------------
Date: Wed, 10 Jun 2009 10:27:52 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: perl and CGI
Message-Id: <4a2f7c9c$0$18254$da0feed9@news.zen.co.uk>
Vit wrote:
> On 10 Giu, 08:22, "Guy" <some...@somewhere.nb.ca> wrote:
>> "Vit" <FiNa...@gmail.com> wrote:
>>
>> Hi All,
>>
>> I'm new to the perl language....
>>
>> I'm trying to understand how this language work and I hav develop the
>> following code:
>>
>> in the webpage:
>> <form action="\cgi-bin\my_email.cgi" method="post">
>> <input type="submit" name="Submit" value="Submit" style="width:
>> 93px" />
>>
>> in the cgi-bin directori the "my_email.cgi" file:
>> #!/usr/bin/perl
>> print "Content-type: text/html\n\n";
>> print "Hello, world!\n";
>>
>> I'm using this file just to test.... and the result is that is not
>> working....
>>
>> when I click to the "submit" button, I get the following message:
>>
>> Server error!
>> The server encountered an internal error and was unable to complete
>> your request.
>>
>> Error message:
>> Premature end of script headers: my_email.cgi
>>
>> If you think this is a server error, please contact the webmaster.
>>
>> Error 500
>> Tue Jun 9 14:11:00 2009
>> Apache/2.0.55 (Ubuntu) mod_ldap_userdir/1.1.11 PHP/4.4.2-1.1
>> mod_vhost_ldap/1.0.0
>>
>> what can I do?? do you know what can I cahe to find out the issue???
>>
>> thanks
>>
>> Vit
>>
>> -----------------------------
>> Did you solve your problem?
>>
>> 1. Make sure you upload your Perl script to the correct folder on your web
>> server, which I think would be something like /cgi-bin. Otherwise you may
>> get a 404 error, saying it can't find the file.
>>
>> 2. Once on the server, ensure that you change the file's properties to
>> executable, otherwise, I think you'll get error 403, something about
>> refusing to display web page.
>>
>> 3. I get the 500 Internal Server Error when I have an error in my code. The
>> following script for example works fine:
>> #!/usr/bin/perl
>> $command= $];
>> $title = "Perl Version";
>> print "Content-type: text/html\n\n";
>> print "<html><head><title>$title</title></head><body>";
>> print "<h1>$title</h1>\n";
>> print "Perl version : ".$command;
>> print "<HR> \n";
>> system 'perl -v';
>>
>> It displays the following -- yes I know it would be great if I had Perl 10
>> :(
>>
>> Perl Version
>> Perl version : 5.006001
>> -----------------------
>> This is perl, v5.6.1 built for i686-linux Copyright 1987-2001, 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 athttp://www.perl.com/, the Perl Home Page.
>>
>> If however, I forget a semi colon like:
>> #!/usr/bin/perl
>> $command= $] # <--- Forgot Semicolon
>> $title = "Perl Version";
>> print "Content-type: text/html\n\n";
>> print "<html><head><title>$title</title></head><body>";
>> print "<h1>$title</h1>\n";
>> print "Perl version : ".$command;
>> print "<HR> \n";
>> system 'perl -v';
>>
>> I get the following:
>> 500 Internal Server Error
>> The server encountered an internal error or misconfiguration and was unable
>> to complete your request.
>> Please contact the server administrator, or webmaster and inform them of the
>> time the error occurred, and anything you might have done that may have
>> caused the error.
>> More information about this error may be available in the server error log.
>>
>> 4. You can also access your perl scripts directly instead of submitting a
>> form, for example, type the following in your address bar, and also use
>> /cgi-bin/my_email.cgi instead of \cgi-bin\my_email.cgi like Sinan said.
>> http://yourserver/cgi-bin/my_email.cgi
>>
>> 5. On a side note, I use the .pl extension instead of .cgi, but I may be a
>> minority? I think I even read that it was better to not use any extension
>> claiming that people don't have to know that the script is Perl or whatever?
>>
>> 6. Your print code looks ok, so perhaps the trouble is in your (pound bang)
>> line? Like you, mine is:
>> #!/usr/bin/perl
>> But perhaps you require it like this: (user) instead of (usr)???
>> #!/user/bin/perl
>>
>> 7. Are you sure your system supports Perl? If so, check if there are some
>> default Perl scripts in the /cgi-bin folder and check if they work, and if
>> they do, start with them.
>>
>> Finally, I'm quite new to this group and Perl so I expect to be corrected
>> here!
>>
>> PS. I recently learned that instead of uploading my scripts to test them, I
>> could install Strawberry Perl on my Windows XP and test my scripts locally.
>> I upload them to the server only once the bugs are out.
>>
>> Cheers,
>> Guy D.
>
> Thanks for the answer!!! really appreciate!!!
>
> I have solve the issue!!! was the permission on the .pl file (I set
> utp the permission on the falder, but not on the file...
>
> now I'm trying to debug my file.... it works (no error in the
> browser!!!), but it is not doing what I'd like to...
>
> #!/usr/bin/perl
use strict;
use warnings;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
>
> &send_email;
send_email();
>
> sub send_email
> {
> $to = "vit\@domain.com";
> open(MAIL, "|/usr/sbin/sendmail");
Always check for success/failure when opening a file handle.
Use lexical file-handles and the three-argument open.
(assuming your ancient perl supports them)
>
> print MAIL "From: bob\@domain.com\n";
> print MAIL "To: $to\n";
> print MAIL "Subject: Web Enqiry\n\n";
Aren't you supposed to provide a message body terminated by a full-stop
on a line by itself?
>
> close (MAIL);
I imagine sendmail was waiting for a message body?
> }
>
> print "Content-type: text/html\n\n";
Don't promise HTML if you are not willing to keep your promise.
> print "Hello World2"
That isn't HTML.
>
> it doesn't give me an error,
Ask perl to tell you of any errors! (see comment above).
Make sure errors are written somewhere you are looking.
See above `use CGI::Carp qw(fatalsToBrowser);`
Back in the days of Perl 4 I used
BEGIN {
open(STDERR ,'>&STDOUT')
|| die "Can't redir stderr to out: $!\n";
$| = 1; # Make it unbuffered
print "Content-type: text/html\n\n";
}
This is more in keeping with your rather quaint and archaic coding style
but I can't imagine your Perl installation could be so backward as to
lack a better way to redirect errors to the browser.
> but I dont receive any mail....
Ask Perl to tell you why.
>
> any suggestion???
See above.
I'd make more use of modules for CGI and for email.
>
> thanks
>
> Vit
--
RGB
------------------------------
Date: Wed, 10 Jun 2009 02:59:05 -0700 (PDT)
From: Vit <FiNaR76@gmail.com>
Subject: Re: perl and CGI
Message-Id: <263e91f4-b110-4fa0-a3bf-e71787b1f07f@c19g2000yqc.googlegroups.com>
On 10 Giu, 17:27, RedGrittyBrick <RedGrittyBr...@spamweary.invalid>
wrote:
> Vit wrote:
> > On 10 Giu, 08:22, "Guy" <some...@somewhere.nb.ca> wrote:
> >> "Vit" <FiNa...@gmail.com> wrote:
>
> >> Hi All,
>
> >> I'm new to the perl language....
>
> >> I'm trying to understand how this language work and I hav develop the
> >> following code:
>
> >> in the webpage:
> >> <form action=3D"\cgi-bin\my_email.cgi" method=3D"post">
> >> <input type=3D"submit" name=3D"Submit" =A0value=3D"Submit" style=3D"wi=
dth:
> >> 93px" />
>
> >> in the cgi-bin directori the "my_email.cgi" file:
> >> #!/usr/bin/perl
> >> print "Content-type: text/html\n\n";
> >> print "Hello, world!\n";
>
> >> I'm using this file just to test.... and the result is that is not
> >> working....
>
> >> when I click to the "submit" button, I get the following message:
>
> >> Server error!
> >> The server encountered an internal error and was unable to complete
> >> your request.
>
> >> Error message:
> >> Premature end of script headers: my_email.cgi
>
> >> If you think this is a server error, please contact the webmaster.
>
> >> Error 500
> >> Tue Jun 9 14:11:00 2009
> >> Apache/2.0.55 (Ubuntu) mod_ldap_userdir/1.1.11 PHP/4.4.2-1.1
> >> mod_vhost_ldap/1.0.0
>
> >> what can I do?? do you know what can I cahe to find out the issue???
>
> >> thanks
>
> >> Vit
>
> >> -----------------------------
> >> Did you solve your problem?
>
> >> 1. Make sure you upload your Perl script to the correct folder on your=
web
> >> server, which I think would be something like /cgi-bin. Otherwise you =
may
> >> get a 404 error, saying it can't find the file.
>
> >> 2. Once on the server, ensure that you change the file's properties to
> >> executable, otherwise, I think you'll get error 403, something about
> >> refusing to display web page.
>
> >> 3. I get the 500 Internal Server Error when I have an error in my code=
. The
> >> following script for example works fine:
> >> =A0 =A0 #!/usr/bin/perl
> >> =A0 =A0 $command=3D $];
> >> =A0 =A0 $title =3D "Perl Version";
> >> =A0 =A0 print "Content-type: text/html\n\n";
> >> =A0 =A0 print "<html><head><title>$title</title></head><body>";
> >> =A0 =A0 print "<h1>$title</h1>\n";
> >> =A0 =A0 print "Perl version : ".$command;
> >> =A0 =A0 print "<HR> \n";
> >> =A0 =A0 system 'perl -v';
>
> >> It displays the following -- yes I know it would be great if I had Per=
l 10
> >> :(
>
> >> Perl Version
> >> Perl version : 5.006001
> >> -----------------------
> >> This is perl, v5.6.1 built for i686-linux Copyright 1987-2001, Larry W=
all
> >> 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 sourc=
e 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 athttp://www.perl.com/, the Perl Home Pag=
e.
>
> >> If however, I forget a semi colon like:
> >> =A0 =A0 #!/usr/bin/perl
> >> =A0 =A0 $command=3D $] # <--- Forgot Semicolon
> >> =A0 =A0 $title =3D "Perl Version";
> >> =A0 =A0 print "Content-type: text/html\n\n";
> >> =A0 =A0 print "<html><head><title>$title</title></head><body>";
> >> =A0 =A0 print "<h1>$title</h1>\n";
> >> =A0 =A0 print "Perl version : ".$command;
> >> =A0 =A0 print "<HR> \n";
> >> =A0 =A0 system 'perl -v';
>
> >> I get the following:
> >> 500 Internal Server Error
> >> The server encountered an internal error or misconfiguration and was u=
nable
> >> to complete your request.
> >> Please contact the server administrator, or webmaster and inform them =
of the
> >> time the error occurred, and anything you might have done that may hav=
e
> >> caused the error.
> >> More information about this error may be available in the server error=
log.
>
> >> 4. You can also access your perl scripts directly instead of submittin=
g a
> >> form, for example, type the following in your address bar, and also us=
e
> >> /cgi-bin/my_email.cgi instead of \cgi-bin\my_email.cgi like Sinan said=
.
> >> =A0 =A0http://yourserver/cgi-bin/my_email.cgi
>
> >> 5. On a side note, I use the .pl extension instead of .cgi, but I may =
be a
> >> minority? I think I even read that it was better to not use any extens=
ion
> >> claiming that people don't have to know that the script is Perl or wha=
tever?
>
> >> 6. Your print code looks ok, so perhaps the trouble is in your (pound =
bang)
> >> line? Like you, mine is:
> >> =A0 =A0 #!/usr/bin/perl
> >> But perhaps you require it like this: (user) instead of (usr)???
> >> =A0 =A0 #!/user/bin/perl
>
> >> 7. Are you sure your system supports Perl? If so, check if there are s=
ome
> >> default Perl scripts in the /cgi-bin folder and check if they work, an=
d if
> >> they do, start with them.
>
> >> Finally, I'm quite new to this group and Perl so I expect to be correc=
ted
> >> here!
>
> >> PS. I recently learned that instead of uploading my scripts to test th=
em, I
> >> could install Strawberry Perl on my Windows XP and test my scripts loc=
ally.
> >> I upload them to the server only once the bugs are out.
>
> >> Cheers,
> >> Guy D.
>
> > Thanks for the answer!!! really appreciate!!!
>
> > I have solve the issue!!! was the permission on the .pl file (I set
> > utp the permission on the falder, but not on the file...
>
> > now I'm trying to debug my file.... it works (no error in the
> > browser!!!), but it is not doing what I'd like to...
>
> > #!/usr/bin/perl
>
> use strict;
> use warnings;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
>
>
>
> > &send_email;
>
> =A0 =A0send_email();
>
>
>
> > sub send_email
> > {
> > =A0 =A0 =A0 =A0 $to =3D "vit\@domain.com";
> > =A0 =A0 =A0 =A0 open(MAIL, "|/usr/sbin/sendmail");
>
> Always check for success/failure when opening a file handle.
> Use lexical file-handles and the three-argument open.
> =A0 =A0(assuming your ancient perl supports them)
>
>
>
> > =A0 =A0 =A0 =A0 print MAIL "From: bob\@domain.com\n";
> > =A0 =A0 =A0 =A0 print MAIL "To: $to\n";
> > =A0 =A0 =A0 =A0 print MAIL "Subject: Web Enqiry\n\n";
>
> Aren't you supposed to provide a message body terminated by a full-stop
> on a line by itself?
>
>
>
> > =A0 =A0 =A0 =A0 close (MAIL);
>
> I imagine sendmail was waiting for a message body?
>
> > }
>
> > print "Content-type: text/html\n\n";
>
> Don't promise HTML if you are not willing to keep your promise.
>
> > print "Hello World2"
>
> That isn't HTML.
>
>
>
> > it doesn't give me an error,
>
> Ask perl to tell you of any errors! (see comment above).
> Make sure errors are written somewhere you are looking.
> See above `use CGI::Carp qw(fatalsToBrowser);`
> Back in the days of Perl 4 I used
> =A0 =A0BEGIN {
> =A0 =A0 =A0open(STDERR ,'>&STDOUT')
> =A0 =A0 =A0 =A0|| die "Can't redir stderr to out: $!\n";
> =A0 =A0 =A0$| =3D 1; =A0# Make it unbuffered
> =A0 =A0 =A0print "Content-type: text/html\n\n";
> =A0 =A0}
> This is more in keeping with your rather quaint and archaic coding style
> but I can't imagine your Perl installation could be so backward as to
> lack a better way to redirect errors to the browser.
>
> > but I dont receive any mail....
>
> Ask Perl to tell you why.
>
>
>
> > any suggestion???
>
> See above.
>
> I'd make more use of modules for CGI and for email.
>
>
>
> > thanks
>
> > Vit
>
> --
> RGB
thanks, I will try it!!!
------------------------------
Date: Tue, 9 Jun 2009 23:54:39 -0700 (PDT)
From: Vit <FiNaR76@gmail.com>
Subject: sendmail doesn't work, but no error on the screen...
Message-Id: <a5d29e15-8744-45d6-80cc-c70ae5d1d90e@21g2000vbk.googlegroups.com>
Hi all,
I'm trying to debug my file.... it works (no error in the browser!!!),
but it is not doing what I'd like to...
#!/usr/bin/perl
&send_email;
sub send_email
{
$to = "vit\@domain.com";
open(MAIL, "|/usr/sbin/sendmail");
print MAIL "From: bob\@domain.com\n";
print MAIL "To: $to\n";
print MAIL "Subject: Web Enqiry\n\n";
close (MAIL);
}
print "Content-type: text/html\n\n";
print "Hello World2"
it doesn't give me an error, but I dont receive any mail....
any suggestion???
thanks
Vit
------------------------------
Date: Wed, 10 Jun 2009 10:37:30 +0100
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: sendmail doesn't work, but no error on the screen...
Message-Id: <4a2f7edd$0$18254$da0feed9@news.zen.co.uk>
Vit wrote:
> Hi all,
>
> I'm trying to debug my file.... it works (no error in the browser!!!),
> but it is not doing what I'd like to...
>
> #!/usr/bin/perl
>
> &send_email;
>
> sub send_email
> {
> $to = "vit\@domain.com";
> open(MAIL, "|/usr/sbin/sendmail");
>
> print MAIL "From: bob\@domain.com\n";
> print MAIL "To: $to\n";
> print MAIL "Subject: Web Enqiry\n\n";
>
> close (MAIL);
> }
>
> print "Content-type: text/html\n\n";
> print "Hello World2"
>
> it doesn't give me an error, but I dont receive any mail....
>
> any suggestion???
>
See my answer to your earlier copy of this question in a different thread.
--
RGB
------------------------------
Date: Wed, 10 Jun 2009 11:58:54 +0200
From: Andrzej Adam Filip <Andrzej.Filip@gmail.com>
Subject: Re: sendmail doesn't work, but no error on the screen...
Message-Id: <pzdo09dqx5@lonnie.huge.strangled.net>
Vit <FiNaR76@gmail.com> wrote:
> Hi all,
>
> I'm trying to debug my file.... it works (no error in the browser!!!),
> but it is not doing what I'd like to...
>
> #!/usr/bin/perl
>
> &send_email;
>
> sub send_email
> {
> $to = "vit\@domain.com";
> open(MAIL, "|/usr/sbin/sendmail");
open(MAIL, '|-', '/usr/sbin/sendmail -t -oi') or die;
1) Use of three params open is recommended.
2) You have missed important sendmail's command line parameters
-t - get recipient addresses from the message
-oi - "single do line" is not "end of message"
> print MAIL "From: bob\@domain.com\n";
> print MAIL "To: $to\n";
> print MAIL "Subject: Web Enqiry\n\n";
> close (MAIL);
> }
>
> print "Content-type: text/html\n\n";
> print "Hello World2"
>
> it doesn't give me an error, but I dont receive any mail....
>
> any suggestion???
--
[pl>en Andrew] Andrzej Adam Filip : anfi@onet.eu : Andrzej.Filip@gmail.com
Lack of skill dictates economy of style.
-- Joey Ramone
------------------------------
Date: Wed, 10 Jun 2009 03:01:05 -0700 (PDT)
From: Vit <FiNaR76@gmail.com>
Subject: Re: sendmail doesn't work, but no error on the screen...
Message-Id: <8518071a-78ff-49fb-bf61-a682c55692d3@y9g2000yqg.googlegroups.com>
On 10 Giu, 17:58, Andrzej Adam Filip <Andrzej.Fi...@gmail.com> wrote:
> Vit <FiNa...@gmail.com> wrote:
> > Hi all,
>
> > I'm trying to debug my file.... it works (no error in the browser!!!),
> > but it is not doing what I'd like to...
>
> > #!/usr/bin/perl
>
> > &send_email;
>
> > sub send_email
> > {
> > =A0 =A0 =A0 =A0 $to =3D "vit\@domain.com";
> > =A0 =A0 =A0 =A0 open(MAIL, "|/usr/sbin/sendmail");
>
> open(MAIL, '|-', '/usr/sbin/sendmail -t -oi') or die;
>
> 1) Use of three params open is recommended.
> 2) You have missed important sendmail's command line parameters
> -t =A0- get recipient addresses from the message
> -oi - "single do line" is not "end of message"
>
> > =A0 =A0 =A0 =A0 print MAIL "From: bob\@domain.com\n";
> > =A0 =A0 =A0 =A0 print MAIL "To: $to\n";
> > =A0 =A0 =A0 =A0 print MAIL "Subject: Web Enqiry\n\n";
> > =A0 =A0 =A0 =A0 close (MAIL);
> > }
>
> > print "Content-type: text/html\n\n";
> > print "Hello World2"
>
> > it doesn't give me an error, but I dont receive any mail....
>
> > any suggestion???
>
> --
> [pl>en Andrew] Andrzej Adam Filip : a...@onet.eu : Andrzej.Fi...@gmail.co=
m
> Lack of skill dictates economy of style.
> =A0 -- Joey Ramone
thanks, I will try!!!
------------------------------
Date: Wed, 10 Jun 2009 02:52:21 -0700 (PDT)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: Strawberry and Vanilla Perl
Message-Id: <8d2edd2c-8b3c-4ac7-b92a-e61e98523677@f19g2000yqh.googlegroups.com>
On Jun 10, 6:53=A0am, Ben Morrow <b...@morrow.me.uk> wrote:
> This differs from ActiveState's perl in
> that AS (a) apply quite a few patches to their perl before distributing
> it, (b) don't supply a compiler
They don't provide a compiler, but 'ppm install MinGW' will provide
you with the MinGW port of gcc, along with the 'dmake' make utility -
no additional configuration required.
> And a compiler compatible with ActivePerl is not cheap
The MinGW port of the gcc compiler is both compatible with ActivePerl
and free.
> though AS do include a somewhat half-
> =A0 =A0 hearted hack to try and make it work with gcc if you've got that
> =A0 =A0 installed.
That "half-hearted hack" means that *any* perl extension that builds
on Strawberry Perl, can also be built in exactly the same way on
ActivePerl, using the MinGW port of the gcc compiler. (You could even
set things up to use Strawberry Perl's MinGW with ActivePerl if you
wanted.)
If you 'ppm install MinGW' (rather than use Strawberry's MinGW),
you'll even be able to build some extensions (eg PGPLOT and various
PDL components) on ActivePerl that can't be built on Strawberry Perl -
because the MinGW that you 'ppm install' includes the g77 fortran
compiler, whereas the MinGW that ships with Strawberry Perl does not.
(At least, it didn't last time I checked - apologies if this omission
has since been rectified.)
Cheers,
Rob
------------------------------
Date: Tue, 9 Jun 2009 21:09:19 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: understanding \Q \E
Message-Id: <slrnh2u5ef.m3r.tadmc@tadmc30.sbcglobal.net>
Jürgen Exner <jurgenex@hotmail.com> wrote:
> Tad J McClellan <tadmc@seesig.invalid> wrote:
>>Guy <someone@somewhere.nb.ca> wrote:
>>
>>> A lot of people refer to perldoc but I don't know how to access this.
>>
>>A lot (most, in fact) of Perl programmers use Perl on *nix, so they
>>are used to accessing it by typing into the command line exactly what
>>you usually see posted (which is why it is posted that way).
>>
>>eg. Most folks see Perl's std docs by typing:
>>
>> perldoc -f quotemeta
>>
>>at a shell prompt.
>
> Just for reference: it works exactly the same way from a MS Windows
> command line, too.
Thanks.
I thought I had heard that it didn't for AS Perl and that the
docs in that distro were only in HTML.
Is that accurate?
Does Strawberry Perl install "perldoc" and the PODs?
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 09 Jun 2009 22:13:10 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: understanding \Q \E
Message-Id: <nnfu25lsefl3d9109fcurch528llub0t83@4ax.com>
Tad J McClellan <tadmc@seesig.invalid> wrote:
>Jürgen Exner <jurgenex@hotmail.com> wrote:
[about calling perldoc from command line]
>> Just for reference: it works exactly the same way from a MS Windows
>> command line, too.
>
>I thought I had heard that it didn't for AS Perl and that the
>docs in that distro were only in HTML.
>
>Is that accurate?
If "AS" stands for ActiveState Perl then at least for older versions
both statements are false. AS does install perldoc, it works just fine,
and the documentation is available in POD and HTML.
Can't comment on 5.10 because I haven't updated to it yet.
>Does Strawberry Perl install "perldoc" and the PODs?
Don't know, have never used it.
jue
------------------------------
Date: Wed, 10 Jun 2009 03:27:59 -0500
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: What happened to perl doc
Message-Id: <100620090327593449%brian.d.foy@gmail.com>
In article <Xns9C207DAB5ED62asu1cornelledu@127.0.0.1>, A. Sinan Unur
<1usa@llenroc.ude.invalid> wrote:
> perl man <klausfpga@gmail.com> wrote in
> news:80ddda9c-27b3-4346-b59c-5630341b15ad@f10g2000vbf.googlegroups.com:
>
> > I use perldoc.perl.org a lot to browse perl documentation
> > interactively
> > Loosing this capability would be a real pity :-(
>
> Why??? The documentation for your version of Perl is on your computer.
I find a web browser much more convenient. I even look at
search.cpan.org instead of reading module docs locally. You don't have
to do it that way, but I like it.
------------------------------
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 2468
***************************************