[25510] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 7754 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 8 14:05:24 2005

Date: Tue, 8 Feb 2005 11:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 8 Feb 2005     Volume: 10 Number: 7754

Today's topics:
    Re: 'Subroutine redefined' annoyance <please_post@nomail.edu>
    Re: [OT] Re: Perl - permute? <postmaster@castleamber.com>
    Re: [OT] Re: Perl - permute? <postmaster@castleamber.com>
    Re: [OT] Re: Perl - permute? <postmaster@castleamber.com>
    Re: [OT] Re: Perl - permute? <phaylon@dunkelheit.at>
    Re: [OT] Re: Perl - permute? <postmaster@castleamber.com>
    Re: A question on output of flip flop operator <tadmc@augustmail.com>
    Re: A question on output of flip flop operator <phaylon@dunkelheit.at>
    Re: Connecting to a Domino Db <dummymb@hotmail.com>
    Re: copy directory structure without files <phaylon@dunkelheit.at>
        Counting column delimiters per row in a text file <hbar21@gmail.com>
    Re: Counting column delimiters per row in a text file <1usa@llenroc.ude.invalid>
    Re: Counting column delimiters per row in a text file <phaylon@dunkelheit.at>
    Re: FAQ 4.16 How can I find the Julian Day? <jwkenne@attglobal.net>
    Re: Generate UUID <SPAMMERSandante@DIEtotaliseALONE.co.uk>
    Re: Perl - permute? <postmaster@castleamber.com>
    Re: Perl - permute? <postmaster@castleamber.com>
    Re: Perl - permute? <phaylon@dunkelheit.at>
    Re: Perl - permute? <postmaster@castleamber.com>
    Re: Perl - permute? <phaylon@dunkelheit.at>
        perl and GDBM and FreeBSD <paz@qcislands.net>
    Re: should be simple..but eh  Can you help <tzz@lifelogs.com>
    Re: Trouble with Regexps ioneabu@yahoo.com
    Re: www::mechanize $mech->select <schaa@geo.uni-koeln.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 8 Feb 2005 18:54:08 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: 'Subroutine redefined' annoyance
Message-Id: <cub1sg$hqq$1@reader2.panix.com>

In <cu929g$1oi$1@mamenchi.zrz.TU-Berlin.DE> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>bill  <please_post@nomail.edu> wrote in comp.lang.perl.misc:
>> In <cu8kug$ljr$3@mamenchi.zrz.TU-Berlin.DE>
>> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>[...]

>> to it in a directory in my $PATH.  In this way I can call the script
>> from the command line, or "use" it from another script.
>> 
>> If there's a better way that meet all my neurotic criteria, I'd
>> love to hear it.

>A module doing double-time as a script?

Yeah.  It's pretty common in the Python world, although the use
I've typically seen for the "executable script code" in Python
modules is devoted to tests of the module.

Frankly, I'm surprised it is not more common to see Perl modules
that do double-duty as scripts.  It happens to me all the time that
I want to use some functionality that I implemented earlier in some
script.  I find the "standard" way to handle such situations (namely,
re-factor the original script into module and wrapper script files,
which will most likely reside in separate directories) artificial
somehow.  It makes a lot more sense to me to keep everything in
one file, and make the script's desired functionality exportable.

>Besides the obvious shebang line,
>check caller() to see if you want to execute the "script code" (untested):

>    if ( caller ) {
>        OddsAndEnds->import(); # parameters as needed
>        require Getopt::STD; # for instance
>        # more script code here
>    }

I assume you meant "unless ( caller )"?

>Stuff that only the
>script needs should be require'd, not use'd.  Since imports in the
>script happen at run time...

You'd also need explicit import statements, no?  (Or use
package-qualified subs?)

>If you want the script first and the module later (I prefer it that way)

Just out of curiosity, is that preference a matter of aesthetics
alone, or is there a functional rationale for putting the script
before? (I think my preference was shaped by all the Python scripts
I've seen with the "script code" at the end.)

bill



------------------------------

Date: 8 Feb 2005 16:47:36 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: [OT] Re: Perl - permute?
Message-Id: <Xns95F76DCB962castleamber@130.133.1.4>

Bernard El-Hagin wrote:

> John Bokma <postmaster@castleamber.com> wrote:
> 
>> Alan J. Flavell wrote:
>> 
>>> incidents which produce killfile entries ;-)
>> 
>> Only lamers brag about their killfiles.
> 
> Then I happily join their ranks.
> 
> *PLONK*

