[31139] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2384 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 1 14:09:48 2009

Date: Fri, 1 May 2009 11:09:12 -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           Fri, 1 May 2009     Volume: 11 Number: 2384

Today's topics:
        "Perl has been pretty much forgotten" says Spolsky <benkasminbullock@gmail.com>
    Re: "Perl has been pretty much forgotten" says Spolsky <cwilbur@chromatico.net>
    Re: "Perl has been pretty much forgotten" says Spolsky <cartercc@gmail.com>
        Dumping all Variables <a_person@anyolddomain.fake>
    Re: Dumping all Variables <benkasminbullock@gmail.com>
    Re: Dumping all Variables <a_person@anyolddomain.fake>
    Re: Dumping all Variables <cartercc@gmail.com>
    Re: Dumping all Variables <uri@stemsystems.com>
        generating WordProcessingML with Perl <cartercc@gmail.com>
        I think I found a real regex bug <liarafan@xs4all.nl>
    Re: I think I found a real regex bug <uri@stemsystems.com>
    Re: Perl is too slow - A statement <cwilbur@chromatico.net>
    Re: Perl is too slow - A statement sln@netherlands.com
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@seesig.invalid
        RSS XML Streams (isecc)
        want extract to parenthesis <nan1004au@gmail.com>
    Re: want extract to parenthesis <a_person@anyolddomain.fake>
    Re: want extract to parenthesis <jimsgibson@gmail.com>
    Re: want extract to parenthesis sln@netherlands.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 1 May 2009 02:05:33 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: "Perl has been pretty much forgotten" says Spolsky
Message-Id: <2c1ddc85-7d2c-440a-94e8-8d2a4e073375@d39g2000pra.googlegroups.com>

In case anyone's interested, this is Joel Spolsky of stackoverflow.com
on Perl:

http://www.youtube.com/watch?v=NWHfY_lvKIQ

(fast forward to segment from 39:10 to 39:25)

[This statement is not too surprising considering the general level of
stackoverflow.com.]



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

Date: Fri, 01 May 2009 10:55:43 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: "Perl has been pretty much forgotten" says Spolsky
Message-Id: <864ow4kh3k.fsf@mithril.chromatico.net>

>>>>> "BB" == Ben Bullock <benkasminbullock@gmail.com> writes:

    BB> In case anyone's interested, this is Joel Spolsky of
    BB> stackoverflow.com on Perl:

    BB> http://www.youtube.com/watch?v=NWHfY_lvKIQ

    BB> (fast forward to segment from 39:10 to 39:25)

    BB> [This statement is not too surprising considering the general
    BB> level of stackoverflow.com.]

Joel Spolsky is a troll.  He occasionally says something of value, but
then, a stopped clock is right twice a day.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Fri, 1 May 2009 09:17:09 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: "Perl has been pretty much forgotten" says Spolsky
Message-Id: <45074f7a-33d0-4b61-8204-bcd05567658e@u9g2000pre.googlegroups.com>

On May 1, 10:55=A0am, Charlton Wilbur <cwil...@chromatico.net> wrote:
> Joel Spolsky is a troll. =A0He occasionally says something of value, but
> then, a stopped clock is right twice a day.

Joel might be a troll, but I've gotten a lot out of his writings. I
think they are pretty good, and I like to go to his site and read his
essays (On Software) from time to time.

I agree that Perl has been mostly forgotten by the world at large, but
I don't think that's the important point. I've had two experiences in
the last four weeks, introducing Perl (or rather, Perl apps) to IT
guys who came into the conversation expressing a lot of skepticism
about Perl. However, after looking at the code and comparing it head
to head in one case with the identical app written in Java, they had
to admit that Perl was a legitimate tool for some jobs.

One poster here (I think it was Uri but I might be mistaken) recently
observed that Perl was still the best at its original purpose,
extracting and reporting data. If many have forgotten Perl or never
knew it in the first place, it's because they apparently don't have a
need to extract or report data. This isn't a criticism, merely a
statement that people don't normally use tools that they don't need.

