[30883] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2128 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 15 06:09:40 2009

Date: Thu, 15 Jan 2009 03:09:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 15 Jan 2009     Volume: 11 Number: 2128

Today's topics:
        [DGBI] to die or not to die (was: opening a file) <whynot@pozharski.name>
    Re: [DGBI] to die or not to die (was: opening a file) <tim@burlyhost.com>
    Re: Arrays instead of files into hashes <massion@gmx.de>
    Re: Circular lists <xhoster@gmail.com>
    Re: Circular lists <jurgenex@hotmail.com>
    Re: Circular lists xhoster@gmail.com
    Re: Circular lists <gamo@telecable.es>
        new CPAN modules on Thu Jan 15 2009 (Randal Schwartz)
    Re: opening a file <Peter@PSDT.com>
    Re: unable to open file <Tintin@teranews.com>
    Re: unable to open file <1usa@llenroc.ude.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Jan 2009 01:41:57 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: [DGBI] to die or not to die (was: opening a file)
Message-Id: <slrngmsu3n.hgf.whynot@orphan.zombinet>

On 2009-01-14, Jürgen Exner <jurgenex@hotmail.com> wrote:
> cartercc <cartercc@gmail.com> wrote:
>>On Jan 10, 8:07 am, Tad J McClellan <ta...@seesig.invalid> wrote:
>>> You should always, yes *always*, check the return value from open():
>>
>>Like other ironclad rules, this also has exceptions. Using the 'or
>>die' construct has costs (albeit minimal) 
>
> Cost in terms of what? In terms of execution time or memory should be
> negligable except in very extreme cases, in particular because accessing
> the file system  is so expensive on the OS side anyway that you will
> probably have difficulties even measuring the additional cost of die().

I can't say for cartercc, but I have difficulties obviously

perl -wle '
use Benchmark qw|countit cmpthese timethese|;
my $lit = qq{abc\txyz};
my $t = timethese 50_000, {
        die => sub { open my $fh, q|>|, q|/dev/null| or die; },
        maybe => sub { open(my $fh, q|>|, q|/dev/null|) || die; },
        live => sub { open my $fh, q|>|, q|/dev/null|; }, };
cmpthese $t;
'
Benchmark: 
timing 50000 iterations of
 die, live, maybe
 ...

       die:  4 wallclock secs ( 1.80 usr +  0.91 sys =  2.71 CPU) @
18450.18/s (n=50000)

      live:  3 wallclock secs ( 1.60 usr +  0.99 sys =  2.59 CPU) @
19305.02/s (n=50000)

     maybe:  3 wallclock secs ( 1.72 usr +  0.90 sys =  2.62 CPU) @
19083.97/s (n=50000)

         Rate   die maybe  live
die   18450/s    --   -3%   -4%
maybe 19084/s    3%    --   -1%
live  19305/s    5%    1%    --

         Rate   die maybe  live
die   19608/s    --   -2%   -2%
maybe 20000/s    2%    --   -0%
live  20080/s    2%    0%    --

         Rate   die maybe  live
die   19380/s    --   -1%   -2%
maybe 19531/s    1%    --   -1%
live  19763/s    2%    1%    --

And once I've even had that (though failed to recreate)

        Rate live  die
live 20000/s   --  -1%
die  20161/s   1%   --

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Wed, 14 Jan 2009 18:37:26 -0800
From: Tim Greer <tim@burlyhost.com>
Subject: Re: [DGBI] to die or not to die (was: opening a file)
Message-Id: <Hjxbl.76852$ln7.59067@newsfe04.iad>

Eric Pozharski wrote:

> On 2009-01-14, Jürgen Exner <jurgenex@hotmail.com> wrote:
>> cartercc <cartercc@gmail.com> wrote:
>>>On Jan 10, 8:07 am, Tad J McClellan <ta...@seesig.invalid> wrote:
>>>> You should always, yes *always*, check the return value from
>>>> open():
>>>
>>>Like other ironclad rules, this also has exceptions. Using the 'or
>>>die' construct has costs (albeit minimal)
>>
>> Cost in terms of what? In terms of execution time or memory should be
>> negligable except in very extreme cases, in particular because
>> accessing
>> the file system  is so expensive on the OS side anyway that you will
>> probably have difficulties even measuring the additional cost of
>> die().
> 
> I can't say for cartercc, but I have difficulties obviously
> 
> perl -wle '
> use Benchmark qw|countit cmpthese timethese|;
> my $lit = qq{abc\txyz};
> my $t = timethese 50_000, {
>         die => sub { open my $fh, q|>|, q|/dev/null| or die; },
>         maybe => sub { open(my $fh, q|>|, q|/dev/null|) || die; },
>         live => sub { open my $fh, q|>|, q|/dev/null|; }, };
> cmpthese $t;
> '
> Benchmark:
> timing 50000 iterations of
>  die, live, maybe
> ...
> 
>        die:  4 wallclock secs ( 1.80 usr +  0.91 sys =  2.71 CPU) @
> 18450.18/s (n=50000)
> 
>       live:  3 wallclock secs ( 1.60 usr +  0.99 sys =  2.59 CPU) @
> 19305.02/s (n=50000)
> 
>      maybe:  3 wallclock secs ( 1.72 usr +  0.90 sys =  2.62 CPU) @
> 19083.97/s (n=50000)
> 
>          Rate   die maybe  live
> die   18450/s    --   -3%   -4%
> maybe 19084/s    3%    --   -1%
> live  19305/s    5%    1%    --
> 
>          Rate   die maybe  live
> die   19608/s    --   -2%   -2%
> maybe 20000/s    2%    --   -0%
> live  20080/s    2%    0%    --
> 
>          Rate   die maybe  live
> die   19380/s    --   -1%   -2%
> maybe 19531/s    1%    --   -1%
> live  19763/s    2%    1%    --
> 
> And once I've even had that (though failed to recreate)
> 
>         Rate live  die
> live 20000/s   --  -1%
> die  20161/s   1%   --
> 
> *CUT*
> 

I'd be curious to see the processing "costs" involved with the code that
would follow due to lack of a check on opening a file, compared to
skipping the code that would otherwise follow (or died or gracefully
moved on, whatever one wanted to do), where the lack of checking for a
failure or not would error (for example on reading from or writing to a
filehandle that wasn't ever opened).  I'm thinking the costs would be
higher then, by a lot, depending on what the code would do (which would
be the other way you'd (maybe) see there was an issue with the file not
being opened).
-- 
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting.  24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!


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

Date: Thu, 15 Jan 2009 01:03:49 -0800 (PST)
From: Francois Massion <massion@gmx.de>
Subject: Re: Arrays instead of files into hashes
Message-Id: <07304129-6706-4a95-8703-8a51c83b083d@f29g2000vbf.googlegroups.com>

On 13 Jan., 19:09, Francois Massion <mass...@gmx.de> wrote:
> On 13 Jan., 01:41, Tim Greer <t...@burlyhost.com> wrote:
>
>
>
>
>
> > s...@netherlands.com wrote:
> > > On Mon, 12 Jan 2009 17:55:36 -0600, Tad J McClellan
> > > <ta...@seesig.invalid> wrote:
>
> > >>Francois Massion <mass...@gmx.de> wrote:
>
> > >>> I would like to use 2 arrays, says @array1 and
> > >>> @array2 instead of files a.txt and b.txt.
>
> > >>> while (<WORDLIST2>) {
> > >>> =A0 =A0 $list2{$_}=3D1; #or any other value
> > >>> }
>
> > >> =A0 =A0my @b_txt =3D <WORDLIST2>;
> > > Isin't slurp a bit rich?
> > > [snip]
>
> > > sln
>
> > Probably, but that's what the OP asked for. =A0I can't imagine why, but
> > perhaps they just need to elaborate on their reasons to get a good
> > answer. =A0Personally, I didn't answer them, because I had to ask what
> > they were wanting to do, since it didn't seem clear to me (or didn't
> > seem to have a purpose and would just waste good processing).
> > --
> > Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
> > Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
> > and Custom Hosting. =A024/7 support, 30 day guarantee, secure servers.
> > Industry's most experienced staff! -- Web Hosting With Muscle!- Zitiert=
en Text ausblenden -
>
> > - Zitierten Text anzeigen -
>
> Thanks to all for your contributions. I'll have to try them out. The
> background for my asking (as a non-pro) is the following. I am doing
> terminology extraction for linguistic purposes. Thus I take a text,
> split it up in words or expressions and perform various "refining"
> operations in order to get only the clean interesting terms as they
> appear in a dictionary. Each operation is currently a small amateurish
> little script and the output is anarraywhich I can display in a file
> or on screen.
>
> Now I want to automate all these single steps into one operation which
> means that instead of reading word lists from text files I would like
> to use the arrays generated by the previous step. This is the reason
> for the question above. I have 2 different files as the result of 2
> previous steps and the difference are the words which are interesting
> for my terminology work. I hope this helps.- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Thanks to all. Basically the solution to my problem seems to be:

my %in_array2 =3D map { $_ =3D> 1 } @array2;
my @array3 =3D grep { !$in_array2{$_} } @array1;

It works as expected. I just need to solve 2 problems not directly
related to my question:
i) When I output @array3 I get a space before each entry
ii) no matter how I encode the files (ascii, unicode, "use utf8" etc)
special characters (like the German Umlaut) are corrupt and the output
file is in UTF8).

I'll find a solution but maybe someone knows already the answer...


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

Date: Wed, 14 Jan 2009 18:17:34 -0800
From: Xho Jingleheimerschmidt <xhoster@gmail.com>
Subject: Re: Circular lists
Message-Id: <496e9f60$0$25467$ed362ca5@nr5c.newsreader.com>

gamo wrote:
> On Mon, 12 Jan 2009, Jürgen Exner wrote:
> ...
>> eaabbbccccdddddeeeee
>>
>> Some of these may be identical and thus reduce the number of results
>> (which they are not in this example), but how did you get 5.3 million
>> candidates?
>>
>> jue

He's looking at all permutations of those letters, not just the original
   specified order.

>>	
> 
> @a = qw(a a b b b c c c c d d d d d e e e e e e);
> $n = @a;
> for (1..10_000_000){
>     @set = shuffle(@a);
>     $s = join '',@set;
>     $two = $s . $s;
>     $clist{$s}++;
 ...
> 
> After a while, taking keys %clist gives you lists that neither
> is a rotation of another, nor there are duplicates. 

%clist is populated unconditionally.  Being a hash, it of course will
not have duplicates, but there is nothing to prevent it from having
things that are rotations of previous things.  So it will end up having
them.

> But the 
> experiment fails because the numbers Xho shows. It's exponential,
> and intractable. 
> 
> Best regards,
> 
> PS: Xho, I need to have the $clist and $hash in ram to make 
> comparisons with a new candidate. C is no necesary since 
> perl fill the memory in a moment. 8-)

It fills memory only because that is they way you insist on implementing
it.  If you made use of my distinct permutation generator, you would not
need to use RAM to guard against degenerate linear permutations.  If you
made use of canonicalization, you would not need to use RAM to guard
against each different rotational representation.  Finally, if you use
my last suggestion to store a linear permutation if and only if it's
rotational canonicalization is equal to the original linear permutation
itself, then you wouldn't even need RAM to guard against duplicate
canonical representations.  You could write those representations
directly to disk without storing them in RAM, knowing that each one
would only end up on disk exactly once.  Then the only practical issues
of tractability would be CPU time and disk space, not RAM at all.

Xho




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

Date: Wed, 14 Jan 2009 21:03:13 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Circular lists
Message-Id: <3mgtm4la94gjpbc0c0k71s5gol4pcnh4g8@4ax.com>