I guess you already were there. Hope you will eventually discover how 
"cool" it really is.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: 8 Feb 2005 16:48:56 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: [OT] Re: Perl - permute?
Message-Id: <Xns95F76E05A1E5Bcastleamber@130.133.1.4>

Tad McClellan wrote:

> Bernard El-Hagin <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:
>> John Bokma <postmaster@castleamber.com> wrote:
>> 
>>> Alan J. Flavell wrote:
>>> 
>>>> incidents which produce killfile entries ;-)
>>> 
>>> Only lamers brag about their killfiles.
>> 
>> 
>> Then I happily join their ranks.
> 
> Because only lamers earn a killfile entry in the first place.
> 
> No, that isn't correct.

Agreed. 

> Only some who are killfiled are lame.

Agreed.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: 8 Feb 2005 16:50:16 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: [OT] Re: Perl - permute?
Message-Id: <Xns95F76E3FA4FF5castleamber@130.133.1.4>

phaylon wrote:

> John Bokma wrote:
> 
>> Only lamers brag about their killfiles.
> 
> Scorefile *again* adjusted.

Let me guess, you gave yourself -9999 :-D.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: Tue, 08 Feb 2005 17:55:43 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: [OT] Re: Perl - permute?
Message-Id: <pan.2005.02.08.16.55.43.294329@dunkelheit.at>

John Bokma wrote:

> Let me guess, you gave yourself -9999 :-D.

Nah, I almost never set it that low *eg*

-- 
http://www.dunkelheit.at/

Ordinary morality is only for ordinary people.
                       -- Aleister Crowley



------------------------------

Date: 8 Feb 2005 17:57:26 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: [OT] Re: Perl - permute?
Message-Id: <Xns95F779A29E2B5castleamber@130.133.1.4>

phaylon wrote:

> John Bokma wrote:
> 
>> Let me guess, you gave yourself -9999 :-D.
> 
> Nah, I almost never set it that low *eg*

:-D.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: Tue, 8 Feb 2005 10:08:47 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: A question on output of flip flop operator
Message-Id: <slrnd0hp0f.voh.tadmc@magna.augustmail.com>

phaylon <phaylon@dunkelheit.at> wrote:


Why do you set X-No-Archive on your posts?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Tue, 08 Feb 2005 18:45:13 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: A question on output of flip flop operator
Message-Id: <pan.2005.02.08.17.45.13.744854@dunkelheit.at>

Tad McClellan wrote:

> Why do you set X-No-Archive on your posts?

Because I forgot to take it out after copying another profile, thanks!

-- 
http://www.dunkelheit.at/

Ordinary morality is only for ordinary people.
                       -- Aleister Crowley



------------------------------

Date: 8 Feb 2005 08:33:02 -0800
From: "DMB" <dummymb@hotmail.com>
Subject: Re: Connecting to a Domino Db
Message-Id: <1107880382.787113.90350@f14g2000cwb.googlegroups.com>

The DB2 option isn't available until version 7 which is not quite fully
Gold.  Even after it is rolled out, most databases will likely remain
as .nsf files rather than mess with converting to db2.  I have some
Java code that connects to a .nsf database.  If I post that would you
know how to write similar code in Perl?



------------------------------

Date: Tue, 08 Feb 2005 17:02:41 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: copy directory structure without files
Message-Id: <pan.2005.02.08.16.02.40.647496@dunkelheit.at>

ioneabu wrote:

> Like this?

Yep, that imho looks good. The only thing is your regular expression:

  /^\.{1,2}/

which matches everything that starts with one or two points. So you
would skip the directory /test/...foo/ for example. I don't know if you
want that, but if you make a

  /^\.{1,2}$/

out of that, it should work as (I) expected.

bye,
phaylon