I read this week a report on using Erlang as a web development
language. I am not ashamed to state that I use Perl for web
development and have experimented a number of different languages such
as Python, CFML, .NET, Java, and others. The report had a section
explaining why Erlang was appropriate for web apps which was pretty
persuasive -- multithreading, stability, hot fixes, and so on. The
only problem is that people haven't used Erlang for web apps, but they
have used a lot of Perl. Over a period of time people will tend to use
the tools best suited for particular jobs, and that includes Perl, but
not Erlang. I have a pin extractor which I use rarely, but it's
absolutely indispensable when I need to extract a pin, and in the same
vein, I wouldn't pay much attention to reports that people have
forgotten Perl.

CC


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

Date: Fri, 1 May 2009 09:51:35 +0100
From: "Bigus" <a_person@anyolddomain.fake>
Subject: Dumping all Variables
Message-Id: <BKyKl.8$Jc3.5@newsfe16.iad>

Is there a way to print out all variables (scalars, hashes & arrays) 
currently defined at any point in the execution of a script?

Bigus 




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

Date: Fri, 1 May 2009 02:12:16 -0700 (PDT)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: Dumping all Variables
Message-Id: <41f2ea2d-31c2-473e-9865-fd96f6491f99@i28g2000prd.googlegroups.com>

On May 1, 5:51=A0pm, "Bigus" <a_per...@anyolddomain.fake> wrote:
> Is there a way to print out all variables (scalars, hashes & arrays)
> currently defined at any point in the execution of a script?

The following might help:

http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html




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

Date: Fri, 1 May 2009 17:39:58 +0100
From: "Bigus" <a_person@anyolddomain.fake>
Subject: Re: Dumping all Variables
Message-Id: <LBFKl.6852$uD3.4010@newsfe20.iad>


"Ben Bullock" <benkasminbullock@gmail.com> wrote in message 
news:41f2ea2d-31c2-473e-9865-fd96f6491f99@i28g2000prd.googlegroups.com...
On May 1, 5:51 pm, "Bigus" <a_per...@anyolddomain.fake> wrote:
> Is there a way to print out all variables (scalars, hashes & arrays)
> currently defined at any point in the execution of a script?
>
> The following might help:
> http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html

Kind of.. well it's more complicated than I thought/was hoping ;-). There's 
a module that reads the symbolic table too, so I need to play with that.

Thanks
Bigus




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

Date: Fri, 1 May 2009 10:10:54 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: Dumping all Variables
Message-Id: <87d95d82-55f9-4e2f-9d0a-49b1905081ab@k41g2000yqh.googlegroups.com>

On May 1, 4:51=A0am, "Bigus" <a_per...@anyolddomain.fake> wrote:
> Is there a way to print out all variables (scalars, hashes & arrays)
> currently defined at any point in the execution of a script?
>
> Bigus

Look at Data::Dumper


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

Date: Fri, 01 May 2009 13:13:50 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Dumping all Variables
Message-Id: <87ocucagq9.fsf@quad.sysarch.com>

>>>>> "c" == ccc31807  <cartercc@gmail.com> writes:

  c> On May 1, 4:51 am, "Bigus" <a_per...@anyolddomain.fake> wrote:
  >> Is there a way to print out all variables (scalars, hashes & arrays)
  >> currently defined at any point in the execution of a script?
  >> 
  >> Bigus

  c> Look at Data::Dumper

that won't dump all variables, only the ones that you pass to it.

but i beg to ask why anyone needs to dump all the vars? it is a poor
debugging idea. also the symbol table won't show any lexicals. there are
ways to get at those with modules but again, why does the OP think it is
necessary?

just print the vars you are interested in (plain or with dumper). print
is still (and always will be) the best debugger.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 1 May 2009 08:55:58 -0700 (PDT)
From: ccc31807 <cartercc@gmail.com>
Subject: generating WordProcessingML with Perl
Message-Id: <e8f2897b-adea-45e5-87ab-7054be25da53@b7g2000pre.googlegroups.com>