Xho Jingleheimerschmidt <xhoster@gmail.com> wrote:
>gamo wrote:
>> On Mon, 12 Jan 2009, Jürgen Exner wrote:
>> ...
>>> eaabbbccccdddddeeeee
>>>
>>> Some of these may be identical and thus reduce the number of results
>>> (which they are not in this example), but how did you get 5.3 million
>>> candidates?
>
>He's looking at all permutations of those letters, not just the original
>   specified order.

Oh, ok, thanks. First time someone mentioned that. 

But there are proven and established ways to generate all permutations
of a given (multi)-set of items. Why don't those work?

And second question: why is he talking about circular lists (of the
original order?)?

jue


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

Date: 15 Jan 2009 05:47:10 GMT
From: xhoster@gmail.com
Subject: Re: Circular lists
Message-Id: <20090115004942.226$MI@newsreader.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
> Xho Jingleheimerschmidt <xhoster@gmail.com> wrote:
> >gamo wrote:
> >> On Mon, 12 Jan 2009, Jürgen Exner wrote:
> >> ...
> >>> eaabbbccccdddddeeeee
> >>>
> >>> Some of these may be identical and thus reduce the number of results
> >>> (which they are not in this example), but how did you get 5.3 million
> >>> candidates?
> >
> >He's looking at all permutations of those letters, not just the original
> >   specified order.
>
> Oh, ok, thanks. First time someone mentioned that.

It's an XYZ thing.  He wants all distinct circular lists that could be made
with arrangements of those letters.  Distinct linear permutations is a
useful intermediate step in getting there.

>
> But there are proven and established ways to generate all permutations
> of a given (multi)-set of items. Why don't those work?

Are any of them on CPAN?  I couldn't find any so made a couple of my own.

> And second question: why is he talking about circular lists (of the
> original order?)?

Circle "lists" (I'd call it circularly distinct strings) are the ultimate
goal. Distinct linear permutations are a useful intermediate in reaching
that goal.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 15 Jan 2009 11:54:18 +0100
From: gamo <gamo@telecable.es>
Subject: Re: Circular lists
Message-Id: <alpine.LNX.2.00.0901151138200.6072@jvz.es>

On Wed, 14 Jan 2009, Xho Jingleheimerschmidt wrote:

> > After a while, taking keys %clist gives you lists that neither
> > is a rotation of another, nor there are duplicates. 
> 
> %clist is populated unconditionally.  Being a hash, it of course will
> not have duplicates, but there is nothing to prevent it from having
> things that are rotations of previous things.  So it will end up having
> them.
> 

The string is tested against %hash, which cointains all the rotations of
previous unique lists. So, I don't expect there will be duplicates in 
%clist. Note that every unique list as soon as is discovered populates
%hash with all of it's rotations (from the first).

> > PS: Xho, I need to have the $clist and $hash in ram to make comparisons with
> > a new candidate. C is no necesary since perl fill the memory in a moment.
> > 8-)
> 
> It fills memory only because that is they way you insist on implementing
> it.  If you made use of my distinct permutation generator, you would not
> need to use RAM to guard against degenerate linear permutations.  If you
> made use of canonicalization, you would not need to use RAM to guard

I didn't understood the method of "canonicalization"

> against each different rotational representation.  Finally, if you use
> my last suggestion to store a linear permutation if and only if it's
> rotational canonicalization is equal to the original linear permutation
> itself, then you wouldn't even need RAM to guard against duplicate
> canonical representations.  You could write those representations
> directly to disk without storing them in RAM, knowing that each one
> would only end up on disk exactly once.  Then the only practical issues
> of tractability would be CPU time and disk space, not RAM at all.
> 
> Xho
> 

That would be great. Best regards, 
 
-- 
http://www.telecable.es/personales/gamo/
"Was it a car or a cat I saw?"
perl -E 'say 111_111_111**2;'


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

Date: Thu, 15 Jan 2009 05:42:25 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jan 15 2009
Message-Id: <KDHzup.JDt@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