-- 
http://www.dunkelheit.at/
That is not dead, which can eternal lie,
and with strange aeons even death may die.
		-- H.P. Lovecraft



------------------------------

Date: 8 Feb 2005 09:52:04 -0800
From: "hbar" <hbar21@gmail.com>
Subject: Counting column delimiters per row in a text file
Message-Id: <1107885124.542726.326620@l41g2000cwc.googlegroups.com>

Ok, so I've got this text file which is supposed to have 6 columns per
row.  However, I know that some of the rows don't have the right amount
of columns.  Counting the number of delimiters in each row sounds like
the most straightforward approach, but maybe there's a slick function I
don't know about?

At any rate, my goal is to identify the row/line numbers of those rows
that don't have 6 columns.

Can anyone either help me, or at least point me in the right
directions?

Thanks!!



------------------------------

Date: Tue, 08 Feb 2005 17:59:51 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Counting column delimiters per row in a text file
Message-Id: <Xns95F78443CE55asu1cornelledu@127.0.0.1>

"hbar" <hbar21@gmail.com> wrote in news:1107885124.542726.326620
@l41g2000cwc.googlegroups.com:

> Ok, so I've got this text file which is supposed to have 6 columns per
> row.  

 ...

> Can anyone either help me, or at least point me in the right
> directions?

perldoc -q delimited

Sinan


------------------------------

Date: Tue, 08 Feb 2005 18:59:45 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Counting column delimiters per row in a text file
Message-Id: <pan.2005.02.08.17.59.44.497433@dunkelheit.at>

hbar wrote:

> At any rate, my goal is to identify the row/line numbers of those rows
> that don't have 6 columns.

perldoc -q count may help I guess.

g,phay

-- 
http://www.dunkelheit.at/
That is not dead, which can eternal lie,
and with strange aeons even death may die.
		-- H.P. Lovecraft



------------------------------

Date: Tue, 08 Feb 2005 11:10:16 -0500
From: "John W. Kennedy" <jwkenne@attglobal.net>
Subject: Re: FAQ 4.16 How can I find the Julian Day?
Message-Id: <Tx5Od.778$w57.348@fe12.lga>