My job is to produce reports. Reports must have some kind of format.
Mostly, I usually produce reports in ASCII format, such as txt, csv,
or xml (including xhtml). Occasionally, my customers will specify a
format that I don't often use, such as PDF or Microsoft Word.

When this happens with Word, I have produced handwritten rtf,
generated rtf using a CPAN module (that I can't remember the name of
now) or (in the past a CPAN) doc module that produced a bin file. I
now have a requirement to produce a Word document (actually thousands
of them) for Word 2007 using data from a database.

After fiddling around as I normally do looking at the usual suspects,
I got around to OOXML, and specifically WordProcessingML. I confess
that this impresses me and surprises me. It's pretty good -- I can
generate an ASCII text file, interpolate my variables, and have it
open natively in Word. Cool.

Before writing the app, I thought I would troll here and see if anyone
has any real experience using WordProcessingML, and if so, their
conclusions, especially including traps, snares, and pitfalls.

Thanks, CC.


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

Date: Fri, 1 May 2009 19:53:02 +0200
From: "Mark" <liarafan@xs4all.nl>
Subject: I think I found a real regex bug
Message-Id: <a7idnYxiV9Zjq2bUnZ2dnUVZ8q6dnZ2d@giganews.com>

I think I found a real bug. Please consider and run the following test
script below. That only returns 3 matches (sic!):

10149
10150
10151

Now uncomment the '#' line in the script, and run it again, please.
Now, as expected, it returns all 4 matches:

10148
10149
10150
10151

This has got to be a bug (Perl 5.8.8, btw). If not, it's the most bizarre
'correct' behavior I've ever seen.

- Mark

-----------------------------
#!/usr/local/bin/perl

use strict;
use warnings;

