[30534] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1777 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 7 09:09:44 2008

Date: Thu, 7 Aug 2008 06:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 7 Aug 2008     Volume: 11 Number: 1777

Today's topics:
    Re: a weird problem <tadmc@seesig.invalid>
    Re: bidding advice for a contract <mjcarman@mchsi.com>
    Re: bidding advice for a contract <cartercc@gmail.com>
    Re: CLPM - a help group? <tadmc@seesig.invalid>
    Re: CLPM - a help group? <RedGrittyBrick@SpamWeary.foo>
    Re: EPIC and "my" variables <waveright@gmail.com>
    Re: FAQ 4.36 How can I expand variables in text strings <whynot@pozharski.name>
    Re: FAQ 4.36 How can I expand variables in text strings <whynot@pozharski.name>
    Re: How to flush STDIN with getc()? <hjp-usenet2@hjp.at>
        Installing CPAN modules in production system <yogeshkagrawal@gmail.com>
    Re: Installing CPAN modules in production system <soup_or_power@yahoo.com>
    Re: Installing CPAN modules in production system <tzz@lifelogs.com>
        make pipes hot (was: a weird problem) <tzz@lifelogs.com>
    Re: Need help with perlxs and C strings <th@example.invalid>
    Re: nested strings <hjp-usenet2@hjp.at>
    Re: nested strings <hjp-usenet2@hjp.at>
    Re: nested strings <tzz@lifelogs.com>
        new CPAN modules on Thu Aug  7 2008 (Randal Schwartz)
    Re: subcommand within Perl script <tadmc@seesig.invalid>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 6 Aug 2008 20:26:54 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: a weird problem
Message-Id: <slrng9kjqu.sbm.tadmc@tadmc30.sbcglobal.net>

Zhiliang Hu <zhilianghu@gmail.com> wrote:
> I have a perl script that takes a while to run.  I inserted a few
> lines in the program to print some progress messages to the console
> (STDOUT) so I know where it is at, like:
>
> #!/usr/bin/perl
> print STDOUT "Please wait "; #-- This is the very first line in the
> script
> open(FILE,">localfile");


You should always, yes *always*, check the return value from open():

   open(FILE,">localfile") || die "could not open 'localfile' $!";

You should really be using the 3-argument form of open with
a lexical filehandle:

   open my $FILE, '>', 'localfile' or die "could not open 'localfile' $!";


> use DBI;


The 3rd line of your program happens before the 1st and 2nd lines.

That can lead to confusion. It would be better to put what happens
first at the beginning of the program rather than in the middle.


>       print FILE "--some stuff...\n";


   print $FILE "--some stuff...\n";  # with a lexical filehandle


>       print STDOUT  "...";


> But it prints out nothing to the screen until the very end, when it
> finishes, it dumps all for STDOUT at once to the screen.


It is clear that you are

   Suffering from Buffering

      http://perl.plover.com/FAQs/Buffering.html


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Thu, 07 Aug 2008 02:25:30 GMT
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: bidding advice for a contract
Message-Id: <u2tmk.286932$yE1.145826@attbi_s21>

cartercc wrote:
> What you say may (note: 'may') be true from a theoretical standpoint,

It is true.

> but I would be very, very surprised if it became a problem.

Just because you're unlikely to get caught doesn't mean that the
behavior is legal or ethical.

> Yesterday afternoon, I mentioned this to my boss, bigger boss, and 
> biggest boss, and they all thought I had gone bonkers.

Apparently your current employer doesn't place much value on the IP of
source code. I assure you that the attitude is not universal.

> what's the difference if I write code for work, then go to a second
> job and write essentially the identical code to solve the same
> problem, and then go home and write essentially the same code to some
> the same problem for a non-profit that I volunteer for?

There's a difference between leveraging general programming knowledge
(algorithms, data structures, etc.) acquired during the course of your
employment and re-using the solution to a particular problem. Even if 
you rewrite the code from memory you could still create a legal quagmire 
for yourself and your employer(s).

> You are the only person that seems to think it is a problem. 

No, he isn't. It seems to me that you're too far removed from the 
reality that the rest of us live in to bother trying to persuade, 
though. Perhaps others have had the same thought and remained silent.

-mjc


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

Date: Thu, 7 Aug 2008 05:36:31 -0700 (PDT)
From: cartercc <cartercc@gmail.com>
Subject: Re: bidding advice for a contract
Message-Id: <1e11bd21-4c2c-43a0-ade1-71e17216b946@2g2000hsn.googlegroups.com>

On Aug 6, 10:25 pm, Michael Carman <mjcar...@mchsi.com> wrote:
> cartercc wrote:
> > What you say may (note: 'may') be true from a theoretical standpoint,
>
> It is true.

I don't think that it's true. Of course, this is a different statement
from the statement that some think that it's false. Law is a man-made
artifact that changes over time, sometimes rapidly.