Acme-State-0.03
http://search.cpan.org/~swalters/Acme-State-0.03/
Save application state on exit and restores state on startup 
----
App-Navegante-0.01
http://search.cpan.org/~smash/App-Navegante-0.01/
a framework to build intrusive high order proxies 
----
Audio-Extract-PCM-0.03_01
http://search.cpan.org/~pepe/Audio-Extract-PCM-0.03_01/
Extract PCM data from audio files 
----
Builder-0.03
http://search.cpan.org/~draegtun/Builder-0.03/
Build XML, HTML, CSS and other outputs in blocks 
----
CatalystX-CRUD-0.39
http://search.cpan.org/~karman/CatalystX-CRUD-0.39/
CRUD framework for Catalyst applications 
----
CatalystX-CRUD-YUI-0.013
http://search.cpan.org/~karman/CatalystX-CRUD-YUI-0.013/
YUI for your CatalystX::CRUD view 
----
Data-TreeDumper-Utils-0.02.6
http://search.cpan.org/~nkh/Data-TreeDumper-Utils-0.02.6/
A selection of utilities to use with Data::TreeDumper 
----
Data-TreeDumper-Utils-0.03.7
http://search.cpan.org/~nkh/Data-TreeDumper-Utils-0.03.7/
A selection of utilities to use with Data::TreeDumper 
----
Debug-Mixin-0.4.4
http://search.cpan.org/~nkh/Debug-Mixin-0.4.4/
Make your applications and modules easier to debug 
----
Deliantra-1.23
http://search.cpan.org/~mlehmann/Deliantra-1.23/
Deliantra suppport module to read/write archetypes, maps etc. 
----
Dotiac
http://search.cpan.org/~maluku/Dotiac/
----
Dotiac-0.1
http://search.cpan.org/~maluku/Dotiac-0.1/
----
File-Find-Repository-0.03.3
http://search.cpan.org/~nkh/File-Find-Repository-0.03.3/
Find files in your repositories. 
----
File-Path-Collapse-0.02.6
http://search.cpan.org/~nkh/File-Path-Collapse-0.02.6/
Collapses a path as much as possible 
----
File-Path-Collapse-0.03.7
http://search.cpan.org/~nkh/File-Path-Collapse-0.03.7/
Collapses a path as much as possible 
----
File-Stat-Moose-0.05
http://search.cpan.org/~dexter/File-Stat-Moose-0.05/
Status info for a file - Moose-based 
----
Filter-Uncomment-0.03.3
http://search.cpan.org/~nkh/Filter-Uncomment-0.03.3/
Efficiently uncomment sections of your code 
----
HTML-TurboForm-0.32
http://search.cpan.org/~camelcase/HTML-TurboForm-0.32/
----
Image-TextMode-0.02
http://search.cpan.org/~bricas/Image-TextMode-0.02/
Create, manipulate and save text mode images 
----
Lingua-Jspell-1.58
http://search.cpan.org/~ambs/Lingua-Jspell-1.58/
Perl interface to the Jspell morphological analyser. 
----
List-Tuples-0.04.4
http://search.cpan.org/~nkh/List-Tuples-0.04.4/
Makes tuples from lists 
----
Module-Build-0.31012
http://search.cpan.org/~ewilhelm/Module-Build-0.31012/
Build and install Perl modules 
----
Module-Text-Template-Build-0.04.7
http://search.cpan.org/~nkh/Module-Text-Template-Build-0.04.7/
Create a module based on a template to use with Module::Build 
----
Net-Address-IP-Local-0.1.2
http://search.cpan.org/~jmehnle/Net-Address-IP-Local-0.1.2/
A class for discovering the local system's IP address 
----
Net-SMS-ASPSMS-0.1.1
http://search.cpan.org/~supcik/Net-SMS-ASPSMS-0.1.1/
Interface to ASMSMS services 
----
ODG-Record-0.30
http://search.cpan.org/~ctbrown/ODG-Record-0.30/
Perl extension for efficient and simple manipulation of row-based records. 
----
ORLite-Pod-0.02
http://search.cpan.org/~adamk/ORLite-Pod-0.02/
Documentation generator for ORLite 
----
PAR-Repository-Client-0.21_03
http://search.cpan.org/~smueller/PAR-Repository-Client-0.21_03/
Access PAR repositories 
----
POD-Tested-0.06.2
http://search.cpan.org/~nkh/POD-Tested-0.06.2/
Test the code in your POD and generates POD. 
----
POE-Component-Server-Twirc-0.04
http://search.cpan.org/~mmims/POE-Component-Server-Twirc-0.04/
Twitter/IRC gateway 
----
POE-Component-Server-Twirc-0.05
http://search.cpan.org/~mmims/POE-Component-Server-Twirc-0.05/
Twitter/IRC gateway 
----
Parse-ISF-0.0101
http://search.cpan.org/~razor/Parse-ISF-0.0101/
Parse the ISF file generated by certain models of Tektronix oscillascope (TDS 3000, DPO 4000, etc) 
----
Proc-Safetynet-0.04
http://search.cpan.org/~dtady/Proc-Safetynet-0.04/
POE-based utility for supervising processes 
----
Provision-Unix-0.36
http://search.cpan.org/~msimerson/Provision-Unix-0.36/
provision accounts on unix systems 
----
RDF-RDFa-Parser-0.03
http://search.cpan.org/~tobyink/RDF-RDFa-Parser-0.03/
RDFa parser using XML::LibXML. 
----
RDF-RDFa-Parser-0.04
http://search.cpan.org/~tobyink/RDF-RDFa-Parser-0.04/
RDFa parser using XML::LibXML. 
----
Scalar-Cycle-Manual-0.03.6
http://search.cpan.org/~nkh/Scalar-Cycle-Manual-0.03.6/
Cycle through a list of values (with optional automatic incrementation) 
----
Simo-0.03_03
http://search.cpan.org/~kimoto/Simo-0.03_03/
Very simple framework for Object Oriented Perl. 
----
Simo-0.03_04
http://search.cpan.org/~kimoto/Simo-0.03_04/
Very simple framework for Object Oriented Perl. 
----
Term-Bash-Completion-Generator-0.02.8
http://search.cpan.org/~nkh/Term-Bash-Completion-Generator-0.02.8/
Generate bash completion scripts 
----
Test-Cookbook-0.05.2
http://search.cpan.org/~nkh/Test-Cookbook-0.05.2/
Write your tests as cookbooks 
----
Tripletail-0.45
http://search.cpan.org/~hio/Tripletail-0.45/
Tripletail, Framework for Japanese Web Application 
----
UMLS-Interface-0.09
http://search.cpan.org/~btmcinnes/UMLS-Interface-0.09/
README 
----
UMLS-Similarity-0.03
http://search.cpan.org/~btmcinnes/UMLS-Similarity-0.03/
This is a suite of Perl modules that implements a number of measures of semantic relatedness. These algorithms use the UMLS-Interface module to access teh Unified Medical Language System (UMLS) to gen
----
Unicode-Property-XS-0.81
http://search.cpan.org/~mindos/Unicode-Property-XS-0.81/
Unicode properties implemented by lookup table in C code. 
----
WWW-TinySong-0.04
http://search.cpan.org/~miorel/WWW-TinySong-0.04/
Get free music links using TinySong 
----
WWW-Tube8-0.0.4
http://search.cpan.org/~bayashi/WWW-Tube8-0.0.4/
Get video informations from tube8.com 
----
WordNet-SenseKey-1.03
http://search.cpan.org/~linas/WordNet-SenseKey-1.03/
convert WordNet sense keys to sense numbers, and v.v. 
----
ZConf-BGSet-0.0.0
http://search.cpan.org/~vvelox/ZConf-BGSet-0.0.0/
A perl module for background management. 
----
local-lib-1.003000
http://search.cpan.org/~apeiron/local-lib-1.003000/
create and use a local lib/ for perl modules with PERL5LIB 
----
local-lib-1.003001
http://search.cpan.org/~apeiron/local-lib-1.003001/
create and use a local lib/ for perl modules with PERL5LIB 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


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