my $postgres = quotemeta ('/usr/local/PostgreSQL/bin/postgres -D 
/var/db/PostgreSQL');
my $ps_command = 'pgsql 10146 0.0 0.6 46172 6408 ?? Ss 6:59PM 0:00.28 
/usr/local/PostgreSQL/bin/postgres -D /var/db/PostgreSQL
pgsql 10148 0.0 0.5 46172 5376 ?? Ss 6:59PM 0:00.25 postgres: writer process 
(postgres)
pgsql 10149 0.0 0.5 46172 5080 ?? Ss 6:59PM 0:00.23 postgres: wal writer 
process (postgres)
pgsql 10150 0.0 0.5 46260 5156 ?? Ss 6:59PM 0:00.08 postgres: autovacuum 
launcher process (postgres)
pgsql 10151 0.0 0.5 9604 5024 ?? Ss 6:59PM 0:00.09 postgres: stats collector 
process (postgres)';

if (not ($ps_command =~ /$postgres/m)) {
    print "Not relevant here!\n";
} elsif (not (($ps_command =~ /^pgsql .+? postgres: /mg) == 6)) {

# $ps_command .= "";

    while ($ps_command =~ /^pgsql (\d+) .+? postgres: /mg) {
        print "$1\n";
    }
}

exit 0;
----------------------------- 



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

Date: Fri, 01 May 2009 14:06:40 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: I think I found a real regex bug
Message-Id: <87d4asaea7.fsf@quad.sysarch.com>

>>>>> "M" == Mark  <liarafan@xs4all.nl> writes:

  M> I think I found a real bug. Please consider and run the following test
  M> script below. That only returns 3 matches (sic!):

there is no bug.

  M> 10149
  M> 10150
  M> 10151

  M> Now uncomment the '#' line in the script, and run it again, please.
  M> Now, as expected, it returns all 4 matches:

  M> 10148
  M> 10149
  M> 10150
  M> 10151

  M> This has got to be a bug (Perl 5.8.8, btw). If not, it's the most bizarre
  M> 'correct' behavior I've ever seen.

you don't understand how /g is working. see my version below and try
it. also be careful when pasting code that it doesn't line wrap. i had
to reformat your code to make 4 long lines of good data.

the output with the commented out line is:

POS 1: 171
POS 2: 171
POS loop: 259
10149
POS loop: 351
10150
POS loop: 451
10151

so your loop is really starting on the second line because the scalar
matches with /g left pos there. when the line is uncommented it resets
pos to 0 and so you find all the lines. here is that output:

POS 1: 171
Use of uninitialized value in print at regex_bug.pl line 21.
POS 2: 
POS loop: 171
10148
POS loop: 259
10149
POS loop: 351
10150
POS loop: 451
10151


#!/usr/local/bin/perl

use strict;
use warnings;

my $postgres = quotemeta ('/usr/local/PostgreSQL/bin/postgres -D /var/db/PostgreSQL');
my $ps_command = 'pgsql 10146 0.0 0.6 46172 6408 ?? Ss 6:59PM 0:00.28 /usr/local/PostgreSQL/bin/postgres -D /var/db/PostgreSQL
pgsql 10148 0.0 0.5 46172 5376 ?? Ss 6:59PM 0:00.25 postgres: writer process (postgres)
pgsql 10149 0.0 0.5 46172 5080 ?? Ss 6:59PM 0:00.23 postgres: wal writer process (postgres)
pgsql 10150 0.0 0.5 46260 5156 ?? Ss 6:59PM 0:00.08 postgres: autovacuum launcher process (postgres)
pgsql 10151 0.0 0.5 9604 5024 ?? Ss 6:59PM 0:00.09 postgres: stats collector process (postgres)';

if (not ($ps_command =~ /$postgres/m)) {
   print "Not relevant here!\n";
} elsif (not (($ps_command =~ /^pgsql .+? postgres: /mg) == 6)) {

print "POS 1: ", pos $ps_command, "\n" ;

 $ps_command .= "";

print "POS 2: ", pos $ps_command, "\n" ;
   while ($ps_command =~ /^pgsql (\d+) .+? postgres: /mg) {
print "POS loop: ", pos $ps_command, "\n" ;
       print "$1\n";
   }
}

exit 0;


uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 01 May 2009 10:54:16 -0400
From: Charlton Wilbur <cwilbur@chromatico.net>
Subject: Re: Perl is too slow - A statement
Message-Id: <868wlgkh5z.fsf@mithril.chromatico.net>

>>>>> "NK" == Nathan Keel <nat.k@gm.ml> writes:

    NK> In the end, if I ever told someone that I was contracted to
    NK> program for them, or my employer that, "if you want it to run
    NK> better or faster, get faster systems", I'd have been quickly
    NK> ripped a "new one" or fired, and definitely lost the respect of
    NK> the people I was on the same programming team with.  

Whereas I have said as a consultant, "Look, I can spend a week tuning
this code and get *maybe* a 5% increase in speed overall.  Or you can
spend the same $2K you'd spend paying me for that week and get a new
system to run it on, and get a 50% increase in speed across the board."
Oddly enough, this seemed to win me more respect.  

It's not all about hero programming.  It's about getting the job done
right while using as few resources as possible, and development time and
powerful hardware can sometimes be exchanged for each other.  There
usually comes a point where spending more money on hardware gives you a
better bang for the buck than spending more money on development and
optimization.  I'd be pretty disgusted with a manager who didn't realize
that.

Charlton


-- 
Charlton Wilbur
cwilbur@chromatico.net


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

Date: Fri, 01 May 2009 09:26:24 -0700
From: sln@netherlands.com
Subject: Re: Perl is too slow - A statement
Message-Id: <sl4mv4h1l334ldpakqgq9qd4hq82q67jsg@4ax.com>

On Fri, 01 May 2009 10:54:16 -0400, Charlton Wilbur <cwilbur@chromatico.net> wrote:

>>>>>> "NK" == Nathan Keel <nat.k@gm.ml> writes:
>
>    NK> In the end, if I ever told someone that I was contracted to
>    NK> program for them, or my employer that, "if you want it to run
>    NK> better or faster, get faster systems", I'd have been quickly
>    NK> ripped a "new one" or fired, and definitely lost the respect of
>    NK> the people I was on the same programming team with.  
>
>Whereas I have said as a consultant, "Look, I can spend a week tuning
>this code and get *maybe* a 5% increase in speed overall.  Or you can
>spend the same $2K you'd spend paying me for that week and get a new
>system to run it on, and get a 50% increase in speed across the board."
>Oddly enough, this seemed to win me more respect.

Do you assume a one-off simple in-house utility program that one person
in a no person staff could tweek? In that case, they wouldn't spend any
money at all for speed enhancement, hardware or software.

On the other hand, a sophisticated in-house system would have a support
staff. And as the requirements are constantly changing, software modifications,
be it bug fixes or enhancements are done/being worked on constantly.
Why hire a support staff to tell you to update your hardware as a bug fix?

As for a hardware update to get that %50 speed increase.
I assume you mean adding another cpu core as in 'dual-core cpu', as
opposed to adding another parallel machine in a distributed processing.

The fact is, unless your adding a Cray, this won't help a bit. The big
reason is that until languages can take single code path sourse and
convert and compile into threaded code to take advantage of the extra
core, the speed will actually decrease from the original.

The limiting factor of all hardware speed is the heat of the cpu.
When doubling the core of the cpu you double the heat. Reducing the
wattage consumption in multiple cores via the wafer process, has resulted
in reducing each cores speed (Ghz) compared to a single core. All this to
maintain a maximum level of heat dissipation (wattage) when all the
cores are firing (stressed) on all cylinders.

Each new rev of a cpu has actual pipelining/instruction enhancements,
however, some apps may benefit and some won't as app benchmarks tell us.

The bottom line is that apps are always evolving to take advantage of new
cpu technology, NOT the other way around. Enhancements, re-writes, re-factor,
bug fixes, etc.. for all common sense reasons, are the rule, NOT the exception.

>
>It's not all about hero programming.

Ah, the *GLORY*, the hero. Do it for the glory of it. Plunging into one
large app enhancement after another. Yeah, if you live through the stress
I guess you would be a hero... when you bring home the paycheck to support
your wife and kids.

>It's about getting the job done
>right while using as few resources as possible, and development time and
>powerful hardware can sometimes be exchanged for each other.  There
>usually comes a point where spending more money on hardware gives you a
>better bang for the buck than spending more money on development and
>optimization.

This is NOT mutually exclusive as you portend, far from it.

>I'd be pretty disgusted with a manager who didn't realize
>that.
>
>Charlton

I didn't know that supervisors give you a choice to be disgusted.
Hardware is a procurement item, budgeted, and out of the control
of development teams. In other words, in the corp world, the
solution to speed up a one-off utility app by purchacing a new
machine would have to be approved by the business department.
A complete procuremnt and justification array of paper work and
departmental approvals would be needed, taking several weeks or
months for the process, costing more than the machine itself.

So I see no argument that a simple machine upgrade alone will solve
speed problems.

-sln


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

Date: Fri, 01 May 2009 07:13:23 GMT
From: tadmc@seesig.invalid
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
Message-Id: <nixKl.28297$yr3.18369@nlpi068.nbdc.sbc.com>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.9 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://www.rehabitation.com/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume that they do 
       know and are being the "bad kind" of Lazy.

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan and many others on the comp.lang.perl.misc newsgroup.

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


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

Date: Fri, 1 May 2009 11:01:02 +0200
From: pbnew@tin.it (isecc)
Subject: RSS XML Streams
Message-Id: <1iz1a77.qnvlhx111z3oiN%pbnew@tin.it>

Hi all,

I'd like to process RSS XML downloaded from the web.

What I mean is that:
I start downloading the RSS_XML from the website and while
downloading I start processing the data, in this way I can choose what
to do with the data without completing the download.

For this I'm using 
LWP::UserAgent that is calling my callback routine ie:

my $res            = $ua->request(
        HTTP::Request->new( GET => $rss ), \&rss_stream_SAX
 );

and

XML:SAX with my MySAXHandler

What I was wondering is if there are some CPAN modules already written
for this goal.

Thanks.

PS.
I've already searched on CPAN for several modules... but I found nothing
for my task. But since there are so many options I'd like a feedback
from somebody "in the field" ;-)


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