> Just because you're unlikely to get caught doesn't mean that the
> behavior is legal or ethical.

Just as there's a difference between morals and ethics, there's a
difference between legality and ethics. Sometimes they conflict and an
ethical code may bound you to commit a crime. This isn't a
hypothetical situation, I can give some concrete examples of
situations that I have personal knowledge of that illustrate this.

Going a little bit further, sometimes laws have to be broken in the
interest of justice, for example, the Jim Crow laws in the American
South several decades ago. No one suggests that MLK Jr was immoral for
breaking these laws and getting arrested, charged, tried, and
convicted.

> Apparently your current employer doesn't place much value on the IP of
> source code. I assure you that the attitude is not universal.

My present employer is barred by law from deriving any commercial
advantage from this kind of work product. As was Bell Labs in the
development of UNIX, which is why they gave it away.

> There's a difference between leveraging general programming knowledge
> (algorithms, data structures, etc.) acquired during the course of your
> employment and re-using the solution to a particular problem. Even if
> you rewrite the code from memory you could still create a legal quagmire
> for yourself and your employer(s).

How many times have you written something like this:
for ($i = 0; $i < $var; $i++) {...}
while(1) { ... if($var) {last); ...}
my ($count, $sum, $average);

???

I don't know about you, but I'm like a rat that runs a particular
trace. I don't reinvent solutions to problems I've solved every time I
have the same old problem. I use the same old solution. If you say
that this is a crime, I'm guilty.

> No, he isn't. It seems to me that you're too far removed from the
> reality that the rest of us live in to bother trying to persuade,
> though. Perhaps others have had the same thought and remained silent.

I have my reality, you have yours. I doubt that I'm going to be
indicted for what I do. Let me reiterate that I don't do P2P, download
movies or songs, or do any of that. I don't even use unlicencsed
instances of software.

CC


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

Date: Wed, 6 Aug 2008 20:55:17 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: CLPM - a help group?
Message-Id: <slrng9klg5.sbm.tadmc@tadmc30.sbcglobal.net>

Adam Worrall <worrall+unet@cs.bris.ac.uk> wrote:
> RedGrittyBrick wrote:

>> If I were to say "comp.lang.perl.misc is not a help desk" I would be 
>> merely stating my opinion 


Just as Adam is free to state his opinion that it _is_ a help desk.


>> on the consensus view (as observed by me) of 
>> the main participants

> You're assuming the consensus (as in everyone's opinion) is in agreeance 
> to what you are saying, and that is something you cannot really confirm. 


And neither can you confirm that it is not the consensus.

So where does that leave us?


> further more, stop perpetuating the the false view that all help desks 
> are for paid organizations, as plenty are volunteer-run and many are 
> non-profit.


It is not the pay vs. no pay.

It is the "obligation to help" that most people associate with
a "help desk". I would expect that even volunteers at a help desk
are obligated to deliver help.

There is no obligation to help in clpmisc, which is why people
say that it is not a help desk.


> But it is a known fact that the sky is blue, which is different than a 
> handful of people telling you that a group shouldn't be used in a why 
> _they_ don't happen to approve of.


A person can say that this is a help desk.

A person can say that this is not a help desk.

Each of those people has equal righteousness. (hint, hint)



(
   And I think you do all Perlers a disservice to insist on calling
   this group a "help desk".

   If they begin to actually treat it like a help desk, where they
   expect the fully-formed solution to their problem, then they will
   likely get _less_ help (due to being auto-scored into invisibility).

   Helping folks to get less help is not being helpful.
)

-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Thu, 07 Aug 2008 10:56:40 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: CLPM - a help group?
Message-Id: <489ac6d9$0$2516$da0feed9@news.zen.co.uk>

Adam Worrall wrote:
> RedGrittyBrick wrote:
>> Adam Worrall wrote:
> 
>> When I say "the sky is blue" it is an observation, I am not 
>> legislating what the sky may or may not do.
> 
> But it is a known fact that the sky is blue, 

Today it is grey.

> which is different than a 
> handful of people telling you that a group shouldn't be used in a why 
> _they_ don't happen to approve of.

You miss my point. I can observe that CLPM does not behave like a help 
desk. That does not mean I am "legislating" what CLPM participants may 
do. Whether my observation is right or wrong has no bearing on this.

~~~

Tad probably has it right, some posters presume that readers are under 
some obligation to answer their questions by supplying ready-made solutions.

You often see "if you can't answer my question just shut up" from 
posters new to a newsgroup when faced with a pointer to a FAQ or a 
criticism of their posting style.

Any social group develops customs. It is useful for newcomers to know 
what those are, before they decide whether they want to try and change 
them. I suspect many such customs persist because they help make CLPM a 
useful place.

