[22650] in Perl-Users-Digest
Perl-Users Digest, Issue: 4871 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 21 14:06:41 2003
Date: Mon, 21 Apr 2003 11:05:09 -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 Mon, 21 Apr 2003 Volume: 10 Number: 4871
Today's topics:
Re: Copying files efficiently <wksmith@optonline.net>
Re: CreateObject equivalent in Perl <keith_awcock@blueyonder.co.uk>
Re: CreateObject equivalent in Perl <nospam@raytheon.com>
Re: CreateObject equivalent in Perl <kasp@epatra.com>
Re: design considerations for using DB_File tie hashes (dan baker)
Re: HTML::Template question <nospam@raytheon.com>
Re: linux (Kai Henningsen)
Re: Newbie Help searching for a ^ character ... <barryk2@SPAM-KILLER.mts.net>
Re: newbie question regarding s/<old string>/<new strin <barryk2@SPAM-KILLER.mts.net>
Re: perl-module for HTTP POST <tony_curtis32@yahoo.com>
Re: PerlScript, handbook <nospam@raytheon.com>
Re: print out multi queries <member17678@dbforums.com>
Re: Q. Basic Perl Tutorial ? (for a not-so-bright newb <kasp@epatra.com>
Re: Q. Does ActivePerl for Windows require Apache to be <kasp@epatra.com>
Re: Q. Does ActivePerl for Windows require Apache to be <jurgenex@hotmail.com>
Re: Q. Does ActivePerl for Windows require Apache to be <nospam@raytheon.com>
Re: Smart searching <greg@racquettech.com>
Re: TimeStamp - localtime <markvalls.spambox@dnainternet.net>
Re: TimeStamp - localtime <glex_nospam@qwest.net>
Re: TimeStamp - localtime <w.koenig@acm.org>
Re: Trouble with LWP <keith_awcock@blueyonder.co.uk>
Re: Validating user input to match certain characters (Kai Henningsen)
Writing to Exel files using Perl <motis@lyciumnetworks.com>
Re: Writing to Exel files using Perl <kasp@epatra.com>
Re: Writing to Exel files using Perl <graham.drabble@lineone.net>
Re: Writing to Exel files using Perl <ouellmi@videotron.ca>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Apr 2003 16:49:32 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Copying files efficiently
Message-Id: <wiVoa.66169$MB4.26678748@news4.srv.hcvlny.cv.net>
"Felix" <josspowell@paradise.net.nz> wrote in message
news:536f59c6.0304201904.42db8fc4@posting.google.com...
--snip--
> for (@source) {
>
> open IN, "$source/$_" or die $!;
> open OUT, "> $target/$_" or die $!;
> binmode IN; binmode OUT;
> print "Currently copying $_\n";
> while (<IN>) {
>
> print OUT $_;
>
> }
>
> }
>
--snip--
Sorry that I can't offer much help on your question, but these
observations on your code may be useful.
It is good practice, and may even help, to explicitly close the files
within the loop.
Your print statement probably will not do what you intend unless
OUTPUT_AUTOFLUSH ($|) is set to a true value.
Good Luck,
Bill
------------------------------
Date: Mon, 21 Apr 2003 16:46:49 +0100
From: "Keith Awcock" <keith_awcock@blueyonder.co.uk>
Subject: Re: CreateObject equivalent in Perl
Message-Id: <BhUoa.792$QW4.289@news-binary.blueyonder.co.uk>
"Kasp" <kasp@epatra.com> wrote in message
news:b80g7d$dol$1@newsreader.mailgate.org...
> What would be the equivalent of CreateObject in Perl?
>
> Eg. from some VB code:
> Dim accessIbj = CreateObject("Access.Application.8")
>
From the Win32::OLE docs
$ex = Win32::OLE->new('Excel.Application') or die "oops\n";
$ex->Amethod("arg")->Bmethod->{'Property'} = "foo";
$ex->Cmethod(undef,undef,$Arg3);
$ex->Dmethod($RequiredArg1, {NamedArg1 => $Value1, NamedArg2 => $Value2});
$wd = Win32::OLE->GetObject("D:\\Data\\Message.doc");
$xl = Win32::OLE->GetActiveObject("Excel.Application");Keith
------------------------------
Date: Mon, 21 Apr 2003 10:16:24 -0500
From: Chris Olive <nospam@raytheon.com>
Subject: Re: CreateObject equivalent in Perl
Message-Id: <2_Toa.324$35.1162@dfw-service2.ext.raytheon.com>
Kasp wrote:
> What would be the equivalent of CreateObject in Perl?
>
> Eg. from some VB code:
> Dim accessIbj = CreateObject("Access.Application.8")
>
> Thanks.
> --
> "Accept that some days you are the pigeon and some days the statue."
> "A pat on the back is only a few inches from a kick in the butt." - Dilbert.
>
Probably what you want is found in Win32::OLE. Take a look at the
documentation for that:
my $obj = Win32::OLE->new( "Access.Application.8" );
Also see Win32::OLE->GetObject() and Win32::OLE->GetActiveObject().
Chris
-----
Chris Olive
Systems Consultant
Raytheon Technical Services Corporation
Indianapolis, IN
email: olivec(AT)indy(DOT)raytheon(DOT)com
------------------------------
Date: Mon, 21 Apr 2003 22:47:44 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: CreateObject equivalent in Perl
Message-Id: <b819t0$ejp$1@newsreader.mailgate.org>
Thanks for the quick response.
------------------------------
Date: 21 Apr 2003 09:05:49 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: design considerations for using DB_File tie hashes ???
Message-Id: <13685ef8.0304210805.71a4ef4a@posting.google.com>
another alternative I've used on smaller projects is "requiring"
hashes that are explicitly defined in as perl source file, and
overwriting the source when values change... that way I didnt worry
about the reads at all since any thread reading the hash pulled a copy
into memory, and I only had to worry about locking when overwriting
the source file to update data.
the issue I wasn't sure about with this approach was with respect to
memory. can anyone shed light on what the scalability and memory
issues might be for having an explicit hash "required" by a script
versus using tie() DB_FILE to the hash? i.e. it is unclear to me if
using tie() sidesteps the size/memory problem by using disk rather
than RAM.
for example, lets say I have a hash of maybe 100k members names and
email addresses. would there be a significant difference in memory
usage with respect to the machine running the script? i.e. I dont want
to kill the server. ;)
d
------------------------------
Date: Mon, 21 Apr 2003 09:36:31 -0500
From: Chris Olive <nospam@raytheon.com>
Subject: Re: HTML::Template question
Message-Id: <EoToa.320$35.1149@dfw-service2.ext.raytheon.com>
Joe Smith wrote:
> In article <51d7db68.0304181239.52a15f57@posting.google.com>,
> Brent Middaugh <smiddaugh@telispire.com> wrote:
>
>>I've verifed that the file main.tmpl is in the same directory as the
>>script, so I'm not quite sure why that H::T can't find the file.
>
>
> If you were running a web server based on the NCSA version (such as
> Apache), then the script's directory would be significant. But IIS
> does not work that way. You should either use absolute pathnames
> for all files, or chdir() first.
> -Joe
You can also specify an anonymous array of paths option on the new() for
HTML::Template to look in when opening template files. Still should be
absolute paths, but a good option to have none the less:
#!/usr/bin/perl -wT
$|++;
use strict;
use HTML::Template;
my WWWROOT = '/var/www/docs';
my WWWTMPLDIR = "$WWWROOT/tmpl";
my APPLDIR = "$WWWROOT/myapp";
my APPLTMPLDIR = "$APPLDIR/tmpl";
my $tmpl = HTML::Template->new(
filename => 'main.tmpl'
path => [ WWWTMPLDIR, APPLTMPLDIR ]
);
__END__
Then those two paths specified (or as many as you'd like or just one)
will be searched on the new() method.
Chris
-----
Chris Olive
Systems Consultant
Raytheon Technical Services Corporation
Indianapolis, IN
email: olivec(AT)indy(DOT)raytheon(DOT)com
------------------------------
Date: 21 Apr 2003 17:49:00 +0200
From: kaih=8kHgISj1w-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: linux
Message-Id: <8kHgISj1w-B@khms.westfalen.de>
abigail@abigail.nl (Abigail) wrote on 09.04.03 in <slrnb9955l.2bg.abigail@alexandra.abigail.nl>:
> DESANTIS77 (desantis77@aol.com) wrote on MMMDVIII September MCMXCIII in
> <URL:news:20030409135012.14640.00000813@mb-fe.aol.com>:
> () Can someone tell if Perl5 comes with linux 8?
>
>
> Unlikely. I expect Perl 6 to be there before Linux 8, even when it's
> going to take a couple of years before Perl 6 is there.
>
> Linux is now at 2.*, and it has been there for a while. It'll take
> decades before they reach version 8.
Unless, of course, Linus decides to pull a Solaris. In which case it'd be
the stable version after the coming stable version.
But I agree that's very unlikely.
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: Mon, 21 Apr 2003 08:25:58 -0500
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: Newbie Help searching for a ^ character ...
Message-Id: <MPG.190dad5eb682547a9897a6@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <9zHoa.60$Fd1.253149@newsfep2-gui.server.ntli.net>, Newbie
(dlaw001@yahoonospam.co.uk) says...
> Hi
>
> Its 2 am on a sunday mourning and I'm not thinking as straight
> as I should be .and I can't seem to find my "perl book" ...
> What I'm trying to is search a string to see if contains a '^' if so skip
> that line and continue reading in the remainder of the lines
>
> ie if the $Line is ^FT2000 it skips while FT2000 is ok
>
> if( !( $Line = ?????????? ) ) {
> /* Line does not contain any ^ characters...*/
> .
> .
> }
>
> Any help or pointers would be greatly appreciated...
>
> Thanks
> David
> ps remove the nospam from my email address...
if ( $Line =~ m/\^/ ) {
# Found a "^"
} # IF
--
---------
Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com
------------------------------
Date: Mon, 21 Apr 2003 08:27:20 -0500
From: Barry Kimelman <barryk2@SPAM-KILLER.mts.net>
Subject: Re: newbie question regarding s/<old string>/<new string>/g
Message-Id: <MPG.190dadb67b188ce09897a7@news.mts.net>
[This followup was posted to comp.lang.perl.misc]
In article <y8Moa.11$P77.10437@newsfep2-gui.server.ntli.net>, Newbie
(dlaw001@yahoonospam.co.uk) says...
> Hi
>
> I've been trying to get the following working...
>
> $Lines =~s/\N/A/0/g;
>
> Lines will contain a string, it may or may not have the abbreviation N/A
> in it.
> What I need to do is search the string $Lines for the abbrev. N/A
> and replace it with 0. Is this possible ?
>
> I have tried the following
>
> $Lines =~s/\"N/A"/0/g;
>
> I have also tried a few variations but seems to be going around in circles
> any pointers or help would be greatly appreciated.
>
> Thanks
> David.
> ps remove nospam from email address...
$Line =~ s/N\/A/0/g;
--
---------
Barry Kimelman
Winnipeg, Manitoba, Canada
email : bkimelman@hotmail.com
------------------------------
Date: Mon, 21 Apr 2003 09:05:20 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: perl-module for HTTP POST
Message-Id: <87n0ikvtcv.fsf@limey.hpcc.uh.edu>
>> On Mon, 21 Apr 2003 12:45:09 +0200,
>> Rikard Bø <rikard_bo@yahoo.no> said:
> Hi! I'm loooking for a perl module that can handle HTTP
> POST ! I want to send some text, maybe an entire
> text-file, as a FORM element!
> Does anyone what perl module to use, and where to find
> it? And maybe a code example aswell?
perldoc lwpcook
hth
t
------------------------------
Date: Mon, 21 Apr 2003 09:58:45 -0500
From: Chris Olive <nospam@raytheon.com>
Subject: Re: PerlScript, handbook
Message-Id: <uJToa.321$35.948@dfw-service2.ext.raytheon.com>
Stéphane Lepolozec wrote:
> "Knute Snortum" <knuteNOSPAMPLEASE@trinityproject.org> a écrit dans le
> message de news: 76Hoa.2770$Df4.790@nwrddc03.gnilink.net...
>
>>http://www.wellho.net/book/0-471-38314-7.html
>>Found by going to google.com and typing "perlscript book".
>
>
> Thank you very much, I thought of it but I did not find anything...
> I badly wrote : I seek a free documentation HTML or pdf or TXT or DOC or...
> on the Web ;-)
> Another idea?
>
>
I'm not sure whether to conclude you HAVEN'T found very many references
to PerlScript on the web, or you have and you want a book too?
My own experience is that I found very, very little of actual ASP
PerlScript information on the web. One or two pages and that was it
(and even then I had to use Google's caching of the page and not the
actual page itself, which had disappeared.)
All of which is a real shame because if you want to script in ASP
(rather than ASP.NET -- a whole different animal), there is no better
ASP scripting engine than PerlScript and I was (and still am) **very**
surprised by the lack of information on it. I'm also surprised that it
has so little following or that it's virtually unheard of. PerlScript
BLOWS THE DOORS off of regular ASP VBScript or JScript. No comparision
whatsoever. Combine PerlScript with HTML::Template, Template Toolkit
and a few other select and established Perl modules and you have the
power of .NET on a regular ASP platform. (Once again, Microsoft
convinces the world that they invented something unique with .NET when
it was there all along in Perl.) I highly recommend PerlScript for ASP
scripting.
ANYWAY... My findings were and still are that the book already pointed
out to you is going to be your best source of information on PerlScript.
I found no other better source either in book or virtual (web) form.
And good luck finding one of those books too. I was able to find two
copies myself, but it was sheer luck. That book is hard to find.
Don't get any ideas that it's some comprehensive 1000-page honking
manual either. It's quite thin. About 270+ pages. Basically gets you
out of the gate with PerlScript, but some of the more subtle features of
ASP you still have to garner from other usual ASP sources (VBScript and
JScript) and translate it into PerlScript. If you are seriously
interested in PerlScript and can grab the book, you should do so.
I would think it would have benefitted ActiveState to promote PerlScript
and document it more than they did. Seems they wrote the engine, then
left on the vine to be accidentally discovered or to rot with no
promotion of it and very, very scant documentation. And it's a shame;
it is a REALLY, REALLY nice ASP engine.
Chris
-----
Chris Olive
Systems Consultant
Raytheon Technical Services Corporation
Indianapolis, IN
email: olivec(AT)indy(DOT)raytheon(DOT)com
------------------------------
Date: Mon, 21 Apr 2003 16:36:14 +0000
From: Mario542 <member17678@dbforums.com>
Subject: Re: print out multi queries
Message-Id: <2789079.1050942974@dbforums.com>
Jeff,
How does one run two queries in one script?
--
Posted via http://dbforums.com
------------------------------
Date: Mon, 21 Apr 2003 19:55:50 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Q. Basic Perl Tutorial ? (for a not-so-bright newbie)
Message-Id: <b80v36$dq$1@newsreader.mailgate.org>
I will suggest you 3 books.
Learning Perl 3rd Ed
Programming Perl 3rd Ed
CGI Programming.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 19:49:53 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <b80umh$vd0$1@newsreader.mailgate.org>
> Because I was just not sure. I want to get started practicing Perl for
> web stuff, and just didnt know. I have NT4 and loaded Apache2 which
> works fine. I now want to add Perl so I can start working with it.
> Please advise, given my scenario.
I think you can forget about Apache installation for now.
Get some exposure to Perl and then go for web programming using Perl (CGI).
HTH
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 14:31:01 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <FgToa.19085$Ak.18079@nwrddc01.gnilink.net>
Jim Jones wrote:
> On Mon, 21 Apr 2003 02:49:45 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
>> Jim wrote:
>> [Does ActivePerl for Windows require Apache to be installed ?]
>> Of course not.
>> Why would you possibly think it would?
> Because I was just not sure. I want to get started practicing Perl
That's fine. All you need for that is a Perl interpreter.
> for web stuff,
This however has nothing to do with Perl any more and is a whole different
ball game.
> I now want to add Perl so I can start working with it.
>
> Please advise, given my scenario.
Take it step by step. Lern Perl first. After you aquired some confidence
move on to CGI.
And then put both together.
jue
------------------------------
Date: Mon, 21 Apr 2003 10:08:05 -0500
From: Chris Olive <nospam@raytheon.com>
Subject: Re: Q. Does ActivePerl for Windows require Apache to be installed ?
Message-Id: <eSToa.323$35.1137@dfw-service2.ext.raytheon.com>
Jim Jones wrote:
> On Mon, 21 Apr 2003 02:49:45 GMT, "Jürgen Exner"
> <jurgenex@hotmail.com> wrote:
>
>
>>Jim wrote:
>>[Does ActivePerl for Windows require Apache to be installed ?]
>>
>>>Can anyone help?
>>
>>Of course not.
>>Why would you possibly think it would?
>>
>>jue
>>
>
> Hi,
> Because I was just not sure. I want to get started practicing Perl for
> web stuff, and just didnt know. I have NT4 and loaded Apache2 which
> works fine. I now want to add Perl so I can start working with it.
>
> Please advise, given my scenario.
> THanks for the responses,
>
> Jim
>
When you say "ActivePerl" that could be translated to mean ActiveState's
PerlScript. There's a difference between ActivePerl or PerlScript and
just Perl under Windows. And ActiveState's documentation of PerlScript,
unfortunately, is very scant. (There is no better scripting engine for
ASP than PerlScript, however. An incredible shame that it's so poorly
documented.)
If you can clarify which you mean, I (and others) could probably provide
you with better assistance since I've used both pretty extensively on
the Windows platform.
PerlScript != Perl # strictly speaking
Seeing that you've loaded Apache however (and I can't tell if you loaded
Apache because you thought you needed to do so, or because that's
exactly what you wanted to do), then maybe you aren't talking about
PerlScript since PerlScript REQUIRES running IIS...
Chris
-----
Chris Olive
Systems Consultant
Raytheon Technical Services Corporation
Indianapolis, IN
email: olivec(AT)indy(DOT)raytheon(DOT)com
------------------------------
Date: 21 Apr 2003 16:02:45 GMT
From: Greg Raven <greg@racquettech.com>
Subject: Re: Smart searching
Message-Id: <greg-F565CA.09024121042003@news.spellbndr.com>
In article <slrnba32nr.c28.tadmc@magna.augustmail.com>,
tadmc@augustmail.com (Tad McClellan) wrote:
> Kasp <kasp@epatra.com> wrote:
>
> > I intend to make a google-like interface (using CGI). The user can then type
> > in some of the words of a file. For eg. suppose he is looking for a MP3
> > called "Perl Rocks". Then I want some way of searching through the file
> > names I have collected and search for this combination.
> >
> > By intelligent search I mean that the results displayed should first attempt
> > to show files having both the words common, followed by records having
> > atleast one of the search words.
> >
> > So suppose user says "A B", then I search for strings having (*A*B* |
> > *B*A*).
> > Then I search just for A | B.
> >
> > However, this method's performance will degrade quickly as the number of
> > words increases to "A B C", "A B C D"...and so on.
>
> > Or could you
> > suggest some way out.
>
>
> Scoring.
>
> Search for each of the words, assign a score (10 points say) for
> each word that matches. Order the results by total score.
Unless I'm missing something, this sounds to be a fairly typical "search
engine" function, such as is available from http://www.kscripts.com/.
--
Greg Raven
------------------------------
Date: Mon, 21 Apr 2003 17:58:02 +0300
From: Marko Vallius <markvalls.spambox@dnainternet.net>
Subject: Re: TimeStamp - localtime
Message-Id: <qgddn-t8d.ln1@sethlans.mine.nu>
On Mon, 21 Apr 2003 10:40:57 GMT, rjh wrote:
> My Code,
>
> use strict;
> use Time::localtime;
> use POSIX 'strftime';
...
> $timestamp = strftime "%Y%m%d%H%M%S", localtime;
>
> I receive this error every time i try and use this code.
>
> Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday
>= -1, isdst = -1) at ./post-it.pl line 115, <STDIN> line 2.
Well, I'm not wise enough to actually know why, but based on manual page
Time::localtime(3) I'd suggest one of these:
1) do not use Time::localtime
2) don't let Time::localtime override default behaviour:
use Time::localtime qw();
$timestamp = strftime "%Y%m%d%H%M%S", localtime;
3) if you need Time::localtime elsewhere, try this:
$timestamp = strftime "%Y%m%d%H%M%S", CORE::localtime;
Any of these should work. Better ways may exist. I know them not yet. :)
--
Marko Vallius # http://iki.fi/markvall/
------------------------------
Date: Mon, 21 Apr 2003 10:11:51 -0500
From: Jeff D Gleixner <glex_nospam@qwest.net>
Subject: Re: TimeStamp - localtime
Message-Id: <vPToa.1812$fX1.46868@news.uswest.net>
> use Time::localtime;
> use POSIX 'strftime';
> sub CreateTS
> {
> $timestamp = strftime "%Y%m%d%H%M%S", localtime;
> return $timestamp;
> }
> I receive this error every time i try and use this code.
>
> Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday
> = -1, isdst = -1) at ./post-it.pl line 115, <STDIN> line 2.
>
> Can someone point me to the bright white light please ?
perldoc Time::localtime
It's not returning what you think it's returning.
------------------------------
Date: Mon, 21 Apr 2003 18:20:00 +0200
From: Winfried Koenig <w.koenig@acm.org>
Subject: Re: TimeStamp - localtime
Message-Id: <3EA41A30.9040700@acm.org>
rjh wrote:
> Hi,
>
> Im trying to assign a variable a timesatmp that i can use for writing
> modified
> times to a file.
> My Code,
>
> sub CreateTS
> {
> $timestamp = strftime "%Y%m%d%H%M%S", localtime;
> return $timestamp;
> }
>
>
> I receive this error every time i try and use this code.
>
> Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday
> = -1, isdst = -1) at ./post-it.pl line 115, <STDIN> line 2.
>
> Can someone point me to the bright white light please ?
>
> cheers.
try this simple subroutine:
sub CreateTS {
my @timestamp = reverse((localtime($_[0] || time))[0 .. 5]);
$timestamp[0] += 1900; $timestamp[1]++;
return sprintf("%04d%02d%02d%02d%02d%02d", @timestamp);
}
Winfried Koenig
------------------------------
Date: Mon, 21 Apr 2003 17:56:36 +0100
From: "Keith Awcock" <keith_awcock@blueyonder.co.uk>
Subject: Re: Trouble with LWP
Message-Id: <2jVoa.176$cC5.120@news-binary.blueyonder.co.uk>
"Bob Walton" <bwalton@rochester.rr.com> wrote in message
news:3EA311DF.2020406@rochester.rr.com...
> Kasp wrote:
>
> ...
> > Here is the code:
> >
> > use LWP::Simple;
> > getstore('http://www.perl.com/graphics/ora_logo.gif','ora_logo.gif');
> >
> > When I run this code, it gives me error:
> ...
>
>
> It works fine if you specify a URL that actually exists, like perhaps:
>
> http://www.perl.com/images/75-logo.jpg
>
> If you tested the return code from getstore, you would be informed of
> such failures. I tested your code on AS Perl 5.8.0 build 805 on Windoze
> 98SE.
> --
> Bob Walton
>
Yep a firewall certainly makes a difference. Assuming you're all
permissioned up you will need to set the proxy property on the user agent to
your firewall, a bit like this (not a perl pro so there might be a more
perlish way to do this):-
$br = new LWP::UserAgent;
$br->proxy(['http','ftp'], http://149.21.1.1);
$req=new HTTP::Request(GET, "http://www.perl.com/images/75-logo.jpg");
$doc=$br->request($req);
if ($doc->is_sucess) {
# do some funky perl
}
else {
# post again to comp.lan.perl.misc
}
Keith
------------------------------
Date: 21 Apr 2003 18:43:00 +0200
From: kaih=8kHgIcSHw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: Validating user input to match certain characters
Message-Id: <8kHgIcSHw-B@khms.westfalen.de>
usenet@NOSPAM.matthewb.org (Matthew Browning) wrote on 15.04.03 in <pan.2003.04.15.10.51.36.373296.895@NOSPAM.matthewb.org>:
> On Tue, 15 Apr 2003 10:34:09 +0100, Mark Smith wrote:
>
> > I have some Web forms that take user input. I process these in Perl.
> > What I want to do is limit what characters are valid for certain fields.
> > For example if the user creates a new account I would like to restrict
> > the account name to just A-Z, a-z, 0-9, _ and -.
> >
> > I have tried using the following:
> >
> > if ($accountname !~ m/([A-Za-z0-9_-])/) {
> > print "<B>ERROR: invalid chars, please re-enter</B>";
> > }
> >
> > However aslong as it finds at least one valid character the match fails
> > to output the error.
> >
>
> Your brackets are superfluous, unless you want to capture the match, and
> you are only asking to match one char. Try something like this:
>
> if ($accountname !~ m/[A-Za-z0-9_-]+/) {
> print "<strong>ERROR: invalid chars, please re-enter</strong>"
> }
If you go that way, the right thing is more like this:
if ($accountname !~ m/^[A-Za-z0-9_-]+$/) {
print "<strong>ERROR: invalid chars, please re-enter</strong>"
}
This one allows you to make more specific rules, of course, such as "it
has to be four to six letters optionally followed by up to three digits"
(don't as me why this exactly):
if ($accountname !~ m/^[A-Za-z]{4,6}[0-9]{0,3}$/) {
print "<strong>ERROR: invalid chars, please re-enter</strong>"
}
Kai
--
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
- Russ Allbery (rra@stanford.edu)
------------------------------
Date: Mon, 21 Apr 2003 17:05:24 +0200
From: "012" <motis@lyciumnetworks.com>
Subject: Writing to Exel files using Perl
Message-Id: <3ea3fad0$1@news.012.net.il>
Hi
I'm looking for examples/tutorials or anything that can help me update exel
file using perl script.
Thanks
Moti
mailto:motis@lyciumnetworks.com
------------------------------
Date: Mon, 21 Apr 2003 19:43:30 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: Writing to Exel files using Perl
Message-Id: <b80uat$uub$1@newsreader.mailgate.org>
Look by starting at the CPAN
http://search.cpan.org/search?dist=Spreadsheet-WriteExcel
http://search.cpan.org/search?dist=Spreadsheet-ParseExcel
http://search.cpan.org/search?mode=module&query=Excel
For a small tutorial... see http://perlmonks.org/?node_id=153486
HTH.
--
"Accept that some days you are the pigeon and some days the statue."
"A pat on the back is only a few inches from a kick in the butt." - Dilbert.
------------------------------
Date: Mon, 21 Apr 2003 15:15:20 +0100
From: Graham Drabble <graham.drabble@lineone.net>
Subject: Re: Writing to Exel files using Perl
Message-Id: <Xns93649B30033E3grahamdrabblelineone@ID-77355.user.dfncis.de>
On 21 Apr 2003 "012" <motis@lyciumnetworks.com> wrote in
news:3ea3fad0$1@news.012.net.il:
> Hi
> I'm looking for examples/tutorials or anything that can help me
> update exel file using perl script.
Have a look at the Spreadsheet::WriteExcel module. The documentation
has some examples at the end.
--
Graham Drabble
If you're interested in what goes on in other groups or want to find
an interesting group to read then check news.groups.reviews for what
others have to say or contribute a review for others to read.
------------------------------
Date: Mon, 21 Apr 2003 10:44:22 -0400
From: "Michele Ouellet" <ouellmi@videotron.ca>
Subject: Re: Writing to Exel files using Perl
Message-Id: <3TToa.16652$sU1.166377@weber.videotron.net>
> I'm looking for examples/tutorials or anything that can help me update
exel
> file using perl script.
What's in your toolbox?
The Win32::OLE package of the ActiveState distribution is a good place to
start.
They also have examples.
Michèle Ouellet.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 4871
***************************************