Date: Fri, 1 May 2009 09:20:13 -0700 (PDT)
From: NamSa <nan1004au@gmail.com>
Subject: want extract to parenthesis
Message-Id: <c36cb0c9-46ca-487d-a049-f94e9b848998@v1g2000prd.googlegroups.com>


I am speak in poor English

Sorry ..

The characters in the innermost parentheses, I want to extract

(( A )  aa) <- extract A
(bb (B)) <- extract B

(A (AB) (BC)) <- extract AB and BC



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

Date: Fri, 1 May 2009 17:38:17 +0100
From: "Bigus" <a_person@anyolddomain.fake>
Subject: Re: want extract to parenthesis
Message-Id: <8AFKl.6851$uD3.782@newsfe20.iad>

"NamSa" <nan1004au@gmail.com> wrote in message 
news:c36cb0c9-46ca-487d-a049-f94e9b848998@v1g2000prd.googlegroups.com...

> The characters in the innermost parentheses, I want to extract
>
> (( A )  aa) <- extract A
> (bb (B)) <- extract B
>
> (A (AB) (BC)) <- extract AB and BC

my $text = "(A (AB) (BC))";
my @extracted = $text =~ /\(\s*([A-Z]+)\s*\)/g;
print "@extracted";

That works for all the examples you have given...