Many of those who say something like "usenet isn't a help-desk" I 
recognise as long standing participants who have contributed positively 
to this newsgroup over many years and from whom I have learned much 
about Perl. Those who say something like "usenet is a help desk" seem 
not to be such people.

-- 
RGB


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

Date: Wed, 6 Aug 2008 19:52:58 -0700 (PDT)
From: Todd Wade <waveright@gmail.com>
Subject: Re: EPIC and "my" variables
Message-Id: <72aa8134-8ba8-4088-878b-133897591e96@k30g2000hse.googlegroups.com>

On Aug 1, 7:43 pm, rupert <rup...@web-ideas.com.au> wrote:
> i'm tired of VIM...

If you dont mind a suggestion, try Komodo. Its much lighter than
eclipse, but has all the features.

Komodo Edit is free...

I've tried a lot of IDEs, and I'd still have a tough time working
without Komodo.

trwww




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

Date: Wed, 06 Aug 2008 21:11:32 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: FAQ 4.36 How can I expand variables in text strings?
Message-Id: <k36pm5x7op.ln2@carpet.zombinet>

brian d  foy <brian.d.foy@gmail.com> wrote:
> In article <gcnmm5x06a.ln2@carpet.zombinet>, Eric Pozharski
> <whynot@pozharski.name> wrote:

*SKIP*
>> The question states C<How can I expand variables in text strings?>.
>> The unexpert reader (me?) doesn't get why C<q()> is used in place of
>> C<qq()>.  The latter perfectly expands I<$foo> and I<$bar>.
> If we used double quotes, it would interpolate the varaibles and we
> wouldn't have a text string with placeholders that we need to expand,
> and we wouldn't need the answer.

OK, you are writer.  It's up to you would you be kind to reader or not.

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination


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

Date: Wed, 06 Aug 2008 21:14:18 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: FAQ 4.36 How can I expand variables in text strings?
Message-Id: <q86pm5x7op.ln2@carpet.zombinet>

Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth Eric Pozharski <whynot@pozharski.name>:

*CUT*
>> May be I've missed something again, but I failed to find in neither
>> question nor answer any notion that I<$foo> and I<$bar> are undefined
>> at compile time.  BTW, the answer misses either discussion or
>> redirection why C<$string = eval { "Say hello to $foo and $bar"; };>
>> is bad.
> Since that quoted string can never throw an exception[0], the eval {}
> is completely useless. You possibly meant eval STRING rather than eval
> BLOCK: since the /ee modifier on a substitution performs an eval
> STRING, this is what the first answer suggests.

Look, look!  That's the first time someone gussed right what I would
have wanted to say!  May be I become too old.  Yes, my fault.  Lack of
practice.

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination


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

Date: Thu, 7 Aug 2008 13:56:27 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: How to flush STDIN with getc()?
Message-Id: <slrng9lonc.ras.hjp-usenet2@hrunkner.hjp.at>

On 2008-08-06 08:10, Lars Eighner <usenet@larseighner.com> wrote:
> I understand that getc() defaults to STDIN when an argument is not
> specified, and getc() does not work until ENTER is hit at the keyboard
> (i.e. STDIN).

Your understanding is incomplete. getc just gets the next byte from the
input stream. It doesn't care about newlines. The reason why getc
"doesn't work" until you hit enter is that the terminal driver is in a
"line editor" mode: Before you hit enter, you can always erase and
change what you typed. Only when you hit enter (or ctrl-D) the line is
appended to the input stream. Perldoc -f getc telly you how to switch
the terminal into "one character at a time" mode.

	hp


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

Date: Thu, 7 Aug 2008 00:43:35 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Installing CPAN modules in production system
Message-Id: <a7250851-8209-44ec-a270-204499de465a@d77g2000hsb.googlegroups.com>

Hi All,

I am a Perl developer writing some programs to read mails using IMAP/
POP3 modules (and some other modules as well).  I have installed these
modules in our development machine (after trying hard).  Now we have
to ship this product to our client.  My question is, how to make
depedent modules available in production envt?  Merely copying of
these modules to @INC location will work or sysadmin will have to use
CPAN interface to install these modules?

My worry is our client might not be willing to install something
directly to production system (Linux in this case).  Any help as how
these kind of scenarios are dealt?

Thanks a lot for your suggestions.

Regards,
-Y


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

Date: Thu, 7 Aug 2008 05:51:46 -0700 (PDT)
From: "souporpower@gmail.com" <soup_or_power@yahoo.com>
Subject: Re: Installing CPAN modules in production system
Message-Id: <cc581e01-a7bb-42c5-ba3a-1928f3c53916@f63g2000hsf.googlegroups.com>

