[31800] in Perl-Users-Digest
Perl-Users Digest, Issue: 3063 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 5 14:09:24 2010
Date: Thu, 5 Aug 2010 11:09:08 -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 Thu, 5 Aug 2010 Volume: 11 Number: 3063
Today's topics:
Convert string to date/time MS Access will accept at im <thomas@tifozi.net>
Re: Convert string to date/time MS Access will accept a <ben@morrow.me.uk>
Re: Extract variable length numbers (tab delimitered) f <sherm.pendley@gmail.com>
Re: Extract variable length numbers (tab delimitered) f <sherm.pendley@gmail.com>
Re: Extract variable length numbers (tab delimitered) f <tzz@lifelogs.com>
Re: I think an assertion might do this? <uri@StemSystems.com>
Re: I think an assertion might do this? <jimsgibson@gmail.com>
Re: I think an assertion might do this? <jimsgibson@gmail.com>
Re: I think an assertion might do this? <uri@StemSystems.com>
Main pod in CPAN module <marc.girod@gmail.com>
Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick u <nospam-abuse@ilyaz.org>
Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick u <nospam-abuse@ilyaz.org>
Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick u <klaus03@gmail.com>
Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick u <klaus03@gmail.com>
Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick u <ben@morrow.me.uk>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <justin.1007@purestblue.com>
Re: Storing array elements tab delimitered in a string <bugbear@trim_papermule.co.uk_trim>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 5 Aug 2010 02:17:33 +0200
From: "Thomas Andersson" <thomas@tifozi.net>
Subject: Convert string to date/time MS Access will accept at import
Message-Id: <8bue85FggkU1@mid.individual.net>
I have my data collector script finished now and it works fine. Now my
problem is that MS Access throws a hissyfit when I try to import my data. At
first I thought it was the AutoNumber field that caused it but it isn't as I
found the report saying that I get "Type Conversion Failure" on every filed
containing time info.
All my collected data have the time info stored in this format "Jul 28
18:34" (Tab delimitered) and now I guess I need to convert all those on the
fly before they are stored to something Access will accept.
Is there any (hopefully easy) way to do this?
Best Wishes
Thomas
------------------------------
Date: Thu, 5 Aug 2010 01:53:44 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Convert string to date/time MS Access will accept at import
Message-Id: <olepi7-m24.ln1@osiris.mauzo.dyndns.org>
Quoth "Thomas Andersson" <thomas@tifozi.net>:
> I have my data collector script finished now and it works fine. Now my
> problem is that MS Access throws a hissyfit when I try to import my data. At
> first I thought it was the AutoNumber field that caused it but it isn't as I
> found the report saying that I get "Type Conversion Failure" on every filed
> containing time info.
>
> All my collected data have the time info stored in this format "Jul 28
> 18:34" (Tab delimitered) and now I guess I need to convert all those on the
> fly before they are stored to something Access will accept.
>
> Is there any (hopefully easy) way to do this?
You will need to find out what format Access will accept. I'm afraid I
can't help you there. You will then need to parse those dates and
convert them into the appropriate format: as usual with Perl, there are
lots of ways to do this.
For a simple case like this, the Time::Piece module (bundled with Perl)
is probably sufficient. You use Time::Piece->strptime to parse the
dates, then $date->strftime to reformat them in a manner Access will
understand. Alternatives to Time::Piece include DateTime, an extremely
complete set of modules for doing all sorts of things with dates and
times.
Ben
------------------------------
Date: Wed, 04 Aug 2010 16:10:39 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Extract variable length numbers (tab delimitered) from a string?
Message-Id: <m262zqyw8w.fsf@sherm.shermpendley.com>
"Uri Guttman" <uri@StemSystems.com> writes:
>>>>>> "TM" == Tad McClellan <tadmc@seesig.invalid> writes:
>
> TM> Sherm Pendley <sherm.pendley@gmail.com> wrote:
> >> I've heard
> >> it said that debugging is twice as difficult as writing code, and that
> >> being the case, code that's written to the limit of one's abilities is
> >> by definition impossible to debug.
>
> TM> Everyone knows that debugging is twice as hard as writing a program in
> TM> the first place. So if you are as clever as you can be when you write
> TM> it, how will you ever debug it? ~Brian Kernighan
>
> TM> That Kernighan guy has a bit of a reputation amongst programmer types. :-)
>
> is twice as hard the same as twice the duration? i find i have a very
> different ratio of development time to debug time than many coders. i
> break it up into three periods and mine are roughly 40% design (much in
> my head), 40% coding and 20% debugging. and much of the debugging is
> very easy stuff (at least to me).
I'd estimate roughly the same. If debugging turns out to be exceptionally
difficult, I take it as evidence of a design flaw, and refactor until
the (re)design either eliminates the bug or makes it obvious. Of course,
the ability to refactor stems from having a sane and modular initial
design - that's where the up-front investment pays off big.
> i don't use a debugger, IDE or anything
> but print and i get working code without pain. brains over typing! :)
Agreed - I *very* rarely need to resort to single-stepping, breakpoints,
and the like. It's nice to know that they're available though, for those
rare occasions when I do need them.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Wed, 04 Aug 2010 16:13:38 -0400
From: Sherm Pendley <sherm.pendley@gmail.com>
Subject: Re: Extract variable length numbers (tab delimitered) from a string?
Message-Id: <m21vaeyw3x.fsf@sherm.shermpendley.com>
Ted Zlatanov <tzz@lifelogs.com> writes:
> On Wed, 04 Aug 2010 13:53:36 -0400 Sherm Pendley <sherm.pendley@gmail.com> wrote:
>
> SP> Also keep in mind that "fancy" solutions are rarely the best. I've heard
> SP> it said that debugging is twice as difficult as writing code, and that
> SP> being the case, code that's written to the limit of one's abilities is
> SP> by definition impossible to debug. In all but the most extreme cases,
> SP> clarity and ease of maintenance are *far* more valuable over the long
> SP> run than clever tricks.
>
> OTOH a programmer that doesn't explore new techniques is not growing (I
> mean technically; physically they grow with or without new techniques).
Sedentary desk jobs do tend to have that effect... :-)
> So there's value in exploration and cleverness.
Certainly, exploring edge cases is part of the learning process. When
it comes to production code, though, I find more value in simplicity.
sherm--
--
Sherm Pendley <www.shermpendley.com>
<www.camelbones.org>
Cocoa Developer
------------------------------
Date: Thu, 05 Aug 2010 08:07:15 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Extract variable length numbers (tab delimitered) from a string?
Message-Id: <87eied6we4.fsf@lifelogs.com>
On Wed, 04 Aug 2010 16:13:38 -0400 Sherm Pendley <sherm.pendley@gmail.com> wrote:
SP> Ted Zlatanov <tzz@lifelogs.com> writes:
>> So there's value in exploration and cleverness.
SP> Certainly, exploring edge cases is part of the learning process. When
SP> it comes to production code, though, I find more value in simplicity.
I mean in production too. Today's clever code is tomorrow's standard.
For example the Guttman Rossler transform at first was clever and
confusing (I've had to explain it to beginners more than once);
gradually it became established and today Perl 6 does it internally by
default.
The threshold IMO is not "is it clever" but "will the maintainer 5 years
from now hunt me down and kill me if he goes crazy." I thus tend to
avoid Quantum::Superpositions, on-the-fly parser generators, and "ha ha"
comments in production code :)
Ted
------------------------------
Date: Wed, 04 Aug 2010 17:42:08 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: I think an assertion might do this?
Message-Id: <87y6cmgimn.fsf@quad.sysarch.com>
>>>>> "P" == P <misterperl@gmail.com> writes:
P> On Aug 4, 9:59 am, Tad McClellan <ta...@seesig.invalid> wrote:
>> Mr P <misterp...@gmail.com> wrote:
>> > I wanted to replace any and all multiple sequential EOLs with a single
>> > one. This worked nicely:
>>
>> > (a) s/(\n)\n+/$1/g;
>>
>> You don't need regular expressions to do that:
>>
>> tr/\n/\n/s;
>> or
>> tr/\n//s;
>>
P> That's quite a surprising solution to me as I would not have thought
P> of tr// - I will monkey with it thanks.. I always thought of tr// as a
P> 1:1 mapping which is not what this is, so it seems un-natrual.
no, it seems very natural if you rtfm! it can also delete chars with the
/d option. both /s and /d are very useful and much faster than the
equivilent s/// ops.
P> As far as greed and quantifiers, requiring quantifiers makes no sense.
P> If I dont have the /g switch, the regex operates ONE TIME on the
P> scalar. If /g (regardless of quantifiers) it operates on the entire
P> scalar, as many times as it matches. And if it reset to the beginning
P> of the scalar AFTER each match, it would even work the same way as s/\n
P> \n*/\n/;
you don't get quantifiers then. they modify a single regex thing to
their left. s/\n+/\n/g is the simplest way to get what you want with
s///. note no grabbing is needed since you know the replacement will
just be a single \n. there are several variants with assertions i won't
go into.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Wed, 04 Aug 2010 15:32:19 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: I think an assertion might do this?
Message-Id: <040820101532194155%jimsgibson@gmail.com>
In article <87y6cmgimn.fsf@quad.sysarch.com>, Uri Guttman
<uri@StemSystems.com> wrote:
> >>>>> "P" == P <misterperl@gmail.com> writes:
>
> P> On Aug 4, 9:59 am, Tad McClellan <ta...@seesig.invalid> wrote:
> >> Mr P <misterp...@gmail.com> wrote:
> >> > I wanted to replace any and all multiple sequential EOLs with a single
> >> > one. This worked nicely:
> >>
> >> > (a) s/(\n)\n+/$1/g;
> >>
> >> You don't need regular expressions to do that:
> >>
> >> tr/\n/\n/s;
> >> or
> >> tr/\n//s;
> >>
> P> That's quite a surprising solution to me as I would not have thought
> P> of tr// - I will monkey with it thanks.. I always thought of tr// as a
> P> 1:1 mapping which is not what this is, so it seems un-natrual.
>
> no, it seems very natural if you rtfm! it can also delete chars with the
> /d option. both /s and /d are very useful and much faster than the
> equivilent s/// ops.
Sure, but poor old tr is a second-class citizen when it comes to
documentation. Look at 'perldoc -f tr'. Then please explain how tr ( or
s/// for that matter) is a "quote-like operator". You have to remember
to search for 'Transliterates' to get to the documentation for tr :(
I would extract the section in 'perldoc perlop' and put it in 'perldoc
-f tr'.
--
Jim Gibson
------------------------------
Date: Wed, 04 Aug 2010 15:37:24 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: I think an assertion might do this?
Message-Id: <040820101537242455%jimsgibson@gmail.com>
In article
<bad8265c-3ba5-40a3-9f74-531b10ac7925@x25g2000yqj.googlegroups.com>, Mr
P <misterperl@gmail.com> wrote:
> On Aug 4, 9:59 am, Tad McClellan <ta...@seesig.invalid> wrote:
> > Mr P <misterp...@gmail.com> wrote:
> > > I wanted to replace any and all multiple sequential EOLs with a single
> > > one. This worked nicely:
> >
> > > (a) s/(\n)\n+/$1/g;
> >
> > You don't need regular expressions to do that:
> >
> > tr/\n/\n/s;
> > or
> > tr/\n//s;
> >
> That's quite a surprising solution to me as I would not have thought
> of tr// - I will monkey with it thanks.. I always thought of tr// as a
> 1:1 mapping which is not what this is, so it seems un-natrual.
Yes, tr can be used as n:1 or 1:0 mappings, not just 1:1.
>
> >
> > I don't see how assertions can help with this problem...
>
> It seemed like a natural solution to me.
>
> start with /n/n/n
> s/(\n)\n/$1/ now you have \n\n.
> Which would MATCH again, IF the engine started at the scalar
> beginning (hence my use of the word RETRACE, and my thought that this
> was a LOOK-Behind case)..
If you want to redo a regular expression from the beginning of the
string and keep repeating it until it fails to match, put it in a while
loop:
while( s/(\n)\n/$1/g ) {
;
}
However, you have already been given the simplest solution using
regexes:
s/\n{2,}/\n/g;
which fixes your string in one pass, as do all the look-around
variations.
--
Jim Gibson
------------------------------
Date: Wed, 04 Aug 2010 19:33:37 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: I think an assertion might do this?
Message-Id: <87k4o6dkby.fsf@quad.sysarch.com>
>>>>> "JG" == Jim Gibson <jimsgibson@gmail.com> writes:
JG> Sure, but poor old tr is a second-class citizen when it comes to
JG> documentation. Look at 'perldoc -f tr'. Then please explain how tr ( or
JG> s/// for that matter) is a "quote-like operator". You have to remember
JG> to search for 'Transliterates' to get to the documentation for tr :(
tr/// is quote like because it can take alternate delimiters like all
the quote ops.
JG> I would extract the section in 'perldoc perlop' and put it in 'perldoc
JG> -f tr'.
and it is an operator not a function as it has operator syntax. you can
call it with () which all functions can be called with.
tr should be more well known and taught as it can do things s/// can't
do and most things it does is much faster. they are only related because
they are quotelike and share the use of =~.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
Date: Thu, 5 Aug 2010 11:03:28 -0700 (PDT)
From: Marc Girod <marc.girod@gmail.com>
Subject: Main pod in CPAN module
Message-Id: <8c23986a-a65a-41bc-af97-9022f076e05c@i24g2000yqa.googlegroups.com>
Hello,
Last time I updated my ClearCase::Wrapper::MGi module on CPAN, I made
one unfortunate error which had a result surprisiing to me: I added
one new pod file in the extra directory, named Configuration.pod.
My main documentation page is generated from the MGi.pm file, in the
top directory, and had been linked so far (i.e. until v 0.20) to the
ClearCase::Wrapper::MGi module line. E.g.:
http://search.cpan.org/~mgi/ClearCase-Wrapper-MGi-0.20/
Somehow, because of alphanumeric sorting order I presume,
Configuration.pod took over MGi.pm in:
http://search.cpan.org/~mgi/ClearCase-Wrapper-MGi-0.21/
In this page, clicking on ClearCase::Wrapper::MGi opens:
http://search.cpan.org/~mgi/ClearCase-Wrapper-MGi-0.21/extra/Configuration.pod
instead of the intended
http://search.cpan.org/~mgi/ClearCase-Wrapper-MGi-0.21/MGi.pm
So, what did I do wrong (failed to read what instructions), and how to
fix this properly in 0.22?
Thanks,
Marc
------------------------------
Date: Wed, 4 Aug 2010 21:03:02 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick up files in /bin
Message-Id: <slrni5jlc6.pc2.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-08-04, Klaus <klaus03@gmail.com> wrote:
> unless ($^O eq 'MSWin32' or $^O eq 'linux') {
> die "Error-0010: File::Vctools can only run on \$^O = 'MSWin32' or
> 'linux', but found \$^O = '$^O'";
> }
Why do you think so?!
Puzzled,
Ilya
------------------------------
Date: Wed, 4 Aug 2010 21:05:44 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick up files in /bin
Message-Id: <slrni5jlh8.pc2.nospam-abuse@powdermilk.math.berkeley.edu>
On 2010-08-04, Klaus <klaus03@gmail.com> wrote:
> The problem is that Makefile.PL / ExtUtils::MakeMaker refuses to pick
> up the *.pl files located in /bin.
>
> Is there an option that I can put into Makefile.PL so that the *.pl
> files in /bin are
> picked up by Makefile.PL ?
I do not know what you mean by "pick up"... Do you mean you want to
install some scripts? A lot of distributions do this; just look at
how they do this...
E.g., LWP, MP3::Tag...
Yours,
Ilya
------------------------------
Date: Thu, 5 Aug 2010 09:50:20 -0700 (PDT)
From: Klaus <klaus03@gmail.com>
Subject: Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick up files in /bin
Message-Id: <4fa55971-46ef-417d-a055-dda75ab0a58c@c10g2000yqi.googlegroups.com>
On 4 ao=FBt, 23:05, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> On 2010-08-04, Klaus <klau...@gmail.com> wrote:
>
> > The problem is that Makefile.PL / ExtUtils::MakeMaker refuses to pick
> > up the *.pl files located in /bin.
>
> > Is there an option that I can put into Makefile.PL so that the *.pl
> > files in /bin are
> > picked up by Makefile.PL ?
>
> I do not know what you mean by "pick up"... Do you mean you want to
> install some scripts?
Yes, I want to install some scripts.
> A lot of distributions do this; just look at
> how they do this...
>
> E.g., LWP, MP3::Tag...
Thanks for your hints, I've found that the following line in
Makefile.PL
EXE_FILES =3D> [ 'bin/vc_apply.pl', 'bin/vc_checkout.pl' ],
does what I want it to do.
I also found an excellent article "MakeMaker made easy" at
http://www.vromans.org/johan/articles/makemaker.html
------------------------------
Date: Thu, 5 Aug 2010 09:57:56 -0700 (PDT)
From: Klaus <klaus03@gmail.com>
Subject: Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick up files in /bin
Message-Id: <3ff4b911-f84c-4849-8fd4-a619e4fccc6a@i31g2000yqm.googlegroups.com>
On 4 ao=FBt, 23:03, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> On 2010-08-04, Klaus <klau...@gmail.com> wrote:
>
> > unless ($^O eq 'MSWin32' or $^O eq 'linux') {
> > =A0 =A0 die "Error-0010: File::Vctools can only run on \$^O =3D 'MSWin3=
2' or
> > 'linux', but found \$^O =3D '$^O'";
> > }
>
> Why do you think so?!
Well, the package "File::Vctools" installs some *.pl scripts that in
turn, generate other *.pl scripts, these "other" *.pl scripts call
system() with slashes (on Linux) or backslashes (on Windows) as a
directory separator.
The whole package could probably be simplified, but as it stands now,
it is horribly complicated.
It is difficult to control what separator has to be used. I managed to
test successfully on Linux and on Windows, but I don't have any other
operating system available, so guessing what separator works for which
other operating system would certainly be a waste of testers time
(even if it is just an automated test / test smoker)
------------------------------
Date: Thu, 5 Aug 2010 18:20:28 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Makefile.PL / ExtUtils::MakeMaker refuses to pick up files in /bin
Message-Id: <sf8ri7-bf1.ln1@osiris.mauzo.dyndns.org>
Quoth Klaus <klaus03@gmail.com>:
> On 4 août, 23:03, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> > On 2010-08-04, Klaus <klau...@gmail.com> wrote:
> >
> > > unless ($^O eq 'MSWin32' or $^O eq 'linux') {
> > > die "Error-0010: File::Vctools can only run on \$^O = 'MSWin32' or
> > > 'linux', but found \$^O = '$^O'";
> > > }
> >
> > Why do you think so?!
>
> Well, the package "File::Vctools" installs some *.pl scripts that in
> turn, generate other *.pl scripts, these "other" *.pl scripts call
> system() with slashes (on Linux) or backslashes (on Windows) as a
> directory separator.
Um, File::Spec? (Or modern alternatives, like Path::Class.)
Ben
------------------------------
Date: Thu, 5 Aug 2010 14:22:39 +0100
From: Justin C <justin.1007@purestblue.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
Message-Id: <vhqqi7-5qf.ln1@zem.masonsmusic.co.uk>
On 2010-08-04, Ralph Malph <ralph@happydays.com> wrote:
> On 8/4/2010 9:24 AM, Justin C wrote:
>> On 2010-08-03, Ralph Malph<ralph@happydays.com> wrote:
>>> tl, dnr
> too long, did not read
Yup, from your previous post on the subject I guessed that's what you
meant. Buy what you meant wasn't the reason for my post.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 05 Aug 2010 08:58:00 +0100
From: bugbear <bugbear@trim_papermule.co.uk_trim>
Subject: Re: Storing array elements tab delimitered in a string
Message-Id: <jJSdnUm4X4WU8sfRnZ2dnUVZ8kudnZ2d@brightview.co.uk>
Thomas Andersson wrote:
> bugbear wrote:
>
>>> I there an easy way to stora all elements of an array tab
>>> delimitered in a string (need to prepare collected data for import
>>> to a database).?
>> What import formats does your database support?
>
> MS Access 2007, the import itself should be a problem. I also realized that
> the array was not neccessary anyway, now I just concatenate the collected
> data with tabs inserted to a string that I later write out with linefeed to
> a txt file.
As long as there are no tabs in the data, yeah, that'll be fine.
BugBear
------------------------------
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 3063
***************************************