Bigus 




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

Date: Fri, 01 May 2009 09:38:38 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: want extract to parenthesis
Message-Id: <010520090938384879%jimsgibson@gmail.com>

In article
<c36cb0c9-46ca-487d-a049-f94e9b848998@v1g2000prd.googlegroups.com>,
NamSa <nan1004au@gmail.com> wrote:

> I am speak in poor English
> 
> Sorry ..
> 
> The characters in the innermost parentheses, I want to extract
> 
> (( A )  aa) <- extract A
> (bb (B)) <- extract B
> 
> (A (AB) (BC)) <- extract AB and BC
> 

Suggestions:

1. Use Text::Balanced
2. Read 'perldoc -q balanced'

-- 
Jim Gibson


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

Date: Fri, 01 May 2009 10:58:45 -0700
From: sln@netherlands.com
Subject: Re: want extract to parenthesis
Message-Id: <prdmv41uju78o0ejmh9d3noi9blu4i07ss@4ax.com>

On Fri, 1 May 2009 09:20:13 -0700 (PDT), NamSa <nan1004au@gmail.com> wrote:

>
>I am speak in poor English
>
>Sorry ..
>
>The characters in the innermost parentheses, I want to extract
>
>(( A )  aa) <- extract A
>(bb (B)) <- extract B
>
>(A (AB) (BC)) <- extract AB and BC

A single regex could do it.

-sln

output:

'AA'
'B'
'A,B'
'BC'

---------------------------------
## Capture.pl
## (will capture all inner parenth characters stripping off enclosing white space)

use strict;
use warnings;

# Shrunk down regex:
# /\(\s*((?:(?!\s+\))[^()])+)\s*\)/

while (<DATA>)
{
	if (my @array = $_ =~
         /
           \(	        # Find first open parenth '('
              \s*       # Trim zero or more white space
                 (      # Start Capture group 1

                   (?:           # grouping

                       (?!\s+\))      # look ahead, cannot be 1 or more white space followed by ')' char
                       [^()]          # all is ok, grab a character that is not '(' nor ')'

                   )+            # end grouping, do 1 or more times

                 )      # End Capture group 1, (done only once)
              \s*       # Trim zero or more white space
           \)           # Find very next closing parenth ')'
        /xg)

	{
		print "'$_'\n" for (@array);
	}
}

__DATA__

(( AA )  aa) <- extract A
(bb (B)) <- extract B

(A (A,B   ) (BC)) <- extract AB and BC

(  )





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

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


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