On Aug 7, 3:43=A0am, Yogi <yogeshkagra...@gmail.com> wrote:
> Hi All,
>
> I am a Perl developer writing some programs to read mails using IMAP/
> POP3 modules (and some other modules as well). =A0I have installed these
> modules in our development machine (after trying hard). =A0Now we have
> to ship this product to our client. =A0My question is, how to make
> depedent modules available in production envt? =A0Merely copying of
> these modules to @INC location will work or sysadmin will have to use
> CPAN interface to install these modules?
>
> My worry is our client might not be willing to install something
> directly to production system (Linux in this case). =A0Any help as how
> these kind of scenarios are dealt?
>
> Thanks a lot for your suggestions.
>
> Regards,
> -Y

When I shopped around for hosting of Perl scripts at godaddy, yahoo,
etc., I was told that they'd
support a few standard modules (e.g. WWW::Mechanize was not installed)
and won't install any
new ones. Looks like you need to talk to the Linux admin. AFAIK, you
can hot-deploy perl modules
if you are the super user.

HTH


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

Date: Thu, 07 Aug 2008 08:03:47 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Installing CPAN modules in production system
Message-Id: <86k5etgeoc.fsf@lifelogs.com>

On Thu, 7 Aug 2008 00:43:35 -0700 (PDT) Yogi <yogeshkagrawal@gmail.com> wrote: 

Y> I am a Perl developer writing some programs to read mails using IMAP/
Y> POP3 modules (and some other modules as well).  I have installed these
Y> modules in our development machine (after trying hard).  Now we have
Y> to ship this product to our client.  My question is, how to make
Y> depedent modules available in production envt?  Merely copying of
Y> these modules to @INC location will work or sysadmin will have to use
Y> CPAN interface to install these modules?

It's best to use CPAN.  If the modules are pure Perl you can just copy
them, but it will create administration issues.

Y> My worry is our client might not be willing to install something
Y> directly to production system (Linux in this case).  Any help as how
Y> these kind of scenarios are dealt?

