From davidnicol at gmail.com Wed Sep 5 12:11:27 2007
From: davidnicol at gmail.com (David Nicol)
Date: Wed, 5 Sep 2007 14:11:27 -0500
Subject: [Kc] tolkein and testing
Message-ID: <934f64a20709051211n73105589q34df2784dde4f8db@mail.gmail.com>
From ironicface at earthlink.net Wed Sep 5 12:02:11 2007
From: ironicface at earthlink.net (Teal)
Date: Wed, 05 Sep 2007 14:02:11 -0500
Subject: [Kc] tolkein and testing
In-Reply-To: <934f64a20709051211n73105589q34df2784dde4f8db@mail.gmail.com>
References: <934f64a20709051211n73105589q34df2784dde4f8db@mail.gmail.com>
Message-ID: <46DEFD33.7060006@earthlink.net>
David Nicol wrote:
>
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.w3.org/2001/vxml
> http://www.w3.org/TR/voicexml20/vxml.xsd"
> version="2.0">
>
>
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
--
Five minutes of Silence,
Meditate. Breathe. Be Alive.
From amoore at mooresystems.com Tue Sep 11 06:44:42 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Tue, 11 Sep 2007 08:44:42 -0500
Subject: [Kc] Any interest in a meeting tonight?
Message-ID: <20070911134442.GB18801@mooresystems.com>
The mailing list has been rather slow this month, so I'm not sure if
there's much interest in a meeting tonight. If you are interested,
please holler and I bet we can put together 3 or 4 of us.
I think I have a spare copy of _Perl Best Practices_ that I can
bring. I'll either give it to anyone who's willing to read it and talk
about it in a coming month, or I can scan through it and point out
some of my favorite or the more controversial policies.
Speak up if you would like to get together tonight at Planet Sub at
50th and Main at 7pm.
-Andy
From djgoku at gmail.com Tue Sep 11 09:48:21 2007
From: djgoku at gmail.com (djgoku)
Date: Tue, 11 Sep 2007 11:48:21 -0500
Subject: [Kc] Any interest in a meeting tonight?
In-Reply-To: <20070911134442.GB18801@mooresystems.com>
References: <20070911134442.GB18801@mooresystems.com>
Message-ID: <99dd19c90709110948h2f900c19vb7c6bbe065223489@mail.gmail.com>
On 9/11/07, Andrew Moore wrote:
>
> The mailing list has been rather slow this month, so I'm not sure if
> there's much interest in a meeting tonight. If you are interested,
> please holler and I bet we can put together 3 or 4 of us.
>
> I think I have a spare copy of _Perl Best Practices_ that I can
> bring. I'll either give it to anyone who's willing to read it and talk
> about it in a coming month, or I can scan through it and point out
> some of my favorite or the more controversial policies.
>
> Speak up if you would like to get together tonight at Planet Sub at
> 50th and Main at 7pm.
I am not sure I can make it.
From stephenclouse at gmail.com Tue Sep 11 10:34:27 2007
From: stephenclouse at gmail.com (Stephen Clouse)
Date: Tue, 11 Sep 2007 12:34:27 -0500
Subject: [Kc] Any interest in a meeting tonight?
In-Reply-To: <20070911134442.GB18801@mooresystems.com>
References: <20070911134442.GB18801@mooresystems.com>
Message-ID: <5d0ee2170709111034la183c92pd4dfc0494adc85e0@mail.gmail.com>
On 9/11/07, Andrew Moore wrote:
> The mailing list has been rather slow this month, so I'm not sure if
> there's much interest in a meeting tonight. If you are interested,
> please holler and I bet we can put together 3 or 4 of us.
It's on my calendar. But I'd like to know if people will show before I
drive all the way from Olathe.
--
Stephen Clouse
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070911/0a35f684/attachment.html
From amoore at mooresystems.com Tue Sep 11 14:32:16 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Tue, 11 Sep 2007 16:32:16 -0500
Subject: [Kc] Any interest in a meeting tonight?
In-Reply-To: <20070911134442.GB18801@mooresystems.com>
References: <20070911134442.GB18801@mooresystems.com>
Message-ID: <20070911213216.GA22228@mooresystems.com>
With one "Maybe" and one "not sure", I think we'd better cancel this
month.
I'll try to put something together for next month. Suggestions welcome.
-A
On Tue, Sep 11, 2007 at 08:44:42AM -0500, Andrew Moore wrote:
>
> The mailing list has been rather slow this month, so I'm not sure if
> there's much interest in a meeting tonight. If you are interested,
> please holler and I bet we can put together 3 or 4 of us.
>
> I think I have a spare copy of _Perl Best Practices_ that I can
> bring. I'll either give it to anyone who's willing to read it and talk
> about it in a coming month, or I can scan through it and point out
> some of my favorite or the more controversial policies.
>
> Speak up if you would like to get together tonight at Planet Sub at
> 50th and Main at 7pm.
>
> -Andy
>
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
From davidnicol at gmail.com Tue Sep 11 17:34:16 2007
From: davidnicol at gmail.com (David Nicol)
Date: Tue, 11 Sep 2007 19:34:16 -0500
Subject: [Kc] move to california, work for Google
Message-ID: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
I have been asked to forward this link to local mailing lists
so here it is. Recruiter contact available on request.
http://www.google.com/support/jobs/bin/answer.py?answer=23591
From ggoebel at goebel.ws Wed Sep 12 06:08:23 2007
From: ggoebel at goebel.ws (Garrett Goebel)
Date: Wed, 12 Sep 2007 09:08:23 -0400
Subject: [Kc] move to california, work for Google
In-Reply-To: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
References: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
Message-ID:
I went through their interview process a while back. I wasn't what
they were looking for :(
I got the impression that they aren't really all that interested in
Perl.
cheers,
Garrett
On Sep 11, 2007, at 8:34 PM, David Nicol wrote:
> I have been asked to forward this link to local mailing lists
> so here it is. Recruiter contact available on request.
> http://www.google.com/support/jobs/bin/answer.py?answer=23591
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
From djgoku at gmail.com Wed Sep 12 12:51:13 2007
From: djgoku at gmail.com (djgoku)
Date: Wed, 12 Sep 2007 14:51:13 -0500
Subject: [Kc] move to california, work for Google
In-Reply-To:
References: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
Message-ID: <99dd19c90709121251h61a63eedg583881567890d3af@mail.gmail.com>
On 9/12/07, Garrett Goebel wrote:
> I went through their interview process a while back. I wasn't what
> they were looking for :(
>
> I got the impression that they aren't really all that interested in
> Perl.
That a shame. I wonder why it is even on the list.
On another note it seems this same thing happens in ACM programming
contest where you are only able to use C/C++ or Java. Though in
regional competitions it states you can use additional languages.
Jonathan
From sparling at uclick.com Wed Sep 12 13:08:18 2007
From: sparling at uclick.com (Doug Sparling)
Date: Wed, 12 Sep 2007 13:08:18 -0700
Subject: [Kc] move to california, work for Google
In-Reply-To: <99dd19c90709121251h61a63eedg583881567890d3af@mail.gmail.com>
References: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
<99dd19c90709121251h61a63eedg583881567890d3af@mail.gmail.com>
Message-ID: <20070912130818.kgo48w0w88w8s8cs@www.webmail4.com>
Quoting djgoku :
> On 9/12/07, Garrett Goebel wrote:
> > I went through their interview process a while back. I wasn't what
> > they were looking for :(
> >
> > I got the impression that they aren't really all that interested in
> > Perl.
>
> That a shame. I wonder why it is even on the list.
Not sure either. According to Steve Yegge's blog (he works for Google and did
the "Rhino on Rails" project earlier this year), Google only has four
sanctioned languages: C++, Java, Python, and JavaScript.
From jmreinke at gmail.com Wed Sep 12 14:32:20 2007
From: jmreinke at gmail.com (John Reinke)
Date: Wed, 12 Sep 2007 16:32:20 -0500
Subject: [Kc] move to california, work for Google
In-Reply-To: <20070912130818.kgo48w0w88w8s8cs@www.webmail4.com>
References: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
<99dd19c90709121251h61a63eedg583881567890d3af@mail.gmail.com>
<20070912130818.kgo48w0w88w8s8cs@www.webmail4.com>
Message-ID: <7236b0a60709121432m14716015obb5be856e3225f8c@mail.gmail.com>
FWIW, I believe Guido van Rossum now works for Google, which further cements
the Python connection.
On 9/12/07, Doug Sparling wrote:
>
> Quoting djgoku :
>
> > On 9/12/07, Garrett Goebel wrote:
> > > I went through their interview process a while back. I wasn't what
> > > they were looking for :(
> > >
> > > I got the impression that they aren't really all that interested in
> > > Perl.
> >
> > That a shame. I wonder why it is even on the list.
>
> Not sure either. According to Steve Yegge's blog (he works for Google and
> did
> the "Rhino on Rails" project earlier this year), Google only has four
> sanctioned languages: C++, Java, Python, and JavaScript.
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070912/82b72f05/attachment.html
From sparling at uclick.com Wed Sep 12 15:23:44 2007
From: sparling at uclick.com (Doug Sparling)
Date: Wed, 12 Sep 2007 15:23:44 -0700
Subject: [Kc] move to california, work for Google
In-Reply-To: <7236b0a60709121432m14716015obb5be856e3225f8c@mail.gmail.com>
References: <934f64a20709111734g4aa5c0dch174de4eac399d544@mail.gmail.com>
<99dd19c90709121251h61a63eedg583881567890d3af@mail.gmail.com>
<20070912130818.kgo48w0w88w8s8cs@www.webmail4.com>
<7236b0a60709121432m14716015obb5be856e3225f8c@mail.gmail.com>
Message-ID: <20070912152344.os8kc88gww8sccso@www.webmail4.com>
YouTube runs on Python as well, I believe...
Quoting John Reinke :
> FWIW, I believe Guido van Rossum now works for Google, which further cements
> the Python connection.
>
> On 9/12/07, Doug Sparling wrote:
> >
> > Quoting djgoku :
> >
> > > On 9/12/07, Garrett Goebel wrote:
> > > > I went through their interview process a while back. I wasn't what
> > > > they were looking for :(
> > > >
> > > > I got the impression that they aren't really all that interested in
> > > > Perl.
> > >
> > > That a shame. I wonder why it is even on the list.
> >
> > Not sure either. According to Steve Yegge's blog (he works for Google and
> > did
> > the "Rhino on Rails" project earlier this year), Google only has four
> > sanctioned languages: C++, Java, Python, and JavaScript.
> > _______________________________________________
> > kc mailing list
> > kc at pm.org
> > http://mail.pm.org/mailman/listinfo/kc
> >
>
From paul.millard at gmail.com Thu Sep 13 12:10:22 2007
From: paul.millard at gmail.com (Paul Millard)
Date: Thu, 13 Sep 2007 14:10:22 -0500
Subject: [Kc] kc Digest, Vol 47, Issue 4
In-Reply-To:
References:
Message-ID: <521c89c20709131210m7574369ep3bc62ccead6c9b9c@mail.gmail.com>
That is true. I was the Google Appliances admin for USDA for a while, and
with Guido working at Google, they were actively moving away from Perl.
They still hire Perl developers who are interested in switching to Python.
I had root temporarily on the Appliances for a brief time and found a few
scripts in Perl, but most were Python. Interestingly, the internal database
was a custom version of MySQL. Lots of Java on the Search Engine end, as
well as the web interfaces, but there was some Python and Perl scripts that
do cleanup, analysis, reporting, resets, etc.
Paul Millard
On 9/13/07, kc-request at pm.org wrote:
>
> Send kc mailing list submissions to
> kc at pm.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.pm.org/mailman/listinfo/kc
> or, via email, send a message with subject or body 'help' to
> kc-request at pm.org
>
> You can reach the person managing the list at
> kc-owner at pm.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of kc digest..."
>
>
> Today's Topics:
>
> 1. Re: move to california, work for Google (djgoku)
> 2. Re: move to california, work for Google (Doug Sparling)
> 3. Re: move to california, work for Google (John Reinke)
> 4. Re: move to california, work for Google (Doug Sparling)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 12 Sep 2007 14:51:13 -0500
> From: djgoku
> Subject: Re: [Kc] move to california, work for Google
> To: kcpm
> Message-ID:
> <99dd19c90709121251h61a63eedg583881567890d3af at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> On 9/12/07, Garrett Goebel wrote:
> > I went through their interview process a while back. I wasn't what
> > they were looking for :(
> >
> > I got the impression that they aren't really all that interested in
> > Perl.
>
> That a shame. I wonder why it is even on the list.
>
> On another note it seems this same thing happens in ACM programming
> contest where you are only able to use C/C++ or Java. Though in
> regional competitions it states you can use additional languages.
>
> Jonathan
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 12 Sep 2007 13:08:18 -0700
> From: Doug Sparling
> Subject: Re: [Kc] move to california, work for Google
> To: kc at pm.org
> Message-ID: <20070912130818.kgo48w0w88w8s8cs at www.webmail4.com>
> Content-Type: text/plain; charset="ISO-8859-1"
>
> Quoting djgoku :
>
> > On 9/12/07, Garrett Goebel wrote:
> > > I went through their interview process a while back. I wasn't what
> > > they were looking for :(
> > >
> > > I got the impression that they aren't really all that interested in
> > > Perl.
> >
> > That a shame. I wonder why it is even on the list.
>
> Not sure either. According to Steve Yegge's blog (he works for Google and
> did
> the "Rhino on Rails" project earlier this year), Google only has four
> sanctioned languages: C++, Java, Python, and JavaScript.
>
>
> ------------------------------
>
> Message: 3
> Date: Wed, 12 Sep 2007 16:32:20 -0500
> From: "John Reinke"
> Subject: Re: [Kc] move to california, work for Google
> To: kc at pm.org
> Message-ID:
> <7236b0a60709121432m14716015obb5be856e3225f8c at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> FWIW, I believe Guido van Rossum now works for Google, which further
> cements
> the Python connection.
>
> On 9/12/07, Doug Sparling wrote:
> >
> > Quoting djgoku :
> >
> > > On 9/12/07, Garrett Goebel wrote:
> > > > I went through their interview process a while back. I wasn't what
> > > > they were looking for :(
> > > >
> > > > I got the impression that they aren't really all that interested in
> > > > Perl.
> > >
> > > That a shame. I wonder why it is even on the list.
> >
> > Not sure either. According to Steve Yegge's blog (he works for Google
> and
> > did
> > the "Rhino on Rails" project earlier this year), Google only has four
> > sanctioned languages: C++, Java, Python, and JavaScript.
> > _______________________________________________
> > kc mailing list
> > kc at pm.org
> > http://mail.pm.org/mailman/listinfo/kc
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mail.pm.org/pipermail/kc/attachments/20070912/82b72f05/attachment.htm
>
> ------------------------------
>
> Message: 4
> Date: Wed, 12 Sep 2007 15:23:44 -0700
> From: Doug Sparling
> Subject: Re: [Kc] move to california, work for Google
> To: kc at pm.org
> Message-ID: <20070912152344.os8kc88gww8sccso at www.webmail4.com>
> Content-Type: text/plain; charset="ISO-8859-1"
>
> YouTube runs on Python as well, I believe...
>
> Quoting John Reinke :
>
> > FWIW, I believe Guido van Rossum now works for Google, which further
> cements
> > the Python connection.
> >
> > On 9/12/07, Doug Sparling wrote:
> > >
> > > Quoting djgoku :
> > >
> > > > On 9/12/07, Garrett Goebel wrote:
> > > > > I went through their interview process a while back. I wasn't what
> > > > > they were looking for :(
> > > > >
> > > > > I got the impression that they aren't really all that interested
> in
> > > > > Perl.
> > > >
> > > > That a shame. I wonder why it is even on the list.
> > >
> > > Not sure either. According to Steve Yegge's blog (he works for Google
> and
> > > did
> > > the "Rhino on Rails" project earlier this year), Google only has four
> > > sanctioned languages: C++, Java, Python, and JavaScript.
> > > _______________________________________________
> > > kc mailing list
> > > kc at pm.org
> > > http://mail.pm.org/mailman/listinfo/kc
> > >
> >
>
>
> ------------------------------
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
> End of kc Digest, Vol 47, Issue 4
> *********************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070913/62f66b8c/attachment.html
From djgoku at gmail.com Fri Sep 14 10:59:22 2007
From: djgoku at gmail.com (djgoku)
Date: Fri, 14 Sep 2007 12:59:22 -0500
Subject: [Kc] Testing
Message-ID: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
So I read through both Test::Tutorial and Test::Simple and I am
wondering how can I test my data that I get from excel spreadsheets:
http://mail.pm.org/pipermail/kc/2006-September/000588.html
I have a couple thousand sheets that will be parsed, but not all the
sheets are at a current easily parsed format. So how can I find the
bad sheets and how should I start testing to make sure the data I want
is what I am really getting.
Currently the this is more a script than a module I don't know yet how
to create a module, but plan to convert this sometime.
Thanks,
Jonathan
From davidnicol at gmail.com Fri Sep 14 15:17:47 2007
From: davidnicol at gmail.com (David Nicol)
Date: Fri, 14 Sep 2007 17:17:47 -0500
Subject: [Kc] Testing
In-Reply-To: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
References: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
Message-ID: <934f64a20709141517s5a760a64s948694ede228a61d@mail.gmail.com>
That's not really what the Test:: modules are for. They are for
verifying that a module does what it is supposed to do. For your
purposes as described, I would put "or die ..." after a lot of the parse points
and invariants in the spreadsheets, and wrap each page-parsing event
in eval{...} and ignore and report when the parsing fails.
things like
($cbnum) = $shape =~ /Check Box (\d+)/i or die "NO CHECK BOX FOUND";
On 9/14/07, djgoku wrote:
> So I read through both Test::Tutorial and Test::Simple and I am
> wondering how can I test my data that I get from excel spreadsheets:
> http://mail.pm.org/pipermail/kc/2006-September/000588.html
>
> I have a couple thousand sheets that will be parsed, but not all the
> sheets are at a current easily parsed format. So how can I find the
> bad sheets and how should I start testing to make sure the data I want
> is what I am really getting.
>
> Currently the this is more a script than a module I don't know yet how
> to create a module, but plan to convert this sometime.
>
> Thanks,
>
> Jonathan
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
--
The Wisconsin Employees' right to know law regarding toxic substances
specifically exempts Lutefisk -- Wikipedia
From davidnicol at gmail.com Fri Sep 14 15:17:47 2007
From: davidnicol at gmail.com (David Nicol)
Date: Fri, 14 Sep 2007 17:17:47 -0500
Subject: [Kc] Testing
In-Reply-To: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
References: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
Message-ID: <934f64a20709141517s5a760a64s948694ede228a61d@mail.gmail.com>
That's not really what the Test:: modules are for. They are for
verifying that a module does what it is supposed to do. For your
purposes as described, I would put "or die ..." after a lot of the parse points
and invariants in the spreadsheets, and wrap each page-parsing event
in eval{...} and ignore and report when the parsing fails.
things like
($cbnum) = $shape =~ /Check Box (\d+)/i or die "NO CHECK BOX FOUND";
On 9/14/07, djgoku wrote:
> So I read through both Test::Tutorial and Test::Simple and I am
> wondering how can I test my data that I get from excel spreadsheets:
> http://mail.pm.org/pipermail/kc/2006-September/000588.html
>
> I have a couple thousand sheets that will be parsed, but not all the
> sheets are at a current easily parsed format. So how can I find the
> bad sheets and how should I start testing to make sure the data I want
> is what I am really getting.
>
> Currently the this is more a script than a module I don't know yet how
> to create a module, but plan to convert this sometime.
>
> Thanks,
>
> Jonathan
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
--
The Wisconsin Employees' right to know law regarding toxic substances
specifically exempts Lutefisk -- Wikipedia
From davidnicol at gmail.com Fri Sep 14 15:17:47 2007
From: davidnicol at gmail.com (David Nicol)
Date: Fri, 14 Sep 2007 17:17:47 -0500
Subject: [Kc] Testing
In-Reply-To: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
References: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
Message-ID: <934f64a20709141517s5a760a64s948694ede228a61d@mail.gmail.com>
That's not really what the Test:: modules are for. They are for
verifying that a module does what it is supposed to do. For your
purposes as described, I would put "or die ..." after a lot of the parse points
and invariants in the spreadsheets, and wrap each page-parsing event
in eval{...} and ignore and report when the parsing fails.
things like
($cbnum) = $shape =~ /Check Box (\d+)/i or die "NO CHECK BOX FOUND";
On 9/14/07, djgoku wrote:
> So I read through both Test::Tutorial and Test::Simple and I am
> wondering how can I test my data that I get from excel spreadsheets:
> http://mail.pm.org/pipermail/kc/2006-September/000588.html
>
> I have a couple thousand sheets that will be parsed, but not all the
> sheets are at a current easily parsed format. So how can I find the
> bad sheets and how should I start testing to make sure the data I want
> is what I am really getting.
>
> Currently the this is more a script than a module I don't know yet how
> to create a module, but plan to convert this sometime.
>
> Thanks,
>
> Jonathan
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
--
The Wisconsin Employees' right to know law regarding toxic substances
specifically exempts Lutefisk -- Wikipedia
From djgoku at gmail.com Mon Sep 17 14:31:39 2007
From: djgoku at gmail.com (djgoku)
Date: Mon, 17 Sep 2007 16:31:39 -0500
Subject: [Kc] File Stats
Message-ID: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
What is the best way to keep track that a certain file is the same one
that has been previously looked/opened at.
I thought MD5 sums would be a good way but it seems that with the
files I am working with (excel spreadsheets) this isn't a viable
solution. Since once you open an excel spreadsheet (and not making any
changes) somehow modifies the MD5 sum. One way to fix this (fix it so
I don't change the MD5 when using my parser) is to copy the file then
open the copy and delete the copy afterwords. But I am not sure this
is the best solution, since I can't stop others from opening the file
in turn changing the MD5. My current solution is to use file path,
filename, file size/modified/changed to determine if this is the same
file I have parsed previously which is saved in a text file
(filename.info). This file is then later parsed if the same
filename.info exist when running my parser.
Jonathan
From ironicface at earthlink.net Mon Sep 17 17:04:19 2007
From: ironicface at earthlink.net (Teal)
Date: Mon, 17 Sep 2007 19:04:19 -0500
Subject: [Kc] File Stats
In-Reply-To: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
References: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
Message-ID: <46EF1603.7050204@earthlink.net>
djgoku wrote:
> What is the best way to keep track that a certain file is the same one
> that has been previously looked/opened at.
>
> I thought MD5 sums would be a good way but it seems that with the
> files I am working with (excel spreadsheets) this isn't a viable
> solution. Since once you open an excel spreadsheet (and not making any
> changes) somehow modifies the MD5 sum. One way to fix this (fix it so
> I don't change the MD5 when using my parser) is to copy the file then
> open the copy and delete the copy afterwords. But I am not sure this
> is the best solution, since I can't stop others from opening the file
> in turn changing the MD5. My current solution is to use file path,
> filename, file size/modified/changed to determine if this is the same
> file I have parsed previously which is saved in a text file
> (filename.info). This file is then later parsed if the same
> filename.info exist when running my parser.
>
> Jonathan
>
If you are just doing a pass over all files in a directory or set of
direcotories,
why not use the system command "dir /s /b *.xls >files.txt"
This will create a file with a list of all the excel files in your path.
Then load the list and run through each name.
Teal
--
Five minutes of Silence,
Meditate. Breathe. Be Alive.
From amoore at mooresystems.com Tue Sep 18 05:47:15 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Tue, 18 Sep 2007 07:47:15 -0500
Subject: [Kc] File Stats
In-Reply-To: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
References: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
Message-ID: <20070918124715.GA5899@mooresystems.com>
On Mon, Sep 17, 2007 at 04:31:39PM -0500, djgoku wrote:
> What is the best way to keep track that a certain file is the same one
> that has been previously looked/opened at.
I'd think that one of the File::* modules would be able to generate a
list of unique files in a directory. Have you looked at (off the top
of my head) File::Find or File::Next and their ilk?
-Andy
From amoore at mooresystems.com Tue Sep 18 06:29:50 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Tue, 18 Sep 2007 08:29:50 -0500
Subject: [Kc] Testing
In-Reply-To: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
References: <99dd19c90709141059q31b0ec75t1287b4839f728977@mail.gmail.com>
Message-ID: <20070918132950.GA7819@mooresystems.com>
On Fri, Sep 14, 2007 at 12:59:22PM -0500, djgoku wrote:
> So I read through both Test::Tutorial and Test::Simple and I am
> wondering how can I test my data that I get from excel spreadsheets:
> http://mail.pm.org/pipermail/kc/2006-September/000588.html
>
> I have a couple thousand sheets that will be parsed, but not all the
> sheets are at a current easily parsed format. So how can I find the
> bad sheets and how should I start testing to make sure the data I want
> is what I am really getting.
>
> Currently the this is more a script than a module I don't know yet how
> to create a module, but plan to convert this sometime.
If I were building something like that I would certainly use automated
testing to help ensure that my parser would read everything I wanted
out of some example spreadsheets. I'd take a few of the spreadsheets,
or some that I worked up on my own and use them for input. Then, I'd
make my test suite call the parsing code on each spredsheet and
validate the results. If they all worked, then I'd be more confident
that the parser was working correctly and would try it on the entire
body of spreadsheets.
Of course, I'd also put some diagnostics and logging into the code so
that I could tell if there were unexpected problems while parsing
either the examples or the actual data.
I would certainly find it much easier to do this all if my parsing
code were written as a module so that I could call different methods
from the test suite and check the results.
If you'd like, feel free to send me what you have off-list. I'll help
you a bit with it, and it may become something that you can discuss at
next month's meeting.
-A
From emmanuel.mejias at gmail.com Tue Sep 18 10:17:19 2007
From: emmanuel.mejias at gmail.com (Emmanuel Mejias)
Date: Tue, 18 Sep 2007 12:17:19 -0500
Subject: [Kc] Perl Noob
Message-ID: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
Hey all, I joined the group to get some Perl knowledge, but I don't see much
going back 'n forth. Is this group for advance perl users? Or can I get more
info.
Thanks,
em
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/27cf5c60/attachment.html
From jmreinke at gmail.com Tue Sep 18 10:21:07 2007
From: jmreinke at gmail.com (John Reinke)
Date: Tue, 18 Sep 2007 12:21:07 -0500
Subject: [Kc] File Stats
In-Reply-To: <20070918124715.GA5899@mooresystems.com>
References: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
<20070918124715.GA5899@mooresystems.com>
Message-ID: <7236b0a60709181021y2a71b663yea7835a0769e9b3@mail.gmail.com>
If I'm understanding this correctly, the goal is to identify a specific
file, beyond just the name/path, correct?
I've used the inode in the past to determine whether a file had been
modified or replaced.
Ex.:
my $inode = (stat $filename)[1];
John
On 9/18/07, Andrew Moore wrote:
>
> On Mon, Sep 17, 2007 at 04:31:39PM -0500, djgoku wrote:
> > What is the best way to keep track that a certain file is the same one
> > that has been previously looked/opened at.
>
> I'd think that one of the File::* modules would be able to generate a
> list of unique files in a directory. Have you looked at (off the top
> of my head) File::Find or File::Next and their ilk?
>
> -Andy
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/8eaa9895/attachment.html
From davidnicol at gmail.com Tue Sep 18 10:22:07 2007
From: davidnicol at gmail.com (David Nicol)
Date: Tue, 18 Sep 2007 12:22:07 -0500
Subject: [Kc] downtown kc financial OO perl + java position
Message-ID: <934f64a20709181022o55f8eea0sad831a80577ad3a5@mail.gmail.com>
From: Mike Arend
Date: 18 Sep 2007 12:01:31 -0400
Subject: Perl Question-Kansas City
To: davidnicol at gmail.com
Currently I am staffing a position in the Kansas City area for a Object
Oriented Perl Developer. I have been asked to find a candidate working with
Mod_Perl but has some basic experience with the Java language. I have found
it somewhat difficult to find individuals with this unique skillset.
*Kind Regards,*
**
**
*Mike Arend*
*Business Development/Technical Recruiter*
*4400 W. 107th Street, Overland Park, KS 66207*
*Office: 913-888-5050 Direct: 913-322-7298*
*Cell: 816-853-0962 *
*Toll Free: **888-888-0572 *
*Fax: **913-888-2436*
Email: mike at advantagetech.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/3bc559ac/attachment.html
From randall.munden at gmail.com Tue Sep 18 10:26:34 2007
From: randall.munden at gmail.com (Randall Munden)
Date: Tue, 18 Sep 2007 12:26:34 -0500
Subject: [Kc] downtown kc financial OO perl + java position
In-Reply-To: <934f64a20709181022o55f8eea0sad831a80577ad3a5@mail.gmail.com>
References: <934f64a20709181022o55f8eea0sad831a80577ad3a5@mail.gmail.com>
Message-ID: <1467780a0709181026m14a1655ah8d6a129552a1b64a@mail.gmail.com>
Probably because we left UMB for a reason.
On 9/18/07, David Nicol wrote:
>
>
> From: Mike Arend
> Date: 18 Sep 2007 12:01:31 -0400
> Subject: Perl Question-Kansas City
> To: davidnicol at gmail.com
>
>
> Currently I am staffing a position in the Kansas City area for a Object
> Oriented Perl Developer. I have been asked to find a candidate working with
> Mod_Perl but has some basic experience with the Java language. I have found
> it somewhat difficult to find individuals with this unique skillset.
>
>
> Kind Regards,
>
>
> Mike Arend
> Business Development/Technical Recruiter
> 4400 W. 107th Street, Overland Park, KS 66207
> Office: 913-888-5050 Direct: 913-322-7298
> Cell: 816-853-0962
> Toll Free: 888-888-0572
> Fax: 913-888-2436
> Email: mike at advantagetech.net
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
--
-- Any sufficiently advanced incompetence is indistinguishable from malice.
http://www.librarything.com/profile/blather
From jmreinke at gmail.com Tue Sep 18 10:30:39 2007
From: jmreinke at gmail.com (John Reinke)
Date: Tue, 18 Sep 2007 12:30:39 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
Message-ID: <7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
Emmanuel,
It's been years since I've gone to a meeting, but I believe this group is
open to perl users of any level. People mostly post when they have a
question for a project they are working on. The best way to learn (for me)
is to just do it. If you start working on something and get stuck, feel free
to post a question.
Others can probably point you to some good websites for learning. Seeing
that you use Gmail, you probably see some helpful links off to the right
while viewing this email right now, as I do.
A good beginner book is "Learning Perl". It is one of the few programming
books I've actually read page by page.
I hope that helps...
John
On 9/18/07, Emmanuel Mejias wrote:
>
> Hey all, I joined the group to get some Perl knowledge, but I don't see
> much going back 'n forth. Is this group for advance perl users? Or can I get
> more info.
>
> Thanks,
> em
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/272fecc8/attachment-0001.html
From amoore at mooresystems.com Tue Sep 18 10:45:31 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Tue, 18 Sep 2007 12:45:31 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
Message-ID: <20070918174531.GA8863@mooresystems.com>
On Tue, Sep 18, 2007 at 12:17:19PM -0500, Emmanuel Mejias wrote:
> Hey all, I joined the group to get some Perl knowledge, but I don't see much
> going back 'n forth. Is this group for advance perl users? Or can I get more
> info.
Welcome, Emmanual!
The group is open to everyone interested in perl. It's a pretty
low-traffic list, and the group doesn't have very large meetings when
we do get together. I do think, though, that there's pretty useful
information here when a specific question comes up. So, please feel
free to ask whatever you like.
Some other good places to go might be:
http://www.perl.org/docs.html for some "intro" stuff
http://perldoc.perl.org/ for documentation on core modules
http://perl101.org/ a newish introductory documentation site
http://search.cpan.org/ to find out about additional modules
http://use.perl.org/ a popular perl community
http://www.perlmonks.org/ a bit more advanced perl community
http://perlbuzz.com/ a newish perl news site
Welcome, and I hope you enjoy using perl!
-Andy
From frank at wiles.org Tue Sep 18 10:38:33 2007
From: frank at wiles.org (Frank Wiles)
Date: Tue, 18 Sep 2007 12:38:33 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
Message-ID: <20070918123833.3ee9a93f.frank@wiles.org>
On Tue, 18 Sep 2007 12:30:39 -0500
"John Reinke" wrote:
> Others can probably point you to some good websites for learning.
> Seeing that you use Gmail, you probably see some helpful links off to
> the right while viewing this email right now, as I do.
Here are some sites that you'll want to use as resources:
www.cpan.org and search.cpan.org
www.perlmonks.org
use.perl.org
planet.perl.org
perlmonks is a great place to get a quick question answered
and CPAN is the place you go to find modules for specific
tasks so you don't have to re-invent the wheel yourself.
-------------------------------------------------------
Frank Wiles, Revolution Systems, LLC.
Personal : frank at wiles.org http://www.wiles.org
Work : frank at revsys.com http://www.revsys.com
From frank at wiles.org Tue Sep 18 12:01:47 2007
From: frank at wiles.org (Frank Wiles)
Date: Tue, 18 Sep 2007 14:01:47 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709181148i4f70c226m8d25b3f3ef70b671@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
<20070918123833.3ee9a93f.frank@wiles.org>
<38feac7e0709181148i4f70c226m8d25b3f3ef70b671@mail.gmail.com>
Message-ID: <20070918140147.18026db8.frank@wiles.org>
On Tue, 18 Sep 2007 13:48:02 -0500
"Emmanuel Mejias" wrote:
> Cool! Thanks all for the feeback and links. I've hit a few of those
> in the past as well. I'm like John as well, I need to do it to learn
> it. I've been in the BASH world so a lot of this stuff is new to me
> and I'm trying to relate how some of the things you can do in Bash
> how they work in Perl.
>
> Well here goes. I just recently started taking an online course in
> Perl and I've also been using Perl by Example book as a reference. In
> one of my exercises I have to write a script that prints out a sorted
> list of environment variables. Well for some reason it is only
> printing out 3 of the 5 that I specified. It doesn't matter what
> order I put the environment variables in, it just prints out every
> other one. In this case it prints out HOME, HOSTNAME and USER, but
> leaves out TERM and SHELL. What am I not doing right in my code?
>
> #!/usr/bin/perl
>
> %env = ('USER',
> 'SHELL',
> 'HOSTNAME',
> 'TERM',
> 'HOME');
>
> foreach $key (sort(keys(%env))){
> print "$env $ENV{$key}\n";
> }
> Thoughts?
You're using a hash like an array when you shouldn't be:
What that is doing is creating this:
$env{USER} = 'SHELL';
$env{HOSTNAME} = 'TERM';
$env{HOME} = '';
Do this instead:
my @envs = qw( USER SHELL HOSTNAME TERM HOME );
foreach my $env ( @envs ) {
print "$env $ENV{$env}\n";
}
-------------------------------------------------------
Frank Wiles, Revolution Systems, LLC.
Personal : frank at wiles.org http://www.wiles.org
Work : frank at revsys.com http://www.revsys.com
From emmanuel.mejias at gmail.com Tue Sep 18 13:21:16 2007
From: emmanuel.mejias at gmail.com (Emmanuel Mejias)
Date: Tue, 18 Sep 2007 15:21:16 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <20070918140147.18026db8.frank@wiles.org>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
<20070918123833.3ee9a93f.frank@wiles.org>
<38feac7e0709181148i4f70c226m8d25b3f3ef70b671@mail.gmail.com>
<20070918140147.18026db8.frank@wiles.org>
Message-ID: <38feac7e0709181321l7ee59e0dye9e2689ed1e00787@mail.gmail.com>
Okay I'll give that a try. I think that he wanted us to use the hash that
was in the lesson. thanks again!
On 9/18/07, Frank Wiles wrote:
>
> On Tue, 18 Sep 2007 13:48:02 -0500
> "Emmanuel Mejias" wrote:
>
> > Cool! Thanks all for the feeback and links. I've hit a few of those
> > in the past as well. I'm like John as well, I need to do it to learn
> > it. I've been in the BASH world so a lot of this stuff is new to me
> > and I'm trying to relate how some of the things you can do in Bash
> > how they work in Perl.
> >
> > Well here goes. I just recently started taking an online course in
> > Perl and I've also been using Perl by Example book as a reference. In
> > one of my exercises I have to write a script that prints out a sorted
> > list of environment variables. Well for some reason it is only
> > printing out 3 of the 5 that I specified. It doesn't matter what
> > order I put the environment variables in, it just prints out every
> > other one. In this case it prints out HOME, HOSTNAME and USER, but
> > leaves out TERM and SHELL. What am I not doing right in my code?
> >
> > #!/usr/bin/perl
> >
> > %env = ('USER',
> > 'SHELL',
> > 'HOSTNAME',
> > 'TERM',
> > 'HOME');
> >
> > foreach $key (sort(keys(%env))){
> > print "$env $ENV{$key}\n";
> > }
> > Thoughts?
>
> You're using a hash like an array when you shouldn't be:
>
> What that is doing is creating this:
>
> $env{USER} = 'SHELL';
> $env{HOSTNAME} = 'TERM';
> $env{HOME} = '';
>
> Do this instead:
>
> my @envs = qw( USER SHELL HOSTNAME TERM HOME );
>
> foreach my $env ( @envs ) {
> print "$env $ENV{$env}\n";
> }
>
> -------------------------------------------------------
> Frank Wiles, Revolution Systems, LLC.
> Personal : frank at wiles.org http://www.wiles.org
> Work : frank at revsys.com http://www.revsys.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/d4fac983/attachment.html
From emmanuel.mejias at gmail.com Tue Sep 18 16:35:01 2007
From: emmanuel.mejias at gmail.com (Emmanuel Mejias)
Date: Tue, 18 Sep 2007 18:35:01 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709181321l7ee59e0dye9e2689ed1e00787@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<7236b0a60709181030n672a616cv823d37ab237d48ba@mail.gmail.com>
<20070918123833.3ee9a93f.frank@wiles.org>
<38feac7e0709181148i4f70c226m8d25b3f3ef70b671@mail.gmail.com>
<20070918140147.18026db8.frank@wiles.org>
<38feac7e0709181321l7ee59e0dye9e2689ed1e00787@mail.gmail.com>
Message-ID: <38feac7e0709181635u70677e7w6ffc7051ee9ba322@mail.gmail.com>
Well, that didn't work. It just gave me a print out of USER TERM HOSTNAME
and SHELL instead of actual 'username', 'xterm', some host, and /bin/bash.
right now the way i have it it just gives me...
xterm
emejias1
....instead of...
/home/emejias1
/bin/bash
xterm
emejias1
On 9/18/07, Emmanuel Mejias wrote:
>
> Okay I'll give that a try. I think that he wanted us to use the hash that
> was in the lesson. thanks again!
>
> On 9/18/07, Frank Wiles wrote:
> >
> > On Tue, 18 Sep 2007 13:48:02 -0500
> > "Emmanuel Mejias" < emmanuel.mejias at gmail.com> wrote:
> >
> > > Cool! Thanks all for the feeback and links. I've hit a few of those
> > > in the past as well. I'm like John as well, I need to do it to learn
> > > it. I've been in the BASH world so a lot of this stuff is new to me
> > > and I'm trying to relate how some of the things you can do in Bash
> > > how they work in Perl.
> > >
> > > Well here goes. I just recently started taking an online course in
> > > Perl and I've also been using Perl by Example book as a reference. In
> > > one of my exercises I have to write a script that prints out a sorted
> > > list of environment variables. Well for some reason it is only
> > > printing out 3 of the 5 that I specified. It doesn't matter what
> > > order I put the environment variables in, it just prints out every
> > > other one. In this case it prints out HOME, HOSTNAME and USER, but
> > > leaves out TERM and SHELL. What am I not doing right in my code?
> > >
> > > #!/usr/bin/perl
> > >
> > > %env = ('USER',
> > > 'SHELL',
> > > 'HOSTNAME',
> > > 'TERM',
> > > 'HOME');
> > >
> > > foreach $key (sort(keys(%env))){
> > > print "$env $ENV{$key}\n";
> > > }
> > > Thoughts?
> >
> > You're using a hash like an array when you shouldn't be:
> >
> > What that is doing is creating this:
> >
> > $env{USER} = 'SHELL';
> > $env{HOSTNAME} = 'TERM';
> > $env{HOME} = '';
> >
> > Do this instead:
> >
> > my @envs = qw( USER SHELL HOSTNAME TERM HOME );
> >
> > foreach my $env ( @envs ) {
> > print "$env $ENV{$env}\n";
> > }
> >
> > -------------------------------------------------------
> > Frank Wiles, Revolution Systems, LLC.
> > Personal : frank at wiles.org http://www.wiles.org
> > Work : frank at revsys.com http://www.revsys.com
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070918/b15e8c82/attachment.html
From scratchcomputing at gmail.com Tue Sep 18 17:05:51 2007
From: scratchcomputing at gmail.com (Eric Wilhelm)
Date: Tue, 18 Sep 2007 17:05:51 -0700
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709181635u70677e7w6ffc7051ee9ba322@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<38feac7e0709181321l7ee59e0dye9e2689ed1e00787@mail.gmail.com>
<38feac7e0709181635u70677e7w6ffc7051ee9ba322@mail.gmail.com>
Message-ID: <200709181705.51183.ewilhelm@cpan.org>
# from Emmanuel Mejias
# on Tuesday 18 September 2007 16:35:
>> > > %env = ('USER',
>> > > 'SHELL',
>> > > 'HOSTNAME',
>> > > 'TERM',
>> > > 'HOME');
>> > >
>> > > foreach $key (sort(keys(%env))){
>> > > print "$env $ENV{$key}\n";
>> > > }
Your code has an undeclared variable, which would throw an error had you
used strictures and warnings.
>Well, that didn't work. It just gave me a print out of USER TERM
>HOSTNAME and SHELL instead of actual 'username', 'xterm', some host,
>and /bin/bash.
Not sure about that. Hard to tell without seeing the code.
>right now the way i have it it just gives me...
>xterm
>emejias1
It should just be refusing to compile, but you did not use strict.
Your %env as-written is a hash (and has an odd number of elements, which
would also trigger a warning had you used warnings.) Thus, keys(%env)
is only qw(USER HOSTNAME HOME) because 'SHELL' and 'TERM' are values.
You wanted to declare it as 'my @env = (...', which would be an array.
The sigils can be a bit confusing at first, but once you understand
them, they're quite readable.
>>>> I just recently started taking an online course in
>>>> Perl and I've also been using Perl by Example book as a reference.
Please tell me that book mentions strictures very early. If not, throw
it away and read `perldoc perlintro` and the definitive "Programming
Perl" (possibly "Learning Perl", but really the camel is the way to
go.)
It would also be nice if you did not top-post to the mailing list.
#!/usr/bin/perl
use warnings;
use strict;
my @env_keys = qw(USER SHELL HOSTNAME TERM HOME);
foreach my $key (@env_keys) {
print "$key: $ENV{$key}\n";
}
You will then notice that some of those are undefined and thus warn
about the concatenation. To deal with that, you'll want to check
exists($ENV{$key}) or defined($ENV{$key}) -- they are subtly different.
Above all, please use strict and use warnings and declare your variables
with 'my'. Learning perl without those three things is altogether
unpredictable and pretty unpleasant for everyone on the list as well.
If you're writing one-liners, you can also have these safety nets with
the -M switch:
$ perl -Mwarnings -Mstrict -e '%foo = qw( bar baz bort)'
Global symbol "%foo" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
$ perl -Mwarnings -Mstrict -e 'my %foo = qw( bar baz bort)'
Odd number of elements in hash assignment at -e line 1.
Once you have good coding habits that run clean under strict and
warnings, you can then spend your debugging time on the actual
algorithmic mistakes rather than typos.
--Eric
--
software: a hypothetical exercise which happens to compile.
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
From djgoku at gmail.com Wed Sep 19 00:22:17 2007
From: djgoku at gmail.com (djgoku)
Date: Wed, 19 Sep 2007 02:22:17 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <200709181705.51183.ewilhelm@cpan.org>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<38feac7e0709181321l7ee59e0dye9e2689ed1e00787@mail.gmail.com>
<38feac7e0709181635u70677e7w6ffc7051ee9ba322@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
Message-ID: <99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
On 9/18/07, Eric Wilhelm wrote:
> # from Emmanuel Mejias
> # on Tuesday 18 September 2007 16:35:
>
> Please tell me that book mentions strictures very early. If not, throw
> it away and read `perldoc perlintro` and the definitive "Programming
> Perl" (possibly "Learning Perl", but really the camel is the way to
> go.)
Learning Perl goes over Pragmas (strict,warnings).
on page 63 (Chapter 4 Subroutines) talks about using 'use strict;'
when writing code.
warnings are pretty early on seems to start on page 24 with 'perl -w script.pl'
> It would also be nice if you did not top-post to the mailing list.
Uh oh, hopefully this doesn't become a problem like KCLUG mailing list. /me runs
> You will then notice that some of those are undefined and thus warn
> about the concatenation. To deal with that, you'll want to check
> exists($ENV{$key}) or defined($ENV{$key}) -- they are subtly different.
>
> Above all, please use strict and use warnings and declare your variables
> with 'my'. Learning perl without those three things is altogether
> unpredictable and pretty unpleasant for everyone on the list as well.
I totally agree about using pragmas (strict, warnings) for all programs.
From scratchcomputing at gmail.com Wed Sep 19 00:36:16 2007
From: scratchcomputing at gmail.com (Eric Wilhelm)
Date: Wed, 19 Sep 2007 00:36:16 -0700
Subject: [Kc] Perl Noob
In-Reply-To: <99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
Message-ID: <200709190036.17018.ewilhelm@cpan.org>
# from djgoku
# on Wednesday 19 September 2007 00:22:
>warnings are pretty early on seems to start on page 24 with 'perl -w
> script.pl'
As of (roughly) v5.6.2, -w is different though. See perlrun and then
perllexwarn. With '-w', you're enabling warnings globally -- on all of
the modules being loaded. This is sometimes nice to check, but (e.g.
in tests) not if the modules weren't tested with warnings enabled.
--Eric
--
We who cut mere stones must always be envisioning cathedrals.
--Quarry worker's creed
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
From djgoku at gmail.com Wed Sep 19 00:42:21 2007
From: djgoku at gmail.com (djgoku)
Date: Wed, 19 Sep 2007 02:42:21 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <200709190036.17018.ewilhelm@cpan.org>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
<200709190036.17018.ewilhelm@cpan.org>
Message-ID: <99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
On 9/19/07, Eric Wilhelm wrote:
> # from djgoku
> # on Wednesday 19 September 2007 00:22:
>
> >warnings are pretty early on seems to start on page 24 with 'perl -w
> > script.pl'
>
> As of (roughly) v5.6.2, -w is different though. See perlrun and then
> perllexwarn. With '-w', you're enabling warnings globally -- on all of
> the modules being loaded. This is sometimes nice to check, but (e.g.
> in tests) not if the modules weren't tested with warnings enabled.
I was meaning both 'use (strict and warnings)' from inside the script.
Like the code fragments you posted.
From djgoku at gmail.com Wed Sep 19 00:56:21 2007
From: djgoku at gmail.com (djgoku)
Date: Wed, 19 Sep 2007 02:56:21 -0500
Subject: [Kc] File Stats
In-Reply-To: <20070918124715.GA5899@mooresystems.com>
References: <99dd19c90709171431t7dbb067dhaf875dc9396603e5@mail.gmail.com>
<20070918124715.GA5899@mooresystems.com>
Message-ID: <99dd19c90709190056t8242df1q737b805db102b321@mail.gmail.com>
On 9/18/07, Andrew Moore wrote:
> On Mon, Sep 17, 2007 at 04:31:39PM -0500, djgoku wrote:
> > What is the best way to keep track that a certain file is the same one
> > that has been previously looked/opened at.
>
> I'd think that one of the File::* modules would be able to generate a
> list of unique files in a directory. Have you looked at (off the top
> of my head) File::Find or File::Next and their ilk?
I just use the information from stat(). I am currently using the size,
mtime, ctime.
Hopefully this answers both your question, and JohnR's. I have looked
around File::* but haven't found anything to suit my needs.
Jonathan
From scottk at uclick.com Wed Sep 19 07:00:01 2007
From: scottk at uclick.com (Scott Kahler)
Date: Wed, 19 Sep 2007 09:00:01 -0500
Subject: [Kc] File Stats
In-Reply-To: <99dd19c90709190056t8242df1q737b805db102b321@mail.gmail.com>
Message-ID:
On 9/19/07 2:56 AM, "djgoku" wrote:
> On 9/18/07, Andrew Moore wrote:
>> On Mon, Sep 17, 2007 at 04:31:39PM -0500, djgoku wrote:
>>> What is the best way to keep track that a certain file is the same one
>>> that has been previously looked/opened at.
>>
>> I'd think that one of the File::* modules would be able to generate a
>> list of unique files in a directory. Have you looked at (off the top
>> of my head) File::Find or File::Next and their ilk?
>
> I just use the information from stat(). I am currently using the size,
> mtime, ctime.
>
> Hopefully this answers both your question, and JohnR's. I have looked
> around File::* but haven't found anything to suit my needs.
>
> Jonathan
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
If excel is updating some sort of meta data within the file, which changes
the MD5 of it every time it is viewed. I can't think of any modules you
could use externally to do what you want to do.
Maybe you can dump that row/column data of the table and generate a MD5 sum
off of that to see if any of the internal data points have actually changed.
--
Scott Kahler
Systems Engineer
uclick, LLC (an Andrews McMeel Universal Company)
scottk at uclick.com
www.uclick.com www.gocomics.com
From emmanuel.mejias at gmail.com Wed Sep 19 08:06:18 2007
From: emmanuel.mejias at gmail.com (Emmanuel Mejias)
Date: Wed, 19 Sep 2007 10:06:18 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
<200709190036.17018.ewilhelm@cpan.org>
<99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
Message-ID: <38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
On 9/19/07, djgoku wrote:
>
> On 9/19/07, Eric Wilhelm wrote:
> > # from djgoku
> > # on Wednesday 19 September 2007 00:22:
> >
> > >warnings are pretty early on seems to start on page 24 with 'perl -w
> > > script.pl'
> >
> > As of (roughly) v5.6.2, -w is different though. See perlrun and then
> > perllexwarn. With '-w', you're enabling warnings globally -- on all of
> > the modules being loaded. This is sometimes nice to check, but (e.g.
> > in tests) not if the modules weren't tested with warnings enabled.
>
> I was meaning both 'use (strict and warnings)' from inside the script.
> Like the code fragments you posted.
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
Thanks for the feedback guys! Just to answer some questions out there, I am
familiar with the -w switch as well as strict. The class that I am taking is
through Oreilly Media and they use the *Learning Perl* book from Oreilly
except that the instructor has not covered warnings or strict yet. Where as
in the *Perl by Example* book that I was using prior to the class mentioned
this early.
In this exercise the instructor was asking that I use the pre-defined
environment variable hash that is discussed in this lesson, which is print
%ENV; so that is why I created the script as a hash originally. I'm just
confused as to why it only prints out 3 and skips every other one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070919/90490cd1/attachment.html
From amoore at mooresystems.com Wed Sep 19 08:24:36 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Wed, 19 Sep 2007 10:24:36 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
<200709190036.17018.ewilhelm@cpan.org>
<99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
<38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
Message-ID: <20070919152436.GA15375@mooresystems.com>
On Wed, Sep 19, 2007 at 10:06:18AM -0500, Emmanuel Mejias wrote:
> In this exercise the instructor was asking that I use the pre-defined
> environment variable hash that is discussed in this lesson, which is print
> %ENV; so that is why I created the script as a hash originally. I'm just
> confused as to why it only prints out 3 and skips every other one.
%ENV is already defined to contain a hash of things like:
'PWD' => '/home/amoore',
'LANG' => 'en_US',
'USER' => 'amoore',
It's pretty much always defined when perl is running, so you don't
have to define it yourself or anything.
And so you can certainly print stuff out of it as it sounds like your
instructor asked you to.
print "HOME is: $ENV{'HOME'}\n";
Or, you could walk through a list of terms to print out:
foreach my $key qw( HOME USER TERM ) {
print "$key is set to: $ENV{$key}\n";
}
You can even define that list of keys in advance:
my @keys = qw( HOME USER TERM );
foreach my $key ( @keys ) {
print "$key is set to: $ENV{$key}\n";
}
Or, you could walk through each of the keys in the hash and print out
the values in order to get them all (especially if you didn't know
what keys may be in there when you wrote the program):
foreach my $key ( keys %ENV ) {
print "$key is set to: $ENV{$key}\n";
}
It appears that you were trying to create a list of keys, like: my
@keys = qw( HOME USER TERM ); but using a hash. That's probably not a
good use of a hash, as you're discovering.
Hope this helps a bit, please ask more and show us your code if not.
-Andy
From scottk at uclick.com Wed Sep 19 08:40:27 2007
From: scottk at uclick.com (Scott Kahler)
Date: Wed, 19 Sep 2007 10:40:27 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
Message-ID:
On 9/19/07 10:06 AM, "Emmanuel Mejias" wrote:
>
> Thanks for the feedback guys! Just to answer some questions out there, I am
> familiar with the -w switch as well as strict. The class that I am taking is
> through Oreilly Media and they use the Learning Perl book from Oreilly except
> that the instructor has not covered warnings or strict yet. Where as in the
> Perl by Example book that I was using prior to the class mentioned this early.
>
> In this exercise the instructor was asking that I use the pre-defined
> environment variable hash that is discussed in this lesson, which is print
> %ENV; so that is why I created the script as a hash originally. I'm just
> confused as to why it only prints out 3 and skips every other one.
>
>
I think the main issue of confusion there is the difference between a hash
(%) and an array (@). An array being a list a, b, c, d where a hash can be
though of as a label value pair 1 => apple, 2 => banana, 3 => grape. So in
your original program where you write this:
%env = ('USER',
'SHELL',
'HOSTNAME',
'TERM',
'HOME');
The way I would write what you are doing here is:
%env = ( ?USER? => ?SHELL?,
?HOSTNAME? => ?TERM?,
?HOME? => ??):
My translation of what you are trying to do is as follows
#!/usr/bin/perl
use warnings;
use strict;
#--- Setup Hash
my %env = (
'USER' => '',
'SHELL' => '',
'HOSTNAME' => '',
'TERM' => '',
'HOME' => ''
);
#--- Query environment variables in
#--- the actual %ENV hash and
#--- put the value in the bucket the
#--- label corresponds to in the %env hash
foreach $key ( sort keys %env) {
$env{$key} = $ENV{$key};
}
#--- print out the labels and values
#-- in the %env hash
foreach $key ( sort keys %env) {
print "$key $env{$key}\n";
}
--
Scott Kahler
Systems Engineer
uclick, LLC (an Andrews McMeel Universal Company)
scottk at uclick.com
www.uclick.com www.gocomics.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070919/cc48bd62/attachment.html
From emmanuel.mejias at gmail.com Wed Sep 19 12:21:30 2007
From: emmanuel.mejias at gmail.com (Emmanuel Mejias)
Date: Wed, 19 Sep 2007 14:21:30 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <20070919152436.GA15375@mooresystems.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
<200709190036.17018.ewilhelm@cpan.org>
<99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
<38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
<20070919152436.GA15375@mooresystems.com>
Message-ID: <38feac7e0709191221h4eed013n7b8464b1992cf22c@mail.gmail.com>
On 9/19/07, Andrew Moore wrote:
>
> On Wed, Sep 19, 2007 at 10:06:18AM -0500, Emmanuel Mejias wrote:
> > In this exercise the instructor was asking that I use the pre-defined
> > environment variable hash that is discussed in this lesson, which is
> print
> > %ENV; so that is why I created the script as a hash originally. I'm just
> > confused as to why it only prints out 3 and skips every other one.
>
> %ENV is already defined to contain a hash of things like:
>
> 'PWD' => '/home/amoore',
> 'LANG' => 'en_US',
> 'USER' => 'amoore',
>
> It's pretty much always defined when perl is running, so you don't
> have to define it yourself or anything.
>
> And so you can certainly print stuff out of it as it sounds like your
> instructor asked you to.
>
> print "HOME is: $ENV{'HOME'}\n";
>
> Or, you could walk through a list of terms to print out:
>
> foreach my $key qw( HOME USER TERM ) {
> print "$key is set to: $ENV{$key}\n";
> }
>
> You can even define that list of keys in advance:
>
> my @keys = qw( HOME USER TERM );
> foreach my $key ( @keys ) {
> print "$key is set to: $ENV{$key}\n";
> }
>
> Or, you could walk through each of the keys in the hash and print out
> the values in order to get them all (especially if you didn't know
> what keys may be in there when you wrote the program):
>
> foreach my $key ( keys %ENV ) {
> print "$key is set to: $ENV{$key}\n";
> }
>
> It appears that you were trying to create a list of keys, like: my
> @keys = qw( HOME USER TERM ); but using a hash. That's probably not a
> good use of a hash, as you're discovering.
>
> Hope this helps a bit, please ask more and show us your code if not.
>
> -Andy
>
> _______________________________________________
> kc mailing list
> kc at pm.org
> http://mail.pm.org/mailman/listinfo/kc
>
That worked great, Andrew! Thanks! I added my sort and two extra lines so it
does what it's suppose to do and prints out envirnoment variables that I
was asking it to print. here is my end result:
#!/usr/bin/perl -w
@key = qw(SHELL USER LANG HOSTNAME TERM HOME);
foreach my $key (sort(keys %ENV)){
foreach $check (@key){
if ($key eq $check){
print "$key: $ENV{$key}\n";
}
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070919/5aab21ec/attachment.html
From amoore at mooresystems.com Wed Sep 19 12:49:07 2007
From: amoore at mooresystems.com (Andrew Moore)
Date: Wed, 19 Sep 2007 14:49:07 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <38feac7e0709191221h4eed013n7b8464b1992cf22c@mail.gmail.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<200709181705.51183.ewilhelm@cpan.org>
<99dd19c90709190022w361b7b9fp9ecb7b54a6cc4d45@mail.gmail.com>
<200709190036.17018.ewilhelm@cpan.org>
<99dd19c90709190042h2a98df60pd6d8f7e6638b9422@mail.gmail.com>
<38feac7e0709190806o5db29488q9f9d378d7420aae0@mail.gmail.com>
<20070919152436.GA15375@mooresystems.com>
<38feac7e0709191221h4eed013n7b8464b1992cf22c@mail.gmail.com>
Message-ID: <20070919194907.GA18421@mooresystems.com>
On Wed, Sep 19, 2007 at 02:21:30PM -0500, Emmanuel Mejias wrote:
> That worked great, Andrew! Thanks! I added my sort and two extra lines so it
> does what it's suppose to do and prints out envirnoment variables that I
> was asking it to print. here is my end result:
>
> #!/usr/bin/perl -w
>
> @key = qw(SHELL USER LANG HOSTNAME TERM HOME);
>
> foreach my $key (sort(keys %ENV)){
> foreach $check (@key){
> if ($key eq $check){
> print "$key: $ENV{$key}\n";
> }
> }
> }
I'm glad it helped, Emmanuel. That version looks much better. I think
we can make some improvements, though, if you want. Here's your code
with line numbers to make it easier to talk about:
1 #!/usr/bin/perl -w
2
3 @key = qw(SHELL USER LANG HOSTNAME TERM HOME);
4
5 foreach my $key (sort(keys %ENV)){
6 foreach $check (@key){
7 if ($key eq $check){
8 print "$key: $ENV{$key}\n";
9 }
10 }
It looks like you want to print out the envionment variables SHELL,
USER, LANG, HOSTNAME, TERM, and HOME. No problem.
First, instead of using #!/usr/bin/perl -w at the top, let's get rid
of '-w' and do 'use warnings' instead. The difference is subtle, but
essentially we just want to enforce warnings on your code, not on all
modules you may have included (which for now is none). Also, let's add
'use strict', too. It helps make sure that we're declaring our
variables before we use them and avoiding some other common
errors. The first few lines look like this now:
#!/usr/bin/perl
use warnings;
use strict;
Because we're using strict now, we need to declare our list @key in
line 3. That line becomes:
my @key = qw(SHELL USER LANG HOSTNAME TERM HOME);
Now, in line 5 you walk through each of the keys in the %ENV hash, and
then in line 6 we walk through @key to see if it's one that we
want. Maybe it makes more sense to walk through just the keys we want,
and print them out of %ENV. That makes the loop look more like:
foreach my $key ( @key ) {
print "$key: $ENV{$key}\n";
}
This means that we don't have to run through the @key list for each
one of the keys of %ENV. It's more efficient, and maybe more
intuitive.
But wait! This is different from yours, because if you have an element
in @key but no corresponding key in the %ENV hash (like HOSTNAME for
me), it will now print out a warning like:
Use of uninitialized value in concatenation (.) or string at /tmp/env.pl line 8.
Hmm. I guess we need to make sure that that key exists in the %ENV
hash first.
foreach my $key ( @key ) {
if ( exists $ENV{$key} ) {
print "$key: $ENV{$key}\n";
}
This means that only the things in @key that are also keys in the %ENV
hash get printed out. It's quicker to check for existence in the hash
on each loop interation than it is to walk through the @key list on
each iteration. More importantly, though, it's also more intuitive (to
me) to loop over each thing that we want to print, see if there's
anything to print for it, and then print it than it is to walk over
the list of things that exist, see if we want to print each, and then
print it.
After all this, the script looks something more like:
#!/usr/bin/perl
use warnings;
use strict;
@key = qw(SHELL USER LANG HOSTNAME TERM HOME);
foreach my $key ( @key ) {
if ( exists $ENV{$key} ) {
print "$key: $ENV{$key}\n";
}
}
I personally think it's better than it used to be.
I'm a little confused now by the fact that we have a variable named
@key and another variable named $key. Maybe we should rename one or
both of them. Maybe there are more changes... This could go on
forever!
Let me know if that helps, and what you get stuck on next!
-Andy
From scratchcomputing at gmail.com Wed Sep 19 13:10:23 2007
From: scratchcomputing at gmail.com (Eric Wilhelm)
Date: Wed, 19 Sep 2007 13:10:23 -0700
Subject: [Kc] Perl Noob
In-Reply-To: <20070919194907.GA18421@mooresystems.com>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<38feac7e0709191221h4eed013n7b8464b1992cf22c@mail.gmail.com>
<20070919194907.GA18421@mooresystems.com>
Message-ID: <200709191310.23974.ewilhelm@cpan.org>
# from Andrew Moore
# on Wednesday 19 September 2007 12:49:
>First, instead of using #!/usr/bin/perl -w at the top, let's get rid
>of '-w' and do 'use warnings' instead. The difference is subtle, but
>essentially we just want to enforce warnings on your code, not on all
>modules you may have included (which for now is none). Also, let's add
>'use strict', too.
Maybe my mail isn't reaching the list (or there's an echo?) Oh well,
moving on...
#!/usr/bin/perl
use warnings;
use strict;
print join("\n",
map({"$_ is " .
(exists($ENV{$_}) ?
(defined($ENV{$_}) ? $ENV{$_} : '-undef-') :
'-non-existent-'
)
} @ARGV)
), "\n";
--Eric
--
Consumers want choice, consumers want openness.
--Rob Glaser
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------
From davidnicol at gmail.com Wed Sep 19 13:46:37 2007
From: davidnicol at gmail.com (David Nicol)
Date: Wed, 19 Sep 2007 15:46:37 -0500
Subject: [Kc] Perl Noob
In-Reply-To: <200709191310.23974.ewilhelm@cpan.org>
References: <38feac7e0709181017o5bfe60fxea5aa42b7bb46a41@mail.gmail.com>
<38feac7e0709191221h4eed013n7b8464b1992cf22c@mail.gmail.com>
<20070919194907.GA18421@mooresystems.com>
<200709191310.23974.ewilhelm@cpan.org>
Message-ID: <934f64a20709191346q743651bejb7b15e9bea50a45a@mail.gmail.com>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> print join("\n",
> map({"$_ is " .
> (exists($ENV{$_}) ?
> (defined($ENV{$_}) ? $ENV{$_} : '-undef-') :
> '-non-existent-'
> )
> } @ARGV)
> ), "\n";
>
> --Eric
Or, getting more obscure for no reason,
#!/usr/bin/perl
use warnings;
use strict;
$" = "\n";
my @expanded_list =
map({"$_ is " .
(exists($ENV{$_}) ?
(defined($ENV{$_}) ? $ENV{$_} : '-undef-') :
'-non-existent-'
)
} sort @ARGV;
print "@expanded_list\n";
__END__
there isn't a really tight way to use hash slice syntax, because of
the "$key is ..." bit
this is a lot clearer, while just skipping the missing ones; and using
the default
variable instead of an explicit $key:
for (sort @ARGV){
exists $ENV{$_} or next;
print "$_ is $ENV{$_}\n";
};
__END__
which can be made one line using postfix for
exists $ENV{$_} and print "$_ is $ENV{$_}\n" for (sort @ARGV);
blah> perl -le 'exists $ENV{$_} and print "$_ is $ENV{$_}" for (sort
@ARGV)' USER SHELL HOME BOGUS
HOME is /home/david
SHELL is /bin/crash
USER is david
blah>
From darylvf at gmail.com Wed Sep 19 15:06:10 2007
From: darylvf at gmail.com (Daryl Fallin)
Date: Wed, 19 Sep 2007 17:06:10 -0500
Subject: [Kc] Since everyone is on a roll today .. is this the most
efficient ...
Message-ID:
I haven't posted for awhile and still consider myself a total PERL newbie,
so I use the following perl to convert decimal IP notation to Quad IP
notation. Is there a better way?
Also as you can see my use of $_[0] which works, but seems odd. Now I can't
remember why I did it that way.
###########################
# subroutine: getip( $int )
###########################
sub getip
{
my $ipinteger = $_[0];
#print "TEST: $_[0]\n";
my $ipbin = ip_inttobin($ipinteger, 4);
my $ipquad = ip_bintoip($ipbin, 4);
my $TypeIP = new Net::IP ($ipquad) or die (Net::IP::Error());
#print "**IP IS: $ipquad\n";
return $ipquad;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070919/04bdf920/attachment.html
From frank at wiles.org Wed Sep 19 15:14:15 2007
From: frank at wiles.org (Frank Wiles)
Date: Wed, 19 Sep 2007 17:14:15 -0500
Subject: [Kc] Since everyone is on a roll today .. is this the most
efficient ...
In-Reply-To:
References:
Message-ID: <20070919171415.d7c69d57.frank@wiles.org>
On Wed, 19 Sep 2007 17:06:10 -0500
"Daryl Fallin" wrote:
> I haven't posted for awhile and still consider myself a total PERL
> newbie, so I use the following perl to convert decimal IP notation to
> Quad IP notation. Is there a better way?
>
> Also as you can see my use of $_[0] which works, but seems odd. Now
> I can't remember why I did it that way.
>
> ###########################
> # subroutine: getip( $int )
> ###########################
> sub getip
> {
> my $ipinteger = $_[0];
> #print "TEST: $_[0]\n";
> my $ipbin = ip_inttobin($ipinteger, 4);
> my $ipquad = ip_bintoip($ipbin, 4);
> my $TypeIP = new Net::IP ($ipquad) or die (Net::IP::Error());
> #print "**IP IS: $ipquad\n";
> return $ipquad;
> }
>
I'd check CPAN as I'm sure something like NetAddr::IP::Util
might have something already written to do this.
But, the two comments I would make about the code are:
1) Don't use the indirect object syntax, it can cause subtle
problems in the long run. So instead do:
my $TypeIP = Net::IP->new($ipquad) or die (Net::IP::Error());
2) Why are you even creating the Net::IP object? You don't appear to
do anything with it at all so it is pointless.
-------------------------------------------------------
Frank Wiles, Revolution Systems, LLC.
Personal : frank at wiles.org http://www.wiles.org
Work : frank at revsys.com http://www.revsys.com
From djgoku at gmail.com Wed Sep 19 15:29:17 2007
From: djgoku at gmail.com (djgoku)
Date: Wed, 19 Sep 2007 17:29:17 -0500
Subject: [Kc] Since everyone is on a roll today .. is this the most
efficient ...
In-Reply-To: <99dd19c90709191528u77f4b0e3l28a0b2ae4bf02abe@mail.gmail.com>
References:
<99dd19c90709191528u77f4b0e3l28a0b2ae4bf02abe@mail.gmail.com>
Message-ID: <99dd19c90709191529g581d27cesa53408a58113467@mail.gmail.com>
On 9/19/07, Daryl Fallin wrote:
> I haven't posted for awhile and still consider myself a total PERL newbie,
> so I use the following perl to convert decimal IP notation to Quad IP
> notation. Is there a better way?
>
> Also as you can see my use of $_[0] which works, but seems odd. Now I can't
> remember why I did it that way.
>
> ###########################
> # subroutine: getip( $int )
> ###########################
> sub getip
> {
> my $ipinteger = $_[0];
> #print "TEST: $_[0]\n";
> my $ipbin = ip_inttobin($ipinteger, 4);
> my $ipquad = ip_bintoip($ipbin, 4);
> my $TypeIP = new Net::IP ($ipquad) or die (Net::IP::Error());
> #print "**IP IS: $ipquad\n";
> return $ipquad;
> }
You could do:
my $ipinteger = shift;
or maybe:
# this is one is weird since you don't have a list of arguments
my ($ipinteger) = @_;
As FrankW said, I also am not sure why you are even creating the object.
From davidnicol at gmail.com Thu Sep 20 09:06:24 2007
From: davidnicol at gmail.com (David Nicol)
Date: Thu, 20 Sep 2007 11:06:24 -0500
Subject: [Kc] Since everyone is on a roll today .. is this the most
efficient ...
In-Reply-To: <99dd19c90709191529g581d27cesa53408a58113467@mail.gmail.com>
References:
<99dd19c90709191528u77f4b0e3l28a0b2ae4bf02abe@mail.gmail.com>
<99dd19c90709191529g581d27cesa53408a58113467@mail.gmail.com>
Message-ID: <934f64a20709200906q31d70e73td03af5521ecc1f@mail.gmail.com>
On 9/19/07, djgoku wrote:
> You could do:
> my $ipinteger = shift;
or wait until Macrame is available and do
macro ipinteger {_[0]}
but at this time it's still a vaporware victim of the ongoing tuit
shortage crisis
From darylvf at gmail.com Thu Sep 20 09:25:34 2007
From: darylvf at gmail.com (Daryl Fallin)
Date: Thu, 20 Sep 2007 11:25:34 -0500
Subject: [Kc] why doesn't this work - fetchrow_array
Message-ID:
Even when the query is empty the If clause in the while loop will not print
"name NOT defined"
I suspect this has something to do with fetchrow_array and using !defined()
doesn't work.
==========================================================
my $query = "select deviceip, devicename from (select * from admDevice where
admDevice.devicename like \'%$_%\') as devi
ces, admSyslogSrc where devices.deviceId = admSyslogSrc.deviceId";
$sth = $dbh->prepare($query);
if( defined( $sth )) {
$sth->execute( );
}
while ( my ($hostint, $name) = $sth->fetchrow_array ) {
if ( !defined($name) ) {
print "name NOT defined";
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kc/attachments/20070920/44859df9/attachment.html
From ironicface at earthlink.net Thu Sep 20 10:01:16 2007
From: ironicface at earthlink.net (Teal)
Date: Thu, 20 Sep 2007 12:01:16 -0500
Subject: [Kc] why doesn't this work - fetchrow_array
In-Reply-To:
References:
Message-ID: <46F2A75C.7030704@earthlink.net>
Daryl Fallin wrote:
> Even when the query is empty the If clause in the while loop will not
> print "name NOT defined"
>
> I suspect this has something to do with fetchrow_array and using
> !defined() doesn't work.
>
> ==========================================================
>
> my $query = "select deviceip, devicename from (select * from admDevice
> where admDevice.devicename like \'%$_%\') as devi
> ces, admSyslogSrc where devices.deviceId = admSyslogSrc.deviceId";
>
> $sth = $dbh->prepare($query);
>
> if( defined( $sth )) {
> $sth->execute( );
> }
>
> while ( my ($hostint, $name) = $sth->fetchrow_array ) {
> if ( !defined($name) ) {
> print "name NOT defined";
> }
>
I think $name is, because you have already declared it, defined.
What you need to test is not null or not false.
Teal
--
Five minutes of Silence,
Meditate. Breathe. Be Alive.
From frank at wiles.org Thu Sep 20 10:09:48 2007
From: frank at wiles.org (Frank Wiles)
Date: Thu, 20 Sep 2007 12:09:48 -0500
Subject: [Kc] why doesn't this work - fetchrow_array
In-Reply-To:
References:
Message-ID: <20070920120948.7d5a1638.frank@wiles.org>
On Thu, 20 Sep 2007 11:25:34 -0500
"Daryl Fallin" wrote:
> Even when the query is empty the If clause in the while loop will not
> print "name NOT defined"
>
> I suspect this has something to do with fetchrow_array and using !
> defined() doesn't work.
>
> ==========================================================
>
> my $query = "select deviceip, devicename from (select * from
> admDevice where admDevice.devicename like \'%$_%\') as devi
> ces, admSyslogSrc where devices.deviceId = admSyslogSrc.deviceId";
>
> $sth = $dbh->prepare($query);
>
> if( defined( $sth )) {
> $sth->execute( );
> }
>
> while ( my ($hostint, $name) = $sth->fetchrow_array ) {
> if ( !defined($name) ) {
> print "name NOT defined";
> }
>
To echo what Teal said, $name is 'defined', it just happens
to be defined to an empty string ( aka NULL ) if the column
is null.
-------------------------------------------------------
Frank Wiles, Revolution Systems, LLC.
Personal : frank at wiles.org http://www.wiles.org
Work : frank at revsys.com http://www.revsys.com
From davidnicol at gmail.com Fri Sep 21 09:03:06 2007
From: davidnicol at gmail.com (David Nicol)
Date: Fri, 21 Sep 2007 11:03:06 -0500
Subject: [Kc] Term::ANSIColor color localization patch
Message-ID: <934f64a20709210903p3c41b08s3872c605528a4987@mail.gmail.com>
the attached allows color tags to stack up, so instead of resetting to nothing,
one can have a color set, as long as it was set like so
use Term::ANSIColor ':pushpop';
print PUSHCOLOR(RED.ON_BLUE),"this will be in red on blue\n";
then give
print LOCALCOLOR(BLUE.ON_RED,"yatta ta da, ta da");
and due to the manipulation of @Term::ANSIColor::COLORSTACK by
the new features in the patch, the localcolor text is in the localcolor but
afterwards
print "this will again be red on blue with no additional effort."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: COLORPATCH.diff
Type: application/octet-stream
Size: 5631 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/kc/attachments/20070921/baf70aaf/attachment.obj