[32581] in Perl-Users-Digest
Perl-Users Digest, Issue: 3853 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 5 18:09:24 2013
Date: Sat, 5 Jan 2013 15:09:07 -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, 5 Jan 2013 Volume: 11 Number: 3853
Today's topics:
Re: Benefits for professional Perl programmers <edgrsprj@ix.netcom.com>
Re: Benefits for professional Perl programmers <news@lawshouse.org>
Re: Benefits for professional Perl programmers <jurgenex@hotmail.com>
Re: CGI Question <ben@morrow.me.uk>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: CGI Question <edgrsprj@ix.netcom.com>
Re: Date in CSV/TSV question <derykus@gmail.com>
Re: Date in CSV/TSV question <news@lawshouse.org>
Re: Date in CSV/TSV question <rweikusat@mssgmbh.com>
Re: Date in CSV/TSV question <nospam@lisse.NA>
Re: Date in CSV/TSV question <news@lawshouse.org>
Re: Date in CSV/TSV question <derykus@gmail.com>
Re: DESTROY gotcha <ben@morrow.me.uk>
Re: Sample program from Programming Perl (Camel book) n <hawk007@flight.us>
Re: Sample program from Programming Perl (Camel book) n <hawk007@flight.us>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 5 Jan 2013 13:58:25 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Benefits for professional Perl programmers
Message-Id: <bOydnbWoWbl9GHXNnZ2dnUVZ_gadnZ2d@earthlink.com>
"Henry Law" <news@lawshouse.org> wrote in message
news:XM6dncWjFLg4j3vNnZ2dnUVZ7vOdnZ2d@giganews.com...
> I didn't know that you could write FORTRAN in Perl.
That is a very early version of one of those programs. All of the
newer versions include elaborate Gnuplot control code. That early version
shows researchers how to do the basic calculations related to earthquake
triggering process etc. Even after a number of years, those equations are I
believe still by far the most advanced that can be found anywhere.
That effort got started with GW-Basic and at different times used
TrueBasic, FreeBasic, and a variety of other programs including Gnuplot.
Fortran was considered. Perl was finally chosen in part because it is
somewhat similar to Basic, is a freeware, supported language, and can be
used for CGI work. FreeBasic looked interesting. But it does not appear to
have much support.
A decision still needs to be made on a graphics program that will run
in connection with Perl on an Internet Server. Some version of Gnuplot is
supposed to work for that. But at the moment I am not sure if that is the
case.
------------------------------
Date: Sat, 05 Jan 2013 20:36:46 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: Benefits for professional Perl programmers
Message-Id: <EJedneiLCPJDE3XNnZ2dnUVZ8j2dnZ2d@giganews.com>
On 05/01/13 19:58, E.D.G. wrote:
> That is a very early version of one of those programs. All of
> the newer versions include elaborate Gnuplot control code.
Preserve us all, if the new code is anything like the old stuff. It's
totally unmaintainable, including by you after any significant time.
And if it there's an error in your logic then good luck with finding the
what's broken.
> That effort got started with GW-Basic and at different times used
> TrueBasic, FreeBasic, and a variety of other programs including Gnuplot.
That stacks up; the program I read looked as if it was converted from
some other language by someone who didn't speak either very well. I
thought the parent language looked like FORTRAN but if it was an early
BASIC that fits too.
> Perl was finally chosen in part because it is
> somewhat similar to Basic,
Correct. It can be written in an ASCII character set, it implements all
the normal computing language constructs like number types, control
loops and so on. But aside from those similarities it's, er, completely
different.
The problem you have is that you don't have a Perl program; you have a
BASIC program expressed in the subset of Perl language which does the
same things. That's why it would be totally unmaintainable by a Perl
programmer (without a vast and expensive initial familiarisation period,
at least): she would get totally lost by the appalling structure and the
astoundingly bad use of the language primitives.
And the idea that some of that code might run in a CGI environment,
where security is important and debugging requires a different approach,
fills me with horror.
> A decision still needs to be made on a graphics program that will
> run in connection with Perl on an Internet Server. Some version of
> Gnuplot is supposed to work for that. But at the moment I am not sure
> if that is the case.
Look at Chart::Graph::Gnuplot (hint: don't ask here if you don't know
how to do that). It implements only a subset of Gnuplot, so you'll have
to make sure that you can do what you want with what it provides. But
if you can then it can run server-side. It will only produce its output
as a graphic file which your CGI program will need to reference, but
that's simply a matter of generating <img src="/the/created/image"> tags.
I'm going to give you some advice, but from what I've read on the net
about people's opinions on your ability as an seismologist I fear you're
unlikely to listen to it.
You're a complete amateur at Perl programming (as I think you were at
other languages which you've played around with). Nobody in Perl-land
is going to take seriously anything you do, and people will rapidly tire
of trying to help you, since you're beyond help.
If you're serious about these Perl programs of yours then you either
need to start from the beginning, learn Perl properly, read some books
not just on Perl /language/ but on /programming/ and /operating
systems/. Then you're going to need to learn how to learn, especially
from other people.
Once you've done that then, and only then, can you hope to produce
proper /systems/ (not just programs) which will support the work of
these supposed "users" of yours, and also avoid further despoiling of
the internet by means of spam issued from your systems.
--
Henry Law Manchester, England
------------------------------
Date: Sat, 05 Jan 2013 14:28:58 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Benefits for professional Perl programmers
Message-Id: <ev9he8tt7sdol6bag8mes53saek921ikch@4ax.com>
Henry Law <news@lawshouse.org> wrote:
>On 05/01/13 19:58, E.D.G. wrote:
[...]
>If you're serious about these Perl programs of yours then you either
>need to start from the beginning, learn Perl properly, read some books
>not just on Perl /language/ but on /programming/ and /operating
>systems/. Then you're going to need to learn how to learn, especially
>from other people.
This advise has been given to him many times by many different people
for a long, long time. Unfortunately as I can see from the replies that
quote him he is still too smart to heed it.
jue
------------------------------
Date: Sat, 5 Jan 2013 01:16:27 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: CGI Question
Message-Id: <bgbkr9-i6r.ln1@anubis.morrow.me.uk>
Quoth Charlton Wilbur <cwilbur@chromatico.net>:
>
> There is a legitimate possibility that within 24 hours of you turning on
> this service, that your computer will be compromised and used as a
> kiddie porn distribution node.
>
> If you weren't aware that that could happen, let alone knowing how to
> prevent it or discover that it's going on and shut it down, you have no
> business telling us what you think will or will not be a problem.
s/telling.*/administering a computer system connected to the Internet./
Ben
------------------------------
Date: Sat, 5 Jan 2013 13:06:21 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <H_ednSAzQdo25HXNnZ2dnUVZ_ridnZ2d@earthlink.com>
"Scott Bryce" <sbryce@scottbryce.com> wrote in message
news:kbt0dl$pq3$1@dont-email.me...
> Don't do that. Move the password file to a directory above the document
> root where it cannot be accessed via the internet.
That does in fact work. And I am planning to use that procedure.
CGI programs on my server work a little differently than I expected.
And until I discovered what was taking place I kept encountering problems
with getting them to run.
------------------------------
Date: Sat, 5 Jan 2013 13:16:49 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <N72dncsBuueC4XXNnZ2dnUVZ_oednZ2d@earthlink.com>
"Charlton Wilbur" <cwilbur@chromatico.net> wrote in message
news:87vcbf1rud.fsf@new.chromatico.net...
> If you don't know enough to evaluate the original code and see that it
> is riddled with flaws, you don't know enough to improve its security
> when you modify it.
I never had any intention of going with the original code. I think
that the changes that have already been made to the code and ones that I am
planning to make will probably be adequate, at least for a start.
You might be surprised by some of those security features. I doubt
that there are any existing bulletin board programs that include code like
that. For obvious reasons, I don't want to say too much about what those
changes are.
------------------------------
Date: Sat, 5 Jan 2013 13:21:08 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <W-Gdna7NkN-_4HXNnZ2dnUVZ_gWdnZ2d@earthlink.com>
"Rainer Weikusat" <rweikusat@mssgmbh.com> wrote in message
news:8738yixahn.fsf@sapphire.mobileactivedefense.com...
> 'shared-medium ethernet' commonly known as WiFi. Especially since
> so-called 'open wireless hotspots' provided as a convenience to
> customers in public locations are not uncommon.
Thanks again. I know about the public access WiFi problems. And I
am planning to look into HTTPS options.
------------------------------
Date: Sat, 5 Jan 2013 13:26:13 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <S9KdnYAimubL43XNnZ2dnUVZ_sWdnZ2d@earthlink.com>
"Charlton Wilbur" <cwilbur@chromatico.net> wrote in message
news:87zk0pzxdv.fsf@new.chromatico.net...
> As I have pointed out repeatedly: it's not the half dozen people who are
> authorized to use this software who are using it legitimately that you
> have to worry about. It's the several hundred thousand hackers,
With humor intended, one thing that helps here is that most of my Web
site work is highly technical and extremely boring.
------------------------------
Date: Sat, 5 Jan 2013 13:34:01 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <S9qdnSfZ26C6HXXNnZ2dnUVZ_sidnZ2d@earthlink.com>
"Henry Law" <news@lawshouse.org> wrote in message
news:J-qdnczdi5DXlHvNnZ2dnUVZ8t-dnZ2d@giganews.com...
> There are fifteen scripts on that page, one of which is WWWBoard, as Jim
> suggested. It is a message board, which is what you want.
Thanks for the information. I just looked at the top of the Web page
and didn't look at the other sections in too much detail. I am going to
check that code to see if it will work for the application I am developing.
So far I have just been getting all of the directory and file structures
organized.
------------------------------
Date: Sat, 5 Jan 2013 14:18:41 -0600
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: CGI Question
Message-Id: <buudnTBFbp4CF3XNnZ2dnUVZ_uCdnZ2d@earthlink.com>
"E.D.G." <edgrsprj@ix.netcom.com> wrote in message
news:S9qdnSfZ26C6HXXNnZ2dnUVZ_sidnZ2d@earthlink.com...
> "Henry Law" <news@lawshouse.org> wrote in message
>> There are fifteen scripts on that page, one of which is WWWBoard, as Jim
>> suggested. It is a message board, which is what you want.
I downloaded that board file and checked the code. If I can get that
program to run with Xampp then that code will probably be used instead of
the earlier version of WWWboard. I can add my own modifications to that
version of the program.
I wonder why that newer program did not include a password option
with the bulletin board itself? My own modifications add that feature. I
am also making a number of different types of data entry screens and
probably display Web pages availailable. Using Perl for everything makes
that fairly easy to do.
------------------------------
Date: Sat, 5 Jan 2013 01:47:51 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Date in CSV/TSV question
Message-Id: <8cc7da6f-6dff-45f0-93ab-8dde46207a6c@googlegroups.com>
On Wednesday, January 2, 2013 7:37:02 AM UTC-8, Rainer Weikusat wrote:
> Dr Eberhard Lisse <nospam@lisse.NA> writes:
>
> > I have a Tab Separated File of roughly 1000 likes with the first fields like
>
> >
>
> > "07 Jan 2011" "TFR"
>
> > "05 Jan 2011" "DR"
>
> >
>
> > I need change the first field to look like
>
> >
>
> > 2011-01-07 "TFR"
>
> > 2011-01-05 "DR"
>
> >
>
> > for all lines, of course :-)-O
>
> >
>
> > Can someone point me to where I can read this up? Or send me a code
>
> > fragment?
>
>
>
> -----------
>
> %months = map { $_, sprintf('%02d', ++$n); } qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>
>
>
> while (<>) {
>
> s/^"(\d+)\s+(\S+)\s+(\d+)"/"$3-$months{$2}-$1"/;
>
> print;
>
> }
>
> -----------
Maybe even shrink it to a long one-liner:
perl -MDate::Manip -pi.bak -le 's{^"(\d+)\s+(\S+)\s+(\d+)"}
{"$3-" . UnixDate("$1 $2 $3","%m") . "-$1"}e' infile
--
Charles DeRykus
------------------------------
Date: Sat, 05 Jan 2013 11:07:58 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: Date in CSV/TSV question
Message-Id: <AvmdnUBfKfcTlHXNnZ2dnUVZ8sadnZ2d@giganews.com>
On 05/01/13 09:47, C.DeRykus wrote:
> On Wednesday, January 2, 2013 7:37:02 AM UTC-8, Rainer Weikusat wrote:
... something that I didn't read because RW is in my killfile
>
> Maybe even shrink it to a long one-liner:
>
> perl -MDate::Manip -pi.bak -le 's{^"(\d+)\s+(\S+)\s+(\d+)"}
> {"$3-" . UnixDate("$1 $2 $3","%m") . "-$1"}e' infile
>
But your response is very cool. That's much better than my effort!
In my defence, the user needs to be completely sure that every line of
data is in the expected format because your elegant one-liner has no
error checking.
--
Henry Law Manchester, England
------------------------------
Date: Sat, 05 Jan 2013 19:56:18 +0000
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: Date in CSV/TSV question
Message-Id: <87zk0n5rq5.fsf@sapphire.mobileactivedefense.com>
"C.DeRykus" <derykus@gmail.com> writes:
> On Wednesday, January 2, 2013 7:37:02 AM UTC-8, Rainer Weikusat wrote:
>> Dr Eberhard Lisse <nospam@lisse.NA> writes:
>> > I have a Tab Separated File of roughly 1000 likes with the first
>> fields like
>>
>> > "07 Jan 2011" "TFR"
>> > "05 Jan 2011" "DR"
>>
>>> 2011-01-07 "TFR"
>>> 2011-01-05 "DR"
[...]
>> -----------
>> %months = map { $_, sprintf('%02d', ++$n); } qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>>
>> while (<>) {
>> s/^"(\d+)\s+(\S+)\s+(\d+)"/"$3-$months{$2}-$1"/;
>> print;
>> }
>> -----------
>
> Maybe even shrink it to a long one-liner:
>
> perl -MDate::Manip -pi.bak -le 's{^"(\d+)\s+(\S+)\s+(\d+)"}
> {"$3-" . UnixDate("$1 $2 $3","%m") . "-$1"}e' infile
Considering the situation of the OP, he has a 'zero line' solution
because all code was written by someone else. I don't know how his is
for other people, however, I can type
qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
much faster than I can download anything from the net, especially
considering that I'd have to read to documentation for this anything,
too, making this a very bad tradeoff. And if I had to rely one someone
else's code for totally trivial stuff such as splitting a text file
with n 'somehow separated' data columns into an array, I would have a
very hard time solving the much more complicated problems I usually
need to deal with. Actually, I regularly search CPAN whenever I have a
reasonably complex and self-contained subtask of something that 'using
a module' if one existed would be a good idea. The most common result
of this searches, however, is 'nada', the second most common is some
totally bizarre implementation of 25% of the features I actually need
and the third 'implementation is total crap' aka 'IO::Poll' (and the
original author abandoned the code in question in 1975 in order to
become a missionary in Gabun or something like that).
CPAN is mostly a load of tripe resulting from fifteen years of bored
'hobbyists' (here supposed to mean people whose actual job isn't
programming) trying whatever weirdo-approach for solving fifty
different but vaguely related _trivial_ problems with the help of a
steam-engine powered motor umbrella constructed out of yellow,
magenta and purple lego bricks happened to come to their mind. And
downloading all these 'incredible machines' is - except in case of
500 SLOC throw-away 'oneliners' - not the end of the story: I have to
maintain the code because the people who use the software I'm
responsible for come to me with any problems resulting from that.
The rule of thumb I usually follow is that 'using a library' (or -
something I very much prefer - an already written program somebody
actually used to solve a real problem) is only worth the effort if it
saves a significant amount of work, at least something like 500 lines
of code and preferably, a few thousands. And even then, I end up
'maintaining' seriously byzantine workarounds for all the problems in
the 'free' code until I grow tired of that and replace it with
something which actually works (in the sense that it reliably does
what is needed to solve the problem I have to solve and nothing else)
more often than not.
------------------------------
Date: Sat, 05 Jan 2013 23:33:50 +0200
From: Dr Eberhard Lisse <nospam@lisse.NA>
Subject: Re: Date in CSV/TSV question
Message-Id: <50E89C3E.3040301@lisse.NA>
The OP is an elderly Obstetrician & Gynecologist, who occasionally needs
to Practically Extract and Report stuff.
el
On 2013-01-05 21:56 , Rainer Weikusat wrote:
> "C.DeRykus" <derykus@gmail.com> writes:
>> On Wednesday, January 2, 2013 7:37:02 AM UTC-8, Rainer Weikusat wrote:
>>> Dr Eberhard Lisse <nospam@lisse.NA> writes:
>>>> I have a Tab Separated File of roughly 1000 likes with the first
>>> fields like
>>>
>>>> "07 Jan 2011" "TFR"
>>>> "05 Jan 2011" "DR"
>>>
>>>> 2011-01-07 "TFR"
>>>> 2011-01-05 "DR"
>
> [...]
>
>>> -----------
>>> %months = map { $_, sprintf('%02d', ++$n); } qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>>>
>>> while (<>) {
>>> s/^"(\d+)\s+(\S+)\s+(\d+)"/"$3-$months{$2}-$1"/;
>>> print;
>>> }
>>> -----------
>>
>> Maybe even shrink it to a long one-liner:
>>
>> perl -MDate::Manip -pi.bak -le 's{^"(\d+)\s+(\S+)\s+(\d+)"}
>> {"$3-" . UnixDate("$1 $2 $3","%m") . "-$1"}e' infile
>
> Considering the situation of the OP, he has a 'zero line' solution
> because all code was written by someone else. I don't know how his is
> for other people, however, I can type
>
> qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
>
> much faster than I can download anything from the net, especially
> considering that I'd have to read to documentation for this anything,
> too, making this a very bad tradeoff. And if I had to rely one someone
> else's code for totally trivial stuff such as splitting a text file
> with n 'somehow separated' data columns into an array, I would have a
> very hard time solving the much more complicated problems I usually
> need to deal with. Actually, I regularly search CPAN whenever I have a
> reasonably complex and self-contained subtask of something that 'using
> a module' if one existed would be a good idea. The most common result
> of this searches, however, is 'nada', the second most common is some
> totally bizarre implementation of 25% of the features I actually need
> and the third 'implementation is total crap' aka 'IO::Poll' (and the
> original author abandoned the code in question in 1975 in order to
> become a missionary in Gabun or something like that).
>
> CPAN is mostly a load of tripe resulting from fifteen years of bored
> 'hobbyists' (here supposed to mean people whose actual job isn't
> programming) trying whatever weirdo-approach for solving fifty
> different but vaguely related _trivial_ problems with the help of a
> steam-engine powered motor umbrella constructed out of yellow,
> magenta and purple lego bricks happened to come to their mind. And
> downloading all these 'incredible machines' is - except in case of
> 500 SLOC throw-away 'oneliners' - not the end of the story: I have to
> maintain the code because the people who use the software I'm
> responsible for come to me with any problems resulting from that.
>
> The rule of thumb I usually follow is that 'using a library' (or -
> something I very much prefer - an already written program somebody
> actually used to solve a real problem) is only worth the effort if it
> saves a significant amount of work, at least something like 500 lines
> of code and preferably, a few thousands. And even then, I end up
> 'maintaining' seriously byzantine workarounds for all the problems in
> the 'free' code until I grow tired of that and replace it with
> something which actually works (in the sense that it reliably does
> what is needed to solve the problem I have to solve and nothing else)
> more often than not.
>
--
if you want to reply, replace nospam with my initials
------------------------------
Date: Sat, 05 Jan 2013 21:49:42 +0000
From: Henry Law <news@lawshouse.org>
Subject: Re: Date in CSV/TSV question
Message-Id: <U7CdneRZV_5rAnXNnZ2dnUVZ8lSdnZ2d@giganews.com>
On 05/01/13 21:33, Dr Eberhard Lisse wrote:
> The OP is an elderly Obstetrician & Gynecologist, who occasionally needs
> to Practically Extract and Report stuff.
By the way, Meinheer Doctor, you might be interested to know that quite
a lot of people who frequent this group won't have seen the article
which you followed up here, having decided some time ago to block posts
from its author at source.
I leave it to you to determine the significance of this.
PS I bet you're no more elderly than I am :-)
--
Henry Law Manchester, England
------------------------------
Date: Sat, 5 Jan 2013 13:51:41 -0800 (PST)
From: "C.DeRykus" <derykus@gmail.com>
Subject: Re: Date in CSV/TSV question
Message-Id: <8f1a7ede-2262-458a-b050-bd57d69681c1@googlegroups.com>
On Saturday, January 5, 2013 11:56:18 AM UTC-8, Rainer Weikusat wrote:
> "C.DeRykus" <derykus@gmail.com> writes:
>
> > On Wednesday, January 2, 2013 7:37:02 AM UTC-8, Rainer Weikusat wrote:
>
> >> Dr Eberhard Lisse <nospam@lisse.NA> writes:
>
> >> > I have a Tab Separated File of roughly 1000 likes with the first
>
> >> fields like
>
> >>
>
> >> > "07 Jan 2011" "TFR"
>
> >> > "05 Jan 2011" "DR"
>
> >>
>
> >>> 2011-01-07 "TFR"
>
> >>> 2011-01-05 "DR"
>
>
>
> [...]
>
>
>
> >> -----------
>
> >> %months = map { $_, sprintf('%02d', ++$n); } qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>
> >>
>
> >> while (<>) {
>
> >> s/^"(\d+)\s+(\S+)\s+(\d+)"/"$3-$months{$2}-$1"/;
>
> >> print;
>
> >> }
>
> >> -----------
>
> >
>
> > Maybe even shrink it to a long one-liner:
>
> >
>
> > perl -MDate::Manip -pi.bak -le 's{^"(\d+)\s+(\S+)\s+(\d+)"}
>
> > {"$3-" . UnixDate("$1 $2 $3","%m") . "-$1"}e' infile
>
>
>
> Considering the situation of the OP, he has a
> 'zero line' solution because all code was written
> by someone else.
Hm, it sounded like he just a separate tab-delimited
file he needed in a different format (ideal for a 1-
liner.) The -i switch is especially useful for just
this if the scenario allows it.
> I don't know how his
> for other people, however, I can type
>
> qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
>
> much faster than I can download anything from the net, especially
>
> considering that I'd have to read to documentation for this anything,
>
> too, making this a very bad tradeoff. And if I had to rely one someone
>
> else's code for totally trivial stuff such as splitting a text file
>
> with n 'somehow separated' data columns into an array, I would have a
>
> very hard time solving the much more complicated problems I usually
>
> need to deal with. Actually, I regularly search CPAN whenever I have a
>
> reasonably complex and self-contained subtask of something that 'using
>
> a module' if one existed would be a good idea. The most common result
>
> of this searches, however, is 'nada', the second most common is some
>
> totally bizarre implementation of 25% of the features I actually need
>
> and the third 'implementation is total crap' aka 'IO::Poll' (and the
>
> original author abandoned the code in question in 1975 in order to
>
> become a missionary in Gabun or something like that).
>
>
>
> CPAN is mostly a load of tripe resulting from fifteen years of bored
>
> 'hobbyists' (here supposed to mean people whose actual job isn't
>
> programming) trying whatever weirdo-approach for solving fifty
>
> different but vaguely related _trivial_ problems with the help of a
>
> steam-engine powered motor umbrella constructed out of yellow,
>
> magenta and purple lego bricks happened to come to their mind. And
>
> downloading all these 'incredible machines' is - except in case of
>
> 500 SLOC throw-away 'oneliners' - not the end of the story: I have to
>
> maintain the code because the people who use the software I'm
>
> responsible for come to me with any problems resulting from that.
>
>
>
> The rule of thumb I usually follow is that 'using a library' (or -
>
> something I very much prefer - an already written program somebody
>
> actually used to solve a real problem) is only worth the effort if it
>
> saves a significant amount of work, at least something like 500 lines
>
> of code and preferably, a few thousands. And even then, I end up
>
> 'maintaining' seriously byzantine workarounds for all the problems in
>
> the 'free' code until I grow tired of that and replace it with
>
> something which actually works (in the sense that it reliably does
>
> what is needed to solve the problem I have to solve and nothing else)
>
> more often than not.
I can appreciate your viewpoint. Date::Manip though
is well-maintained and extraordinarily useful. There
are several other very good Date modules as well.
Leveraging a small bit of module code for a tedious,
surprisingly frequent little chore appeals to the
very lazy. So, it's worth it IMO :)
--
Charles DeRykus
------------------------------
Date: Sat, 5 Jan 2013 01:14:22 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: DESTROY gotcha
Message-Id: <ecbkr9-i6r.ln1@anubis.morrow.me.uk>
Quoth "C.DeRykus" <derykus@gmail.com>:
>
> Hm, maybe eval and exit on error as a safeguard..?
Yes. Boring but probably the safest answer. Possibly inheriting or
importing DESTROY from a package which just safely wraps a call to a
method which does the actual destruction is the best answer.
> sub DESTROY
> {
> return if ${^GLOBAL_PHASE} eq 'DESTRUCT';
>
> eval {
> ...
> $_[2]->the_end_of_the_world_lost();
> ...
>
> };
> print "fatal error in DESTROY: $@" and exit 1 if $@;
*Especially* in a destructor you should be using Try::Tiny. Otherwise,
even though the DESTROY won't throw an exception, it will stomp on $@.
G_KEEPERR was definitely a rather poorly designed feature...
Ben
------------------------------
Date: Sat, 5 Jan 2013 00:53:40 -0800 (PST)
From: Andrew <hawk007@flight.us>
Subject: Re: Sample program from Programming Perl (Camel book) not running as expected
Message-Id: <e8da3b73-a309-45f5-b4e0-621a3e04d759@googlegroups.com>
>> >>
>
> >> >> > Check the line endings on the file. I don't know if the Windows Perl
>
> >> >> > implementation uses "\n" as a line ending as UNIX and MacOS versions of
>
> >> >> > Perl or "\r\n" for Windows standard.
I simply strip the carriage returns ("\t") whenever I get files of this type.
You can write a Perl script to batch-process your files, to simply strip the "\r", or you can use the command-line approach:
perl -pi.bak -e 's/\r//g' *.pl
------------------------------
Date: Sat, 5 Jan 2013 01:00:10 -0800 (PST)
From: Andrew <hawk007@flight.us>
Subject: Re: Sample program from Programming Perl (Camel book) not running as expected
Message-Id: <2d63e0ef-651c-4e52-af5e-e1a60323c2f5@googlegroups.com>
> I simply strip the carriage returns ("\t") whenever I get files of this type.
oops. Bad typo. I meant to write "\r", in both cases. Sorry.
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 3853
***************************************