They are installing your programs, right?  Just ask them to locate the
modules under a different directory and do `use lib ...' to use it.

You can also use PAR, see http://search.cpan.org/dist/PAR/lib/PAR/FAQ.pod#Can_PAR_bundle_all_its_prerequisites?

Ted


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

Date: Thu, 07 Aug 2008 08:00:27 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: make pipes hot (was: a weird problem)
Message-Id: <86od45getw.fsf_-_@lifelogs.com>

On Wed, 6 Aug 2008 23:54:02 +0200 Martijn Lievaart <m@rtij.nl.invlalid> wrote: 

ML> $|=1; # make pipes hot

I've often wondered why there's no command-line switch for this.

Ted


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

Date: Thu, 07 Aug 2008 14:37:33 +0200
From: Thomas <th@example.invalid>
Subject: Re: Need help with perlxs and C strings
Message-Id: <g7eqae$73g$1@aioe.org>

Thanks everyone for your replies so far!

> The "what to do" is implicit.  It is documentation.  It is there to be
> read. read it, if you want to understand what XS.  If you want to flail
> around using the trial and error, then the docs is not what you want.

I've read it twice and am still unsure about what tools to use in what
order. That may be my fault, but the problem is not from lack of trying 
on my part.

> Before discovering the terrifying simplicity of Inline::C, I followed the
> examples given in, ah, some tutorial or another that involved h2xs.  It
> worked to get me a working example.  If it didn't work for you, what can I
> say?  You haven't given us enough details.  If the docs are wrong, we might
> be able to fix them, but not if you hide the errors behind "X" and "Y".

I want to interface with existing C code which is not supposed to be 
copied into the Perl code. But you're right that I wasn't specific 
enough. Here's what I have so far. I just want to get that small example 
running (the set_data code will do something more complicated, but 
that's not the point here):

== setdata.h
void set_data(char * data);
==

== setdata.c
#include "setdata.h"

void set_data(char * data)
{
   data[0] = 'a';
   data[1] = 'c';
   data[2] = '\000';
}
==

== setdata.xs
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "setdata.h"

MODULE = Setdata  PACKAGE = Setdata

void
set_data(data)
    char * data
    OUTPUT:
        data
==

== Setdata.pm
package Setdata;

require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
@EXPORT = qw( set_data );

bootstrap Setdata;
1;
==

== typemap
char* T_PV
==

== runme.pl
use Setdata;

my $x="xxxxxxxx";
set_data($x);
print "Data from C function:\n$x";
==

My Perl version: "This is perl, v5.8.5 built for 
MSWin32-x86-multi-thread". When running

xsubpp setdata.xs > setdata.xsc

I get the following output:
==
Error: No INPUT definition for type 'char *', typekind 'T_PV' found in 
setdata.xs, line 10
Error: No OUTPUT definition for type 'char *', typekind 'T_PV' found in 
setdata.xs, line 12
Please specify prototyping behavior for setdata.xs (see perlxs manual)
==

What would I have to change in the .xs file to get it right?

If it works, what would I have to do with the resulting .xsc file? 
Compile with gcc? Will the resulting object file be sufficient for 
Setdata.pm? Right now, runme.pl simply says

Can't locate loadable object for module Setdata in @INC ( <Perl includes> ).


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

Date: Thu, 7 Aug 2008 11:53:06 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: nested strings
Message-Id: <slrng9lhg3.qhi.hjp-usenet2@hrunkner.hjp.at>

On 2008-08-05 23:42, Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth sausenet@gmail.com:
>> Could anyone suggest a nice way of nesting strings, as follows?
>> 
>> Given: a list of words sorted first in length order, then
>> alphabetically:
[...]
>> 
>> Desired output: the same set of words showing nested substrings
>>     FORMATION [DEFORMATION [DEFORMATIONAL] INFORMATION [INFORMATIONAL]
>> CONFORMATION MALFORMATION]
>>     FORMATIVE [DEFORMATIVE FORMATIVELY [INFORMATIVELY] INFORMATIVE
>> PERFORMATIVE UNINFORMATIVE]
>>     FORMATTER
>>     INFORMATICS
>>     INFORMATORY
[...]
> I think you need two hashes: one flat, with an entry for each word,
> mapping word to parent (if any)
>
>     my %parents = (
>         FORMATION => undef,
>         DEFORMATION => 'FORMATION',
>         INFORMATION => 'FORMATION',
>         DEFORMATIONAL => 'DEFORMATION',
>         INFORMATIONAL => 'INFORMATION',
>     );
>
> and one structured as a tree
>
>     my %children = (
>         FORMATION => {
>             DEFORMATION => {
>                 DEFORMATIONAL => {},
>             },
>             INFORMATION => {
>                 INFORMATIONAL => {},
>             },
>         },
>     );

You don't need the %parents hash. The %children hash together with a
recursive function is sufficient:


#!/usr/bin/perl
use warnings;
use strict;
use Data::Dumper;

my $tree = {};

while (<DATA>) {
    chomp;
    addword($tree, $_);
}
print Dumper $tree;
exit(0);

sub addword {
    my ($tree, $word) = @_;
    for (keys %$tree) {
        if (index($word, $_) >= 0) {
            return addword($tree->{$_}, $word);
        }
    }
    $tree->{$word} = {};
}

__DATA__
FORMATION
FORMATIVE
FORMATTER
DEFORMATION
DEFORMATIVE
FORMATIVELY
INFORMATICS
INFORMATION
INFORMATIVE
INFORMATORY
CONFORMATION
MALFORMATION
DEFORMATIONAL
INFORMATIONAL
INFORMATIVELY
UNINFORMATIVE

Printing the tree structure in the format desired by the OP is left as
an exercise to the reader ;-).

	hp


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

Date: Thu, 7 Aug 2008 11:54:23 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: nested strings
Message-Id: <slrng9lhig.qhi.hjp-usenet2@hrunkner.hjp.at>

On 2008-08-06 16:23, Ted Zlatanov <tzz@lifelogs.com> wrote:
> On Tue, 5 Aug 2008 14:51:27 -0700 (PDT) sausenet@gmail.com wrote: 
> s> Given: a list of words sorted first in length order, then
> s> alphabetically:
[...]
> s> Desired output: the same set of words showing nested substrings
> s>     FORMATION [DEFORMATION [DEFORMATIONAL] INFORMATION [INFORMATIONAL]
> s> CONFORMATION MALFORMATION]
> s>     FORMATIVE [DEFORMATIVE FORMATIVELY [INFORMATIVELY] INFORMATIVE
> s> PERFORMATIVE UNINFORMATIVE]
> s>     FORMATTER
> s>     INFORMATICS
> s>     INFORMATORY
>
> You probably want a trie.

Isn't a trie defined as a tree where the key of the parent node is a
prefix of the keys of its children? Here it's an infix.

	hp


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

Date: Thu, 07 Aug 2008 07:59:06 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: nested strings
Message-Id: <86skthgew5.fsf@lifelogs.com>

On Thu, 7 Aug 2008 11:54:23 +0200 "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote: 

PJH> On 2008-08-06 16:23, Ted Zlatanov <tzz@lifelogs.com> wrote:
>> On Tue, 5 Aug 2008 14:51:27 -0700 (PDT) sausenet@gmail.com wrote: 
s> Given: a list of words sorted first in length order, then
s> alphabetically:
PJH> [...]
s> Desired output: the same set of words showing nested substrings
s> FORMATION [DEFORMATION [DEFORMATIONAL] INFORMATION [INFORMATIONAL]
s> CONFORMATION MALFORMATION]
s> FORMATIVE [DEFORMATIVE FORMATIVELY [INFORMATIVELY] INFORMATIVE
s> PERFORMATIVE UNINFORMATIVE]
s> FORMATTER
s> INFORMATICS
s> INFORMATORY
>> 
>> You probably want a trie.

PJH> Isn't a trie defined as a tree where the key of the parent node is a
PJH> prefix of the keys of its children? Here it's an infix.

The OP said it was OK to have just prefix matching, though infix
matching would be nice.

You can also just iterate over the substrings of the target, e.g. for
INFORMATION you check for I-N-F-O-R-M-A-T-I-O-N and then
N-F-O-R-M-A-T-I-O-N and then F-O-R-M-A-T-I-O-N, etc. in the trie.

Ted


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

Date: Thu, 7 Aug 2008 04:42:24 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Aug  7 2008
Message-Id: <K57rqo.4yG@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.

Apache2-ASP-1.57
http://search.cpan.org/~johnd/Apache2-ASP-1.57/
Perl extension for ASP on mod_perl2. 
----
Apache2-Controller-0.110.000
http://search.cpan.org/~markle/Apache2-Controller-0.110.000/
framework for Apache2 handler apps 
----
App-ZofCMS-0.0104
http://search.cpan.org/~zoffix/App-ZofCMS-0.0104/
web framework and templating system for small-medium sites. 
----
App-ZofCMS-Plugin-QuickNote-0.0101
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-QuickNote-0.0101/
drop-in "quicknote" form to email messages from your site 
----
App-ZofCMS-Plugin-QuickNote-0.0102
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-QuickNote-0.0102/
drop-in "quicknote" form to email messages from your site 
----
App-ZofCMS-Plugin-QuickNote-0.0103
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-QuickNote-0.0103/
drop-in "quicknote" form to email messages from your site 
----
App-ZofCMS-Plugin-QuickNote-0.0104
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-QuickNote-0.0104/
drop-in "quicknote" form to email messages from your site 
----
App-ZofCMS-Plugin-QuickNote-0.0105
http://search.cpan.org/~zoffix/App-ZofCMS-Plugin-QuickNote-0.0105/
drop-in "quicknote" form to email messages from your site 
----
Business-ISSN-0.91
http://search.cpan.org/~bdfoy/Business-ISSN-0.91/
Perl extension for International Standard Serial Numbers 
----
Business-OnlinePayment-PlugnPay-0.03
http://search.cpan.org/~jef/Business-OnlinePayment-PlugnPay-0.03/
plugnpay backend for Business::OnlinePayment 
----
CGI-Application-Plugin-AnyCGI-0.02
http://search.cpan.org/~mab/CGI-Application-Plugin-AnyCGI-0.02/
Use your favourite CGI::* module with CGI::Application (instead of CGI.pm) 
----
CGI-Lazy-0.04
http://search.cpan.org/~vayde/CGI-Lazy-0.04/
----
CGI.pm-3.40
http://search.cpan.org/~lds/CGI.pm-3.40/
----
CPANPLUS-Shell-Wx-0.03
http://search.cpan.org/~skamansam/CPANPLUS-Shell-Wx-0.03/
A CPANPLUS GUI Shell written in wxWidgets 
----
Catalyst-Plugin-I18N-0.08
http://search.cpan.org/~bricas/Catalyst-Plugin-I18N-0.08/
I18N for Catalyst 
----
Chart-Clicker-1.99_04
http://search.cpan.org/~gphat/Chart-Clicker-1.99_04/
Powerful, extensible charting. 
----
Chess-Coverage-0.04_1
http://search.cpan.org/~gene/Chess-Coverage-0.04_1/
Expose chess ply potential energy - MOVED 
----
Chess-Rep-Coverage-0.0401
http://search.cpan.org/~gene/Chess-Rep-Coverage-0.0401/
Expose chess ply potential energy 
----
Config-Any-0.14
http://search.cpan.org/~bricas/Config-Any-0.14/
Load configuration from different file formats, transparently 
----
DBIx-Class-AutoColumn-0.1
http://search.cpan.org/~diz/DBIx-Class-AutoColumn-0.1/
DBIx::Class extension to provide values for selected columns via hooks 
----
DBIx-Class-QueryLog-1.1.0
http://search.cpan.org/~gphat/DBIx-Class-QueryLog-1.1.0/
Log queries for later analysis. 
----
Data-Feed-0.00004
http://search.cpan.org/~dmaki/Data-Feed-0.00004/
Extensible Feed Parsing Tool 
----
Data-Feed-0.00005
http://search.cpan.org/~dmaki/Data-Feed-0.00005/
Extensible Feed Parsing Tool 
----
DateTime-Format-Strptime-1.0800
http://search.cpan.org/~rickm/DateTime-Format-Strptime-1.0800/
Parse and format strp and strf time patterns 
----
Devel-Callsite-0.01
http://search.cpan.org/~teodor/Devel-Callsite-0.01/
Get current callsite 
----
Devel-Callsite-0.02
http://search.cpan.org/~teodor/Devel-Callsite-0.02/
Get current callsite 
----
Document-Writer-0.01
http://search.cpan.org/~gphat/Document-Writer-0.01/
Library agnostic document creation 
----
Every-0.04
http://search.cpan.org/~teodor/Every-0.04/
return true every N cycles or S seconds 
----
Every-0.05
http://search.cpan.org/~teodor/Every-0.05/
return true every N cycles or S seconds 
----
File-LibMagic-0.89
http://search.cpan.org/~fitzner/File-LibMagic-0.89/
Perlwrapper for libmagic 
----
Filter-QuasiQuote-0.02
http://search.cpan.org/~agent/Filter-QuasiQuote-0.02/
Quasiquoting for Perl 
----
Filter-QuasiQuote-0.03
http://search.cpan.org/~agent/Filter-QuasiQuote-0.03/
Quasiquoting for Perl 
----
Filter-QuasiQuote-0.04
http://search.cpan.org/~agent/Filter-QuasiQuote-0.04/
Quasiquoting for Perl 
----
Form-Processor-Model-DBIC-0.05
http://search.cpan.org/~gshank/Form-Processor-Model-DBIC-0.05/
Model class for Form Processor using DBIx::Class 
----
Form-Processor-Model-DBIC-0.06
http://search.cpan.org/~gshank/Form-Processor-Model-DBIC-0.06/
Model class for Form Processor using DBIx::Class 
----
Geometry-Primitive-0.09
http://search.cpan.org/~gphat/Geometry-Primitive-0.09/
Primitive Geometry Entities 
----
Google-Chart-0.05001
http://search.cpan.org/~dmaki/Google-Chart-0.05001/
Interface to Google Charts API 
----
Google-Chart-0.05002
http://search.cpan.org/~dmaki/Google-Chart-0.05002/
Interface to Google Charts API 
----
Graphics-Primitive-0.13
http://search.cpan.org/~gphat/Graphics-Primitive-0.13/
Device and library agnostic graphic primitives 
----
Graphics-Primitive-Driver-Cairo-0.07
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-Cairo-0.07/
Cairo backend for Graphics::Primitive 
----
HTML-Stream-1.60
http://search.cpan.org/~dstaal/HTML-Stream-1.60/
HTML output stream class, and some markup utilities 
----
HTTP-Cookies-iCab-1.120
http://search.cpan.org/~bdfoy/HTTP-Cookies-iCab-1.120/
Cookie storage and management for iCab 
----
HTTP-Engine-0.0.13_1
http://search.cpan.org/~yappo/HTTP-Engine-0.0.13_1/
Web Server Gateway Interface and HTTP Server Engine Drivers (Yet Another Catalyst::Engine) 
----
IO-Lambda-0.22
http://search.cpan.org/~karasik/IO-Lambda-0.22/
non-blocking I/O in lambda style 
----
IPC-PerlSSH-0.09
http://search.cpan.org/~pevans/IPC-PerlSSH-0.09/
a class for executing remote perl code over an SSH link 
----
IPC-PerlSSH-Async-0.02
http://search.cpan.org/~pevans/IPC-PerlSSH-Async-0.02/
Asynchronous wrapper around IPC::PerlSSH 
----
IPC-Run3-0.041
http://search.cpan.org/~rschupp/IPC-Run3-0.041/
run a subprocess with input/ouput redirection 
----
Layout-Manager-0.10
http://search.cpan.org/~gphat/Layout-Manager-0.10/
2D Layout Management 
----
Lingua-Slavic-Numbers-0.03
http://search.cpan.org/~teodor/Lingua-Slavic-Numbers-0.03/
Converts numeric values into their Slavic string equivalents. Bulgarian is supported so far. 
----
Log-Log4perl-CommandLine-0.01
http://search.cpan.org/~ctilmes/Log-Log4perl-CommandLine-0.01/
Simple Command Line Interface for Log4perl 
----
Log-Log4perl-CommandLine-0.02
http://search.cpan.org/~ctilmes/Log-Log4perl-CommandLine-0.02/
Simple Command Line Interface for Log4perl 
----
Mac-iTunes-0.90
http://search.cpan.org/~bdfoy/Mac-iTunes-0.90/
interact with and control iTunes 
----
Mac-iTunes-Library-0.2
http://search.cpan.org/~dinomite/Mac-iTunes-Library-0.2/
Perl extension for representing an iTunes library 
----
Mail-VRFY-0.58
http://search.cpan.org/~jkister/Mail-VRFY-0.58/
Utility to verify an email address 
----
Microarray-0.45c
http://search.cpan.org/~cjones/Microarray-0.45c/
A Perl module for creating and manipulating DNA Microarray experiment objects 
----
MooseX-MutatorAttributes-0.03
http://search.cpan.org/~notbenh/MooseX-MutatorAttributes-0.03/
Moose Role to add a quick set method that returns self 
----
MySQL-Slurp-0.2
http://search.cpan.org/~ctbrown/MySQL-Slurp-0.2/
Use PIPEs to import a file into MySQL table. 
----
MySQL-Slurp-0.21
http://search.cpan.org/~ctbrown/MySQL-Slurp-0.21/
Use PIPEs to import a file into MySQL table. 
----
Net-IMAP-Server-0.95
http://search.cpan.org/~alexmv/Net-IMAP-Server-0.95/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro. 
----
Net-Pcap-Easy-1.3
http://search.cpan.org/~jettero/Net-Pcap-Easy-1.3/
Net::Pcap is awesome, but it's difficult to bootstrap 
----
POE-Component-Client-Keepalive-0.21
http://search.cpan.org/~rcaputo/POE-Component-Client-Keepalive-0.21/
manage connections, with keep-alive 
----
Path-Abstract-0.089
http://search.cpan.org/~rkrimen/Path-Abstract-0.089/
Fast and featureful UNIX-style path manipulation 
----
Path-Abstract-0.090
http://search.cpan.org/~rkrimen/Path-Abstract-0.090/
Fast and featureful UNIX-style path manipulation 
----
RSSycklr-0.04
http://search.cpan.org/~ashley/RSSycklr-0.04/
(beta) Highly configurable recycling of syndication (RSS/Atom) feeds into tailored, guaranteed XHTML fragments. 
----
RSSycklr-0.05
http://search.cpan.org/~ashley/RSSycklr-0.05/
(beta) Highly configurable recycling of syndication (RSS/Atom) feeds into tailored, guaranteed XHTML fragments. 
----
RT-Extension-CommandByMail-0.06
http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.06/
Change metadata of ticket via email 
----
Regexp-HTMLify-0.001
http://search.cpan.org/~perlboy/Regexp-HTMLify-0.001/
Highlight regular expression capture buffers and matches using HTML and CSS 
----
TAP-Harness-JUnit-0.21
http://search.cpan.org/~lkundrak/TAP-Harness-JUnit-0.21/
Generate JUnit compatible output from TAP results 
----
Tkx-FindBar-0.06
http://search.cpan.org/~mjcarman/Tkx-FindBar-0.06/
Perl Tkx extension for an incremental search toolbar 
----
URI-PathAbstract-0.01
http://search.cpan.org/~rkrimen/URI-PathAbstract-0.01/
A URI-like object with Path::Abstract capabilities 
----
VS-Chart-0.07
http://search.cpan.org/~claesjac/VS-Chart-0.07/
Simple module to create beautifully looking charts 
----
WWW-Mechanize-Plugin-AutoWrite-0.03
http://search.cpan.org/~potyl/WWW-Mechanize-Plugin-AutoWrite-0.03/
WWW::Mechanize plugin that writes the fetched pages to the disk 
----
WWW-Yahoo-Links-0.01
http://search.cpan.org/~apla/WWW-Yahoo-Links-0.01/
Tracking Inbound Links in Yahoo Site Explorer API 
----
WWW-Yahoo-Links-0.02
http://search.cpan.org/~apla/WWW-Yahoo-Links-0.02/
Tracking Inbound Links in Yahoo Site Explorer API 
----
WWW-Yandex-TIC-0.04
http://search.cpan.org/~bashlov/WWW-Yandex-TIC-0.04/
Query Yandex Thematic Index of Citing (TIC) for domain 
----
Weather-Bug-0.20
http://search.cpan.org/~gwadej/Weather-Bug-0.20/
Provide an object oriented interface to the WeatherBug API. 
----
Weather-Bug-0.21
http://search.cpan.org/~gwadej/Weather-Bug-0.21/
Provide an object oriented interface to the WeatherBug API. 
----
XML-Compile-0.92
http://search.cpan.org/~markov/XML-Compile-0.92/
Compilation based XML processing 
----
XML-FeedWriter-0.05
http://search.cpan.org/~ishigaki/XML-FeedWriter-0.05/
simple RSS writer 
----
flail-0.2.4
http://search.cpan.org/~attila/flail-0.2.4/
a hacker's mailer in Perl 
----
mnm-0.02-2
http://search.cpan.org/~daleamon/mnm-0.02-2/
Merge and Mirror sources and archive/backup repositories 


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: Wed, 6 Aug 2008 20:17:17 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: subcommand within Perl script
Message-Id: <slrng9kj8t.sbm.tadmc@tadmc30.sbcglobal.net>

Slickuser <slick.users@gmail.com> wrote:


> &main;


It is _still_ a bad idea to use an ampersand on subroutine calls.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

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 1777
***************************************


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