[27673] in Perl-Users-Digest
Perl-Users Digest, Issue: 9122 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 5 03:05:46 2006
Date: Wed, 5 Apr 2006 00:05:06 -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, 5 Apr 2006 Volume: 10 Number: 9122
Today's topics:
ANNOUNCE: CGI::Session::ExpireSessions V 1.06 <ron@savage.net.au>
ANNOUNCE: DBIx::HTML::PopupRadio V 1.13 <ron@savage.net.au>
Re: Catching Apache Errors in Perl <matthew.garrish@sympatico.ca>
Re: Help calling perl from gnu make on windows <tadmc@augustmail.com>
Module Suggestions for Posting Form Data <hal@thresholddigital.com>
Re: Module Suggestions for Posting Form Data <ced@blv-sam-01.ca.boeing.com>
Perl-related events in 2006 ? lars@nospam.nosoftwarepatents.edu
Re: Regex Question <xxx@yyy.com>
Re: Regex Question <rvtol+news@isolution.nl>
Re: Render 3D-Body <Jonas.Huckestein@web.de>
taint mode and require using "." <no@thanks.com>
Re: Two questions on making a Perl script work on PC <rhu@mathworks.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 4 Apr 2006 23:06:26 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: CGI::Session::ExpireSessions V 1.06
Message-Id: <Ix84q3.4MI@zorch.sf-bay.org>
The pure Perl module CGI::Session::ExpireSessions V 1.06
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.06 Tue Apr 4 10:04:00 2006
- Add binmode after open in sub expire_file_sessions
- Change "eval $session[0]" into "eval join('', @session)" to handle session
data containing \n
- Add a new test, t/new-line.t, to test session data containing \n
- The problem with session data containing \n characters was reported via RT by
m-uchino at yetipapa.com
------------------------------
Date: Tue, 4 Apr 2006 23:07:00 GMT
From: Ron Savage <ron@savage.net.au>
Subject: ANNOUNCE: DBIx::HTML::PopupRadio V 1.13
Message-Id: <Ix84qA.4oE@zorch.sf-bay.org>
The pure Perl module DBIx::HTML::PopupRadio V 1.13
is available immediately from CPAN,
and from http://savage.net.au/Perl-modules.html.
On-line docs, and a *.ppd for ActivePerl are also
available from the latter site.
An extract from the docs:
1.13 Wed Mar 22 10:57:00 2006
- In subs popup_menu and radio_group, use a case-insensitive compare when
trying to set the default menu item.
I need this in one project because the menu values and the default come from
different databases
------------------------------
Date: Tue, 4 Apr 2006 21:47:31 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Catching Apache Errors in Perl
Message-Id: <MkFYf.1813$sh3.111795@news20.bellglobal.com>
"Daniel Kaplan" <NoSPam@NoSpam.com> wrote in message
news:1144180753.207482@nntp.acecape.com...
> Hello All,
>
> I wanted to replace on my server the standard 500 Server error page with
> my own via a Perl script.
>
> What I was curious about was does Perl have a way of accessing those
> errors? I thought it might be @!, at least to start with. But when I ran
> a test script with the "my" missing, all @! contained was "No such file or
> directory" so am not sure where that's coming from.
>
Doubtful. If it's an asp page, you could always check GetLastError, but
that's not often very helpful. The page that died is dead and buried, so
unless your script can read the logs to find the error you're not going to
get much useful from the server. You should be doing better error handling
in the page that is dying so you don't generate a 500 error in the first
place (e.g., wrap the code most prone to failure in an eval so if it fails
the whole script doesn't fail), or at least so you can redirect to a more
appropriate page and pass it whatever info you want.
Matt
------------------------------
Date: Tue, 4 Apr 2006 20:42:22 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Help calling perl from gnu make on windows
Message-Id: <slrne3683u.odt.tadmc@magna.augustmail.com>
Random Task <Random@Task.be> wrote:
> No chance you know how to get the 8.3 name for a path inside perl do you ?
>
> r.Ruud wrote:
>> Random Task schreef:
>>> Dr.Ruud:
>>>> Random Task:
>>
>> Please don't top-post.
You were asked to stop.
You did not stop.
Many will now stop reading all of your future articles.
Please don't top-post!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 04 Apr 2006 20:23:55 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Module Suggestions for Posting Form Data
Message-Id: <_ZGdndqhJ8eKk67ZRVn-gg@comcast.com>
I've been searching for a module to do this. LWP comes close.
WWW::Mechanize almost does it, but I can't find one that does just what I
need.
I have data on my computer that will be transferred to a server by POSTing
it in an HTTP request (eventually in an HTTPS request, but for now testing
is on HTTP). I'm having no problem doing this in Java by specifying the
name/value pairs and POSTing the data, then reading the returned page to
make sure it was all sent properly. In Perl, though I'm having trouble
doing it. WWW::Mechanize does forms well, but it requires a pre-existing
form to have been fetched form the server first, then the fields are filled
in.
What I need to be able to do is specify name/value pairs (and some values
are actually files encoded with MIME::Base64), POST them, then read the
returned HTML page. There is no actual html page I can read with the form
there and I'd rather not have to make one up, since it's just one more
thing I'll have to change if the server has any changes done.
What module would be good (and, if possible, easy) to use for this?
Thanks!
Hal
------------------------------
Date: Wed, 5 Apr 2006 02:51:15 GMT
From: Charles DeRykus <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Module Suggestions for Posting Form Data
Message-Id: <Ix8ALF.5ss@news.boeing.com>
Hal Vaughan wrote:
> I've been searching for a module to do this. LWP comes close.
> WWW::Mechanize almost does it, but I can't find one that does just what I
> need.
>
> I have data on my computer that will be transferred to a server by POSTing
> it in an HTTP request (eventually in an HTTPS request, but for now testing
> is on HTTP). I'm having no problem doing this in Java by specifying the
> name/value pairs and POSTing the data, then reading the returned page to
> make sure it was all sent properly. In Perl, though I'm having trouble
> doing it. WWW::Mechanize does forms well, but it requires a pre-existing
> form to have been fetched form the server first, then the fields are filled
> in.
>
> What I need to be able to do is specify name/value pairs (and some values
> are actually files encoded with MIME::Base64), POST them, then read the
> returned HTML page. There is no actual html page I can read with the form
> there and I'd rather not have to make one up, since it's just one more
> thing I'll have to change if the server has any changes done.
>
> What module would be good (and, if possible, easy) to use for this?
>
HTTP::Request::Common may be what you're looking for if I've understood
correctly:
NAME
HTTP::Request::Common - Construct common HTTP::Request objects
SYNOPSIS
use HTTP::Request::Common;
$ua = LWP::UserAgent->new;
...
$ua->request(POST 'http://somewhere/foo', [foo => bar, bar => foo]);
...
HTH,
--
Charles DeRykus
------------------------------
Date: Wed, 05 Apr 2006 06:27:32 GMT
From: lars@nospam.nosoftwarepatents.edu
Subject: Perl-related events in 2006 ?
Message-Id: <orJYf.913$hi2.742@news.itd.umich.edu>
What perl-related events are coming up this year ?
When and where ?
--
Lars
Software patents harm all Net-based business, write your MEP:
http://wwwdb.europarl.eu.int/ep6/owa/p_meps2.repartition?ilg=EN
------------------------------
Date: Tue, 4 Apr 2006 18:27:23 -0400
From: "Mike C#" <xxx@yyy.com>
Subject: Re: Regex Question
Message-Id: <ppCYf.33$ZG1.9@fe10.lga>
Thank you all for your help on this. Your regular expression examples
worked great. I'm pretty familiar with substr functions, looping
structures, iterators, arrays, etc., etc. This was all about the regex's.
To answer the question why would I want to do this? More out of curiousity
than anything. As I mentioned, I'm learning regex's and I'm finding out
it's more art than science. I was focusing on the ?: and ?= operators but
getting nowhere fast. Basically I was looking for a more "elegant" way
other than looping.
Thanks!
"Mike C#" <xxx@yyy.com> wrote in message news:yllYf.548$Nn1.198@fe12.lga...
> Hi I'm new to Perl regex's, and I've been racking my brain for a while now
> on this one. Any help is appreciated. Basically, I want to return all
> matches from the beginning of the string to a specific letter. As an
> example, with the string "Manager" and up to the letter "a", I want to
> return the following sub-groups:
>
> M
> Man
>
> And for the word "Fishing" and up to the letter "i", I want to return:
>
> F
> Fish
>
> Thank you in advance.
>
> Mike C.
>
------------------------------
Date: Tue, 4 Apr 2006 23:45:25 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Regex Question
Message-Id: <e0v0mh.104.2@news.isolution.nl>
axel@white-eagle.invalid.uk schreef:
> Anno Siegel:
>>> Mike C#:
>>>> I
>>>> want to return all matches from the beginning of the string to a
>>>> specific letter. As an example, with the string "Manager" and up
>>>> to the letter "a", I want to return the following sub-groups:
>>>> M
>>>> Man
>>>>
>>>> And for the word "Fishing" and up to the letter "i", I want to
>>>> return:
>>>> F
>>>> Fish
>>
>> print substr($str, 0, $-[0]), "\n" while $str =~ /$letter/g;
>
> print $`, "\n" while $str =~ /$letter/g;
Of course, and to me the nicest so far.
Test:
echo abracadabra | perl -nle 'print "<$`>" while /a/g'
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Wed, 05 Apr 2006 06:40:06 +0200
From: Jonas Huckestein <Jonas.Huckestein@web.de>
Subject: Re: Render 3D-Body
Message-Id: <e0vhmk$4ka$1@online.de>
Hey Oliver,
... gee, thanks! I knew I didn't think of something important. The format is
absolutely what I need!
Does anyone know how to create simple VRML-scenes from perl? On CPAN there
is only very little documentation for the modules. I assume that I need the
VRML module, right? Then I sort of feed VRML my points and edges and use a
VRML-Browser to view the result?
Regards,
Jonas
corff@zedat.fu-berlin.de wrote:
> Jonas Huckestein <Jonas.Huckestein@web.de> wrote:
>
> : Which module can you recommend to display that sort of
> : "stacked-polygons-body"? I might add, that I would like to be able to
> : turn the body and view it from all around.
>
> : In other words, I have a "model" of something, given by a set of group
> : and edges and need to display it in a 3d-environment.
>
> Did you have a look at VRML? Did you search cpan.org for VRML? Some
> modules there might do what you need.
>
> Oliver.
>
--
Jonas Huckestein
PGP Key:
http://keyserver.mine.nu/pks/lookup?op=get&search=0x0E751B943C380BFC
------------------------------
Date: Wed, 5 Apr 2006 08:47:28 +0200
From: Asterbing <no@thanks.com>
Subject: taint mode and require using "."
Message-Id: <MPG.1e9d867029b309299897d1@news.tiscali.fr>
Considering a script with a line like this :
require 'config.cgi';
When I activate the taint mode through "#!/usr/bin/perl -T" and adding
"use CGI::Carp qw/fatalsToBrowser/;" for the purpose to see tatal errors
on browser, I'm getting this error "Can't locate config.cgi in @INC".
According to what I've read, it seems normal since taint mode remove the
"." from @INC.
I don't wish to indicate an absolute path which would be to adjust for
every install on a new server, thus I've just modified the require line
like this : "require './config.cgi';
But... When I run the script now I'm just getting a direct perl.exe
crash without any message !
How to write this require line with taint mode ?
------------------------------
Date: Tue, 4 Apr 2006 19:15:48 -0400
From: "Rong Hu" <rhu@mathworks.com>
Subject: Re: Two questions on making a Perl script work on PC
Message-Id: <e0uun7$8j3$1@fred.mathworks.com>
Hi Sinan,
1. Yes, I got different results when I use an obsolute path as the input
argument.
On Unix:
/sandbox/rhu/Acontrol_14p0_Nov17/matlab/tools/i18n/diff.txt
/sandbox/rhu/Acontrol_14p0_Nov17/matlab/tools/i18n/diff.txt
On PC:
S:\Acontrol_14p0_Nov17\matlab\tools\i18n\diff.txt
diff.txt
2. What is the better solution rathan than do something like:
($sdir) = $path =~ m[(.*toolbox[/\\].*?[/\\].*?[/\\])]
Thanks,
Rong
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns979B5563E5AACasu1cornelledu@127.0.0.1...
> "Rong Hu" <rhu@mathworks.com> wrote in
> news:e0tnr5$b0a$1@fred.mathworks.com:
>
>> 1. I use "find" to collect all M-code. $_ should be the same as
>> $File::Find::name when I use "no_chdir => 1".
>> On Unix, it's true. Both give fullpathes. However, on PC, $_ gives
>> relative pathes while $File::Find::name gives fullpathes.
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use File::Find;
>
> find({ wanted => \&wanted, no_chdir => 1}, $ARGV[0]);
>
> sub wanted {
> unless ($File::Find::name eq $_ ) {
> print "$File::Find::name\n$_\n\n";
> }
> }
>
> __END__
>
> D:\Home\asu1\UseNet\clpmisc> ff D:/Dload
>
> D:\Home\asu1\UseNet\clpmisc>
>
> D:\Home\asu1\UseNet\clpmisc> ff ..
>
> D:\Home\asu1\UseNet\clpmisc>
>
> Do you get different results?
>
>> 2. I'm using either slash or backslash [/\\] as a file separator to
>> find the existing translation file. Is there a better way?
>
> Yes.
>
>> Btw, I found a useful function to glue path and filename together
>> based on the running platform. It's File::Spec::catfile.
>
> Use it.
>
> 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://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
>
------------------------------
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 9122
***************************************