Date: Thu, 15 Jan 2009 05:02:33 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: opening a file
Message-Id: <Jrzbl.15967$u14.2479@newsfe21.iad>

On Wed, 14 Jan 2009 09:03:42 -0800, cartercc wrote:
> For another example, consider warnings. One of my tasks is to process a
> file which may consists of several hundred thousand rows, totaling
> different kinds of values. When I run the script with warnings, I get an
> uninitialized value warning for every row printed to the screen, and the
> script takes a significant amount of time to run. When I run the script
> without warnings, the script runs quickly. To silence the warnings I can
> either (1) initialize a hash value for each row, or (2) run without
> warnings. I choose (2).
> 
> Again, this isn't a big deal, and I TOTALLY AGREE that the return value
> for open() should generally be checked, and that warnings should
> generally be enables. However, for the reasons I stated, I often don't
> do this, and I am perfectly willing to accept the consequences.

You're an accident waiting to happen.  When it does, I only hope that you 
realize that it was a consequence of your poor discipline and not the 
computer victimizing you.

If you don't take care with writing programs that are just for you, why 
should anyone trust that you're going to get them right when you're under 
pressure to deliver for someone else?

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


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

Date: Thu, 15 Jan 2009 19:49:38 +1300
From: "Tintin@teranews.com" <Tintin@teranews.com>
Subject: Re: unable to open file
Message-Id: <e0Bbl.37479$JA5.36671@newsfe08.iad>

