[28776] in Perl-Users-Digest
Perl-Users Digest, Issue: 20 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 13 03:06:04 2007
Date: Sat, 13 Jan 2007 00:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 13 Jan 2007 Volume: 11 Number: 20
Today's topics:
Array Question <amerar@iwc.net>
Re: Array Question <someone@example.com>
Re: Array Question <john@castleamber.com>
Re: Extraction Fields from a file <someone@example.com>
Graph in Perl <anil.jupiter9@gmail.com>
How to map from Unix to Windows <minhaztuhin@hotmail.com>
Map Windows from Unix <minhaztuhin@hotmail.com>
Map Windows from Unix <minhaztuhin@hotmail.com>
new CPAN modules on Sat Jan 13 2007 (Randal Schwartz)
Re: Perl free e-books <tadmc@augustmail.com>
Re: Perl free e-books <john@castleamber.com>
Re: Perl free e-books <moya0901@126.com>
Re: Unix commands <john@castleamber.com>
Re: Unix commands <abigail@abigail.be>
Re: Unix commands <tadmc@augustmail.com>
Re: Unix commands <jurgenex@hotmail.com>
Re: Unix commands <john@castleamber.com>
Re: WWW:Mechanize single quotes around URL causes probl <randall.belk@knology.net>
Re: WWW:Mechanize single quotes around URL causes probl <spamtrap@dot-app.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 12 Jan 2007 15:35:49 -0800
From: "amerar@iwc.net" <amerar@iwc.net>
Subject: Array Question
Message-Id: <1168644945.973045.228590@l53g2000cwa.googlegroups.com>
Hey All,
Got a quick issue here. I have a script at work, it throws the
following error:
Argument "" isn't numeric in printf at ./saba.pl line 151, <BFILE> line
1.
Here is line 151:
printf FAN "@work_format\n",@d_ar;
Now, this is where it get crazy. @work_format is a FORMAT that looks
like this:
my @work_format=qw/%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s
%s %s %s %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
%.3f %.3f %.3f/;
My question is, how the hell do I know which element is throwing the
error?? I've dumped the array, which looks like this:
158: +000000000000000.000
159: +000000000000010.000
160: +000000000000000.000
161: +000000000002200.000
162: +000000000000000.000
163:
164: +000000000005000.000
165:
166: +000000000000000.000
Those are elements of the array. It works with all other records in
the file except for this one. How do I know which format is throwing
the error????
Can anyone help? I've been at this for 4 days now.....
Thanks in advance!!
------------------------------
Date: Sat, 13 Jan 2007 00:56:28 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Array Question
Message-Id: <07Wph.145353$YV4.120716@edtnps89>
amerar@iwc.net wrote:
>
> Got a quick issue here. I have a script at work, it throws the
> following error:
>
> Argument "" isn't numeric in printf at ./saba.pl line 151, <BFILE> line
> 1.
>
> Here is line 151:
>
> printf FAN "@work_format\n",@d_ar;
>
> Now, this is where it get crazy. @work_format is a FORMAT that looks
> like this:
>
> my @work_format=qw/%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s
> %s %s %s %.3f %.3f %.3f %.3f
> %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
> %.3f %.3f %.3f %.3f %.3f %.3f
[ snip ]
> %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
> %.3f %.3f %.3f/;
>
>
> My question is, how the hell do I know which element is throwing the
> error?? I've dumped the array, which looks like this:
>
> 158: +000000000000000.000
> 159: +000000000000010.000
> 160: +000000000000000.000
> 161: +000000000002200.000
> 162: +000000000000000.000
> 163:
> 164: +000000000005000.000
> 165:
> 166: +000000000000000.000
>
> Those are elements of the array. It works with all other records in
> the file except for this one. How do I know which format is throwing
> the error????
>
> Can anyone help? I've been at this for 4 days now.....
If you want to check the array for non-numbers:
use Scalar::Util 'looks_like_number';
print "Checking values in \@d_ar.\n";
for my $index ( 0 .. $#d_ar ) {
unless ( looks_like_number $d_ar[ $index ] ) {
print "Index at $index is not a number.\n";
}
}
If you want to get the printf format correct without the huge array:
my $work_format = join ' ', ( '%s' ) x 20, ( '%.3f' ) x ( @d_ar - 20 );
printf FAN "$work_format\n", @d_ar;
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: 13 Jan 2007 05:24:24 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Array Question
Message-Id: <Xns98B6EE1A54A37castleamber@130.133.1.4>
"amerar@iwc.net" <amerar@iwc.net> wrote:
> Now, this is where it get crazy.
> %s %s %s %.3f %.3f %.3f %.3f
> %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f
[ about 7+ more of this snipped ]
You can say that again :-)
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Sat, 13 Jan 2007 00:24:38 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Extraction Fields from a file
Message-Id: <aFVph.145350$YV4.67553@edtnps89>
usenet@DavidFilmer.com wrote:
> doni wrote:
>>I wanted to extract the 3rd field from every 2nd and 3rd line after
>>spaces from a file.
>
> my $linecount;
> while (<DATA>) {
> $linecount = (/^\s*$/) ? 0 : $linecount + 1; #reset count if
> empty
> if ($linecount == 2 || $linecount == 3) {
> print ( (split)[2] . "\n" ); #third field
> }
> }
while ( <DATA> ) {
$. = 0 unless /\S/;
print( (split)[2], "\n" ) if 2 .. 3;
}
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: 12 Jan 2007 20:44:46 -0800
From: "jupiter" <anil.jupiter9@gmail.com>
Subject: Graph in Perl
Message-Id: <1168663486.441056.325760@s34g2000cwa.googlegroups.com>
Hi
I am a beginner. s it possible to draw graph in perl in real time ?
@nil
------------------------------
Date: 12 Jan 2007 17:34:17 -0800
From: "Tuhin" <minhaztuhin@hotmail.com>
Subject: How to map from Unix to Windows
Message-Id: <1168652050.400064.262650@s34g2000cwa.googlegroups.com>
Hello every one,
Is it possible to map windows from unix? What I am trying to do:
1. First i will connect Unix(OS:Sun Solaries) from my PC (OS:Windows
XP)
2. Write a script in Perl (on Unix) to open the Windows Explorer on my
PC.
Any help/suggestion/code will be appreciated.
Thanks
Tuhin
------------------------------
Date: 12 Jan 2007 17:36:34 -0800
From: "Tuhin" <minhaztuhin@hotmail.com>
Subject: Map Windows from Unix
Message-Id: <1168652192.575360.165300@v45g2000cwv.googlegroups.com>
Forgot to mention that I am using Humming Bird on Demand to connect to
Unix from Windows.
------------------------------
Date: 12 Jan 2007 17:36:42 -0800
From: "Tuhin" <minhaztuhin@hotmail.com>
Subject: Map Windows from Unix
Message-Id: <1168652202.460423.269780@s34g2000cwa.googlegroups.com>
Forgot to mention that I am using Humming Bird on Demand to connect to
Unix from Windows.
Tuhin
------------------------------
Date: Sat, 13 Jan 2007 05:42:13 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jan 13 2007
Message-Id: <JBsL6D.24s7@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.
Business-AU-Data-ANZIC-0.01
http://search.cpan.org/~adamk/Business-AU-Data-ANZIC-0.01/
Australian New Zealand Standard Industrial Classification (ANZSIC) Codes
----
Catalyst-Plugin-Authentication-Store-RDBO-0.001
http://search.cpan.org/~uvoelker/Catalyst-Plugin-Authentication-Store-RDBO-0.001/
Authentication and authorization against a Rose::DB::Object model.
----
Catalyst-Plugin-Authentication-Store-RDBO-0.002
http://search.cpan.org/~uvoelker/Catalyst-Plugin-Authentication-Store-RDBO-0.002/
Authentication and authorization against a Rose::DB::Object model.
----
Class-Simple-0.05
http://search.cpan.org/~sullivan/Class-Simple-0.05/
Simple Object-Oriented Base Class
----
Config-Model-0.607
http://search.cpan.org/~ddumont/Config-Model-0.607/
Model to create configuration validation tool
----
DBIx-CopyRecord-0.004
http://search.cpan.org/~jackb/DBIx-CopyRecord-0.004/
Perl module for copying records in databases within same table including all child tables;
----
Data-ICal-0.12
http://search.cpan.org/~jesse/Data-ICal-0.12/
Generates iCalendar (RFC 2445) calendar files
----
EnsEMBL-Web-Record-1.01
http://search.cpan.org/~mjw/EnsEMBL-Web-Record-1.01/
A family of modules used for managing a user's persistant data in a database.
----
Finance-Math-IRR-0.05
http://search.cpan.org/~erwan/Finance-Math-IRR-0.05/
Calculate the internal rate of return of a cash flow
----
Geo-Functions-0.05
http://search.cpan.org/~mrdvt/Geo-Functions-0.05/
Package for standard Geo:: functions.
----
HTML-Parser-3.56
http://search.cpan.org/~gaas/HTML-Parser-3.56/
HTML parser class
----
Imager-Screenshot-0.003
http://search.cpan.org/~tonyc/Imager-Screenshot-0.003/
screenshot to an Imager image
----
Math-Polynom-0.05
http://search.cpan.org/~erwan/Math-Polynom-0.05/
Operations on polynoms
----
Math-Symbolic-0.505
http://search.cpan.org/~smueller/Math-Symbolic-0.505/
Symbolic calculations
----
Mozilla-SourceViewer-0.01
http://search.cpan.org/~bosu/Mozilla-SourceViewer-0.01/
Perl extension to get current page source.
----
Net-SIP-0.13
http://search.cpan.org/~sullr/Net-SIP-0.13/
Framework SIP (Voice Over IP, RFC3261)
----
Net-TiVo-0.07
http://search.cpan.org/~boumenot/Net-TiVo-0.07/
Perl interface to TiVo.
----
PAR-0.971
http://search.cpan.org/~smueller/PAR-0.971/
Perl Archive Toolkit
----
RPC-Xmlrpc_c-1.02
http://search.cpan.org/~giraffed/RPC-Xmlrpc_c-1.02/
----
SNMP-Trapinfo-0.92
http://search.cpan.org/~tonvoon/SNMP-Trapinfo-0.92/
Read and process an SNMP trap from Net-SNMP's snmptrapd
----
SVN-Web-0.5
http://search.cpan.org/~nikc/SVN-Web-0.5/
Subversion repository web frontend
----
Statistics-Smoothing-SGT-2.0.9
http://search.cpan.org/~bjoernw/Statistics-Smoothing-SGT-2.0.9/
A Simple Good-Turing (SGT) smoothing implementation
----
Tk-TableMatrix-1.23
http://search.cpan.org/~cerney/Tk-TableMatrix-1.23/
----
UUID-0.03
http://search.cpan.org/~cfaber/UUID-0.03/
Perl extension for using UUID interfaces as defined in e2fsprogs.
----
libuuid-perl_0.02.orig
http://search.cpan.org/~cfaber/libuuid-perl_0.02.orig/
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/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 12 Jan 2007 17:40:43 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl free e-books
Message-Id: <slrneqg73r.n8s.tadmc@tadmc30.august.net>
Shuo Shi <moya0901@126.com> wrote:
> I just wanna make the format of my message as "Times New Roman", not the
> default format of Plain Text file.
Please stop wanting that.
_You_ want Times New Roman, not us.
Good luck convincing everybody to switch to Your Way.
An author does not write for himself but for his audience.
And putting a full-quote below the .sig separator is beyond the pale.
Please go away.
*plonk*
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 13 Jan 2007 05:20:20 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Perl free e-books
Message-Id: <Xns98B6ED6999E8Dcastleamber@130.133.1.4>
Tad McClellan <tadmc@augustmail.com> wrote:
> An author does not write for himself but for his audience.
I doubt if this is the case in general. I am sure there are plenty of
authors who write for themselves and don't care about his/her audience.
And then there are authors who write for the money.
> Please go away.
>
> *plonk*
Yup, my arm got tired as well from swinging the clue bat. And I did use an
aluminum one. Maybe a solid wood version would have been better?
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Sat, 13 Jan 2007 14:53:07 +0800
From: "Shuo Shi" <moya0901@126.com>
Subject: Re: Perl free e-books
Message-Id: <eo9ut6$qk9$1@az33news01.freescale.net>
I am not sure whether your patience has been exhausted, I am amazed about
it, I was trying to keep myself as a gentleman, all words of mine are nice.
And I only tried to choose the HTML formate to edit my news message for one
time! Since you and others suggested me to use PLAIN TEXT, then I accept it,
am not sure whether you are consistently saying my message as HTML! It is
NOT TRUE!
I love most of people in this news group since most of them are nice. I
believe you are also a nice person, I wanna keep the harmony here, so really
don't know you are getting BAD TEMPER !!! So CALM DOWN! You have grown up!!!
"Uri Guttman" <uri@stemsystems.com> wrote in message
news:x7fyagw7m7.fsf@mail.sysarch.com...
>>>>>> "SS" == Shuo Shi <moya0901@126.com> writes:
>
> SS> I just wanna make the format of my message as "Times New Roman", not
> the
> SS> default format of Plain Text file.
>
> STOP TOP POSTING.
>
> and usenet is a PLAIN TEXT only medium. no one cares about your
> formatting requests. html IS NOT ACCEPTED.
>
> THE BOOK I TOLD YOU IS FREE. it SAYS that on the page. the author has
> MADE IT FREE FOR YEARS. DO YOU UNDERSTAND?
>
> you have exhausted my patience. you seem to understand english well
> enough but you are not listening.
>
> uri
>
> --
> Uri Guttman ------ uri@stemsystems.com --------
> http://www.stemsystems.com
> --Perl Consulting, Stem Development, Systems Architecture, Design and
> Coding-
> Search or Offer Perl Jobs ----------------------------
> http://jobs.perl.org
------------------------------
Date: 12 Jan 2007 23:22:47 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Unix commands
Message-Id: <Xns98B6B0CB3A0D1castleamber@130.133.1.4>
usenet@DavidFilmer.com wrote:
> Kim Gardiner CS2003 wrote:
>> Can you issue UNIX commands using Perl?
>
> You can, but it's often a bad idea.
Huh!? Why?
> Some folks treat Perl like a glorified korn shell, and do ghastly
> things like this:
> my @data = `cat somefile.txt`;
>
> or
> my @files = `ls /some/directory`;
>
> Perl has built-in functions for a lot of stuff you might be tempted to
> use shell commands for. It's generally preferable to use Perl when you
> write Perl programs.
Depends on what you're doing of course. Why would I copy a program that
does already its work perfectly and reinvent the wheel? Increase
development time, and make many mistakes while doing so?
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 12 Jan 2007 23:43:58 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Unix commands
Message-Id: <slrneqg79p.ge.abigail@alexandra.abigail.be>
usenet@DavidFilmer.com (usenet@DavidFilmer.com) wrote on MMMMDCCCLXXXII
September MCMXCIII in <URL:news:1168642359.678399.206030@38g2000cwa.googlegroups.com>:
?? Kim Gardiner CS2003 wrote:
?? > Can you issue UNIX commands using Perl?
??
?? You can, but it's often a bad idea.
Really? You have something against code reuse?
?? Some folks treat Perl like a glorified korn shell, and do ghastly
?? things like this:
?? my @data = `cat somefile.txt`;
What's so ghastly about that? I often write
my $text = `cat file`;
instead of
my $text;
{
local $/;
open my $fh => "<", 'file' or die "open: $!";
$text = <$fh>;
}
which takes 6 lines instead of 1. Even if you don't count the lines
that delimit the block, you still end up with four times as many lines.
Of course, one could do it in one "line" of Perl:
my $text = do {local (@ARGV, $/) = 'file'; <>;};
but I think that `cat file` is much clearer.
?? or
?? my @files = `ls /some/directory`;
That surely beats:
opendir my $dh => '/some/directory' or die "opendir: $!";
my @files = grep {!/^\./} readdir $dh;
closedir $dh;
which takes three times as many lines.
?? Perl has built-in functions for a lot of stuff you might be tempted to
?? use shell commands for. It's generally preferable to use Perl when you
?? write Perl programs.
Agreed, but the for the examples you mention, Perl *doesn't* have buildins.
Tools I often call from Perl and for which Perl equivalents could be used
include (but aren't limited to): mv, cp, rm, mkdir, cat, mail, ls, uname, ...
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Fri, 12 Jan 2007 17:28:38 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Unix commands
Message-Id: <slrneqg6d6.n8s.tadmc@tadmc30.august.net>
tfe <tfeserver@gmail.com> wrote:
> Kim Gardiner CS2003 ha escrito:
>
>> Can you issue UNIX commands using Perl?
> Sure and "there is more than one way to do it" ...
> qx! command with args!;
> system("Command","arg1","arg2",...);
> `command with args`
> open(PIPE, "command |");
The 1st one and the 3rd one are the same one.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 13 Jan 2007 01:11:42 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Unix commands
Message-Id: <ilWph.592$Ch1.531@trndny04>
Warren Block wrote:
> Jürgen Exner <jurgenex@hotmail.com> wrote:
>> Kim Gardiner CS2003 wrote:
>>> Can you issue UNIX commands using Perl?
>>
>> Sure you can, provided your operating system supports them.
>
> Even if it doesn't, you can still issue them.
Well, guess that's true ;-)
jue
------------------------------
Date: 13 Jan 2007 05:18:12 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Unix commands
Message-Id: <Xns98B6ED0CD500Bcastleamber@130.133.1.4>
Andrew DeFaria <Andrew@DeFaria.com> wrote:
> John Bokma wrote:
>>> Some folks treat Perl like a glorified korn shell, and do ghastly
>>> things like this:
>>> my @data = `cat somefile.txt`;
>>>
>>> or
>>> my @files = `ls /some/directory`;
>>>
>>> Perl has built-in functions for a lot of stuff you might be tempted
>>> to use shell commands for. It's generally preferable to use Perl
>>> when you write Perl programs.
>> Depends on what you're doing of course. Why would I copy a program
>> that does already its work perfectly and reinvent the wheel? Increase
>> development time, and make many mistakes while doing so?
> Because 1) it's inefficient in that you are forking and exec'ing a
> process to do it
Depends a lot on what the task is doing of course. Or do you base this
all on the example David (don't remove attribution lines if you quote)
gave?
> and 2) portability
As always, instead of using a dumb set of fixed rules (never use shell
commands because: fork overhead and non portable) one has to consider
everything. For most of the stuff I write fork overhead is a non-issue
as is portability.
> - there's no guarantee that the
> next platform you port this to has the same commands.
There is no guarantee that what I write is going to be ported at all.
> For example, you
> use "ls" above.
I didn't. Moreover, it's just an example.
> But there is no "ls" under Windows.
Yup, like there is no perl under Windows.
C:\Documents and Settings\John\My Documents\Amber\Sites\johnbokma.com
\site\web>ls -al *.png
-rw-rw-rw- 1 user group 13112 Nov 13 2005 bokma-gnu.png
-rw-rw-rw- 1 user group 108 Nov 13 2005 dash.png
See: http://johnbokma.com/mexit/2006/07/01/
> If instead you use
> a more Perl like way your Perl script will immediately port without
> and issue.
Not all Perl scripts are used on different platforms. Most I write
aren't. But like I said, it's a non-issue if the external program is
ported to the target platform(s) as well.
For example I now and then use wget via Perl. The fork issue is a non
issue IMSHO. And if my customer wants to run it on Windows he gets
instructions on how to install wget (see previous link).
I rather do that then waste his/her valuable time and money on making a
wget clone if wget does /exactly/ what is required.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: 12 Jan 2007 20:25:42 -0800
From: "Randall" <randall.belk@knology.net>
Subject: Re: WWW:Mechanize single quotes around URL causes problem
Message-Id: <1168662341.815208.288090@m58g2000cwm.googlegroups.com>
Thanks for pointing me in the right direction. I guess I haven't ever
run into a situation where I had to dig into the module code before. I
redefined _link_from_token in my program and all is well now. That way
I don't have to change the way I use Mechanize and I can take it out if
this gets fixed.
------------------------------
Date: Fri, 12 Jan 2007 23:39:59 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: WWW:Mechanize single quotes around URL causes problem
Message-Id: <m2k5zrbkv4.fsf@Sherm-Pendleys-Computer.local>
"Randall" <randall.belk@knology.net> writes:
> Thanks for pointing me in the right direction. I guess I haven't ever
> run into a situation where I had to dig into the module code before. I
> redefined _link_from_token in my program and all is well now. That way
> I don't have to change the way I use Mechanize and I can take it out if
> this gets fixed.
If you've already fixed it, why not send a patch to the module's author?
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
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 20
*************************************