PerlFAQ Server wrote:
> 4.16: How can I find the Julian Day?
> 
>     Use the Time::JulianDay module (part of the Time-modules bundle
>     available from CPAN.)
> 
>     Before you immerse yourself too deeply in this, be sure to verify that
>     it is the *Julian* Day you really want. Are you interested in a way of
>     getting serial days so that you just can tell how many days they are
>     apart or so that you can do also other date arithmetic? If you are
>     interested in performing date arithmetic, this can be done using modules
>     Date::Manip or Date::Calc.
> 
>     There is too many details and much confusion on this issue to cover in
>     this FAQ, but the term is applied (correctly) to a calendar now
>     supplanted by the Gregorian Calendar, with the Julian Calendar failing
>     to adjust properly for leap years on centennial years (among other
>     annoyances). The term is also used (incorrectly) to mean: [1] days in
>     the Gregorian Calendar; and [2] days since a particular starting time or
>     `epoch', usually 1970 in the Unix world and 1980 in the MS-DOS/Windows
>     world. If you find that it is not the first meaning that you really
>     want, then check out the Date::Manip and Date::Calc modules. (Thanks to
>     David Cassell for most of this text.)

As this stands, it gives an incorrect impression. The term (by an 
unfortunate accident of history) has two correct meanings, but the net 
effect of the above is to suggest that there is only one.

---
John W. Kennedy
  "Information is light. Information, in itself, about anything, is light."
   -- Tom Stoppard. "Night and Day"


------------------------------

Date: Tue, 08 Feb 2005 16:29:58 GMT
From: "John Silver" <SPAMMERSandante@DIEtotaliseALONE.co.uk>
Subject: Re: Generate UUID
Message-Id: <aO5Od.152804$K7.56606@news-server.bigpond.net.au>


"John Silver" <SPAMMERSandante@DIEtotaliseALONE.co.uk> wrote in message 
news:nEIMd.147342$K7.74779@news-server.bigpond.net.au...
>I need toi generate unique file names for a series of interface access 
>processes.
>
> I have the code to perform this, using the  data::UUID  module.
>
> However, it fails on my machine, it seems that is missing from the 
> package.
>
> Can someone point me at a pre compiled  UUID  module I can add to a Perl 
> installation on Windows NT4?
>
> Kind regards
>
> John
>
> 




------------------------------

Date: 8 Feb 2005 16:51:44 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl - permute?
Message-Id: <Xns95F76E7F41E7Acastleamber@130.133.1.4>

Tad McClellan wrote:

> phaylon <phaylon@dunkelheit.at> wrote:
>> Jürgen Exner wrote:
>> 
>>> Really? I thought CLPM was Usenet? Amazing, there is always
>>> something new to learn.
>> 
>> I don't get it.
> 
> Usenet is but one of the many services that comprise The Internet.
> 
> ie. it is a subset of The Internet

Incorrect. Usenet is *not* a subset of the Internet.


-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: 8 Feb 2005 16:52:59 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl - permute?
Message-Id: <Xns95F76EB599296castleamber@130.133.1.4>

Arndt Jonasson wrote:

> 
> Tad McClellan <tadmc@augustmail.com> writes:
>> phaylon <phaylon@dunkelheit.at> wrote:
>> > Jürgen Exner wrote:
>> > 
>> >> Really? I thought CLPM was Usenet? Amazing, there is always
>> >> something new to learn.
>> > 
>> > I don't get it.
>> 
>> 
>> Usenet is but one of the many services that comprise The Internet.
>> 
>> ie. it is a subset of The Internet
> 
> And once even that wasn't true.

It still isn't. I know people who use Usenet without using the Internet.
According to the FAQ "Usenet" also is putting it all on a floppy and 
transfering it to another computer without internet connection.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: Tue, 08 Feb 2005 17:57:55 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Perl - permute?
Message-Id: <pan.2005.02.08.16.57.55.330654@dunkelheit.at>

John Bokma wrote:

> It still isn't. I know people who use Usenet without using the Internet.
> According to the FAQ "Usenet" also is putting it all on a floppy and
> transfering it to another computer without internet connection.

Yeah, but I guess that's not the most used way to spread articles this
days..

-- 
http://www.dunkelheit.at/
bellum omnium pater.



------------------------------

Date: 8 Feb 2005 17:58:56 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl - permute?
Message-Id: <Xns95F779E401E70castleamber@130.133.1.4>

phaylon wrote:

> John Bokma wrote:
> 
>> It still isn't. I know people who use Usenet without using the Internet.
>> According to the FAQ "Usenet" also is putting it all on a floppy and
>> transfering it to another computer without internet connection.
> 
> Yeah, but I guess that's not the most used way to spread articles this
> days..

True, but there are still people who use Usenet without an Internet 
connection, and hence Usenet is not a subset of Internet.

I did the floppy thing, but that was ages ago :-D.

-- 
John                   Small Perl scripts: http://johnbokma.com/perl/
               Perl programmer available:     http://castleamber.com/
            Happy Customers: http://castleamber.com/testimonials.html
                        


------------------------------

Date: Tue, 08 Feb 2005 19:05:55 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Perl - permute?
Message-Id: <pan.2005.02.08.18.05.55.229657@dunkelheit.at>

John Bokma wrote:

> True, but there are still people who use Usenet without an Internet
> connection, and hence Usenet is not a subset of Internet.

Well, okay, depends on the point of view. But still, what's the problem
with no real name? Haven't found anything in the posting guidelines that
says it's "requested".

-- 
http://www.dunkelheit.at/
bellum omnium pater.



------------------------------

Date: Tue, 08 Feb 2005 09:19:49 -0800
From: Jim Pazarena <paz@qcislands.net>
Subject: perl and GDBM and FreeBSD
Message-Id: <1dydneX1wekoaZXfRVn-2g@qcislands.net>

I've recently installed FreeBSD 5.3 with Perl 5.8.6
For unknown reasons they (FreeBSD) do not have a GDBM module
available, however they advise to simply re-compile perl
with GDBM native support.

I've done that, and perl compiled without issue.
A "make test" didn't find anything unusual.

However I run a webmail application which uses perl & gdbm
which is called "emu webmail". It now, with this new setup
shows an error message at the bottom of each of it's
generated web pages which appears to be a low-level perl (or
GDBM) complaint which reads:

     Can't cd to : Inappropriate ioctl for device

I recently switched from FreeBSD 4.9, and with THAT version
(perl 5.005_03) they did indeed have a GDBM "module". .. and,
emu webmail worked just fine.

Can anyone offer a suggestion where to begin troubleshooting
this? EMU tech support claims that FreeBSD must have a problem
with their GDBM/perl system. FreeBSD newsgroup doesn't seem
interested in my problem, so I am kinda stuck.

Is there a way (or program available) to run perl & gdbm through
a test suite?

any suggestions will be gratefully received.

Thanks,
Jim


------------------------------

Date: Tue, 08 Feb 2005 13:07:51 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: should be simple..but eh  Can you help
Message-Id: <4nmzuf2adk.fsf@lifelogs.com>

On Tue, 8 Feb 2005, bernard.el-haginDODGE_THIS@lido-tech.net wrote:

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> 
> [...]
> 
>> By the way, minor but important point
> 
> 
> Can something be minor *and* important? ;-)

Absolutely.

Aminor is a very important chord.  "House of the Rising Sun" starts
with it.

Ted


------------------------------

Date: 8 Feb 2005 08:19:08 -0800
From: ioneabu@yahoo.com
Subject: Re: Trouble with Regexps
Message-Id: <1107879548.187358.45260@c13g2000cwb.googlegroups.com>


Gunnar Hjalmarsson wrote:

> >         if ($_ !~ /^@+$/)
> --------------------^^^^^^
> What do you think that does? You probably mean:
>
>          if ( $_ !~ /^\@+$/ )
> or (cleaner)
>          unless ( /^\@+$/ )
> >         {
> >                 @record = /(.+)\s{2,}(.+)\s{2,}(.+)/;
> >         }
> >         push @$arrayref, [ @record ];
> The push() statement should be in the inner block, shouldn't it?
>          {
>                  @record = /(.+)\s{2,}(.+)\s{2,}(.+)/;
>                  push @$arrayref, [ @record ];
>          }
> >         print "$_->[0]\t$_->[1]\t$_->[2]\n" if scalar @$_ == 3;
> ---------------------------------------------^^^^^^^^^^^^^^^^^^^
> With the above changes, that condition is redundant.

> Nevertheless, I think you missed the point. What's now $arrayref->[0]

> and $arrayref->[1] should be merged to one record. See above quote
from
> the OP.

Thanks for the tips.  I was just looking at the visual format of the
input and desired output so I didn't totally get what he wanted.

wana



------------------------------

Date: Tue, 08 Feb 2005 17:04:20 +0100
From: Ralf Schaa <schaa@geo.uni-koeln.de>
Subject: Re: www::mechanize $mech->select
Message-Id: <36s6rlF55q6g8U2@individual.net>

Thank you Paul.

I had  the ppm version of WWW::Mechanize (0.74) and that can't do the 
job. Now I have installed the 1.1 version by hand and it looks good now.

regards
-Ralf


Paul Lalli wrote:

> "Ralf Schaa" <schaa@geo.uni-koeln.de> wrote in message
> news:36hj7fF513lo6U1@individual.net...
> 
>>according the document there is a method 'select' in the
> 
> www::mechanize
> 
>>package
> 
> 
> You probably mean the WWW::Mechanize package.  Case matters.
> 
> 
>>, trying the following i get an error mesage:
>>
>>$mech->form(0);
>>$mech->select("var select", 17);
>>
>>Error: Can't locate object method "select" via package WWW::Mechanize
>>
>>could someone tell me what is going on here ?
> 
> 
> What version of WWW::Mechanize are you using?  To find out, print the
> variable
> $WWW::Mechanize::VERSION
> 
> The latest on CPAN appears to be 1.10   If your version is less than
> that, consider upgrading.  If not, please post a *short* but *complete*
> script that demonstrates this error.
> 
> Paul Lalli
> 


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 7754
***************************************


home help back first fref pref prev next nref lref last post