Tad J McClellan wrote:
> Tintin@teranews.com <Tintin@teranews.com> wrote:
> 
>> Forgot to mention that the standard Perl FindBin module is useful for 
>> working out working directories.
> 
> 
> No it isn't.
> 
> It is useful for allowing relative paths in "use lib".
> 
> It does not help with normal filesystem access.

OK, poorly phrased.  What I meant to say is that's it's useful for 
finding out the directory where the script was invoked from as this can 
be used to reference relative paths.

From

perldoc FindBin

         $Bin - path to bin directory from where script was invoked





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

Date: Thu, 15 Jan 2009 07:56:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: unable to open file
Message-Id: <Xns9B941DEB7E281asu1cornelledu@127.0.0.1>

Tad J McClellan <tadmc@seesig.invalid> wrote in 
news:slrngmspf6.6un.tadmc@tadmc30.sbcglobal.net:

> Ken Teague <"kteague at pobox dot com"> wrote:
>> Tad J McClellan wrote:
> 
> [ There's a missing attribution here... ]
> 
>>>> Is there
>>>> a way I could avoid absolute paths?
> 
> 
> Yes.
> 
> Configure your new web server the way the old one was configured
> (with the cwd set to the cgi-bin/ or whatever).
> 
> 
>>   chdir('E:\\0\\0\\25\\44\\188533\\user\\191178\\htdocs\\')
> 
> 
> Gak! What's with all the doubled backslashes?
> 
> You only need one of them.

I kinda prefer, mostly for visual and cosmetic reasons as I get dizzy 
looking at so many slashes regardless of the way they slant or whether 
they are escaped, using File::Spec for this purpose.

#!/usr/bin/perl

use strict;
use warnings;

use File::Spec::Functions qw( catfile );

my $dir = catfile qw( E: 0 0 25 44 188533 user 191178 htdocs );

print "$dir\n";

__END__


Of course, the OP's life would be made easier if he simply added a 
variable:

my $DATA_DIR = 'some path here';

and specified any output file path using that variable. E.g.,

my $report_file = catfile $DATA_DIR, 'report-20090115-091205aa.txt';

The OP should keep in mind that working files produced with CGI scripts 
should not be kept in web accessible directory *unless* that is 
explicitly the purpose of the script.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


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

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


Administrivia:

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

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

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

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

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


------------------------------
End of Perl-Users Digest V11 Issue 2128
***************************************


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