[29577] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 821 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 5 06:10:12 2007

Date: Wed, 5 Sep 2007 03:09:05 -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           Wed, 5 Sep 2007     Volume: 11 Number: 821

Today's topics:
        beautiful handbags <miaoyanand@126.com>
        Fresh Programmers Required Urgently Visual Foxpro / VB  <msmanu78@yahoo.com>
    Re: Fresh Programmers Required Urgently Visual Foxpro / <jokinentimo@kolumbus.fi.invalid>
        new CPAN modules on Wed Sep  5 2007 (Randal Schwartz)
    Re: Perl variable to shell command...?  usenet@DavidFilmer.com
        Problem with reg expression <ldolan@thinkinghatbigpond.net.au>
    Re: Problem with reg expression <usenet@larseighner.com>
    Re: Problem with reg expression <noreply@gunnar.cc>
    Re: Problem with reg expression <noreply@gunnar.cc>
    Re: Problem with reg expression <usenet@larseighner.com>
    Re: Problem with reg expression <ldolan@thinkinghatbigpond.net.au>
    Re: Problem with reg expression <wahab@chemie.uni-halle.de>
    Re: Problem with reg expression <noreply@gunnar.cc>
        To find size of an attachment in a POP3 server <chinnari.kaddi@gmail.com>
    Re: Warning about unused lexical variables <attn.steven.kuo@gmail.com>
    Re: web programming in perl <moldovenu@spamu.niet.interia.pl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 04 Sep 2007 23:47:43 -0700
From:  ryhuj <miaoyanand@126.com>
Subject: beautiful handbags
Message-Id: <1188974863.421267.127220@50g2000hsm.googlegroups.com>

Wholesale / sell Chanel handbags @ebaynt.com


Louis Vuitton, Fendi SPY Bags, Fendi B bag, Chloe Paddington bags,
Chloe Silverado bags, Chloe Edith Bag, Balenciaga, Goyard, miumiu,
mulberry, prada, Marc Jacobs, Gucci 85th, Dior Gaucho, Jimmy choo,
Gucci, Chanel, YSL, Hermes, Loewe, Versace, Mqueen, Thomaswylde ,


We accept Paypal


www.ebaynt.com


MSN: ebaynt@gmail.com



luggages Bottega   loewe  chloe  Fendi  LV  Gucci Versace YSL
Thomaswylde Mqueen

Belt | Necklace | Finger Ring | Key Ring & Phone Strap | SCARF Fendi
watches | Dior watches | Armani watches | Burberry watches | LV
watches | Bottega Veneta Bag | goyard | Loewe bag | MiuMiu Prada
BALENCIAGA HANDBAGS Twiggy Duffle | 34cm | 45cm | 51cm | 38cm |

Kooba |  Mulberry | Fendi B Bag |  Fendi  |  FendiSpy  | GUCCI
HANDBAGS 85th Anniversary | Gucci "Jolicoeur" Tote  | NEW ARRIVAL |
Gucci Boston Bag | Gucci Hobo  |  Scarf Collection  | Guccissima
Collection  | Gucci Moon Bag | Gucci D Bag  | Gucci Bag | Marc Jacobs
| Chloe Paddington Shopper | New Chloe | Chloe Paddington Color
Hardware | Chloe Paddington With Shoulder Strap | Chloe Paddington
With Silver Hardware | Chloe Doctor Bag | Chloe Betty  | Chloe
Silverado | Chloe Hampton | Chloe Horse Collection  | Chloe Tote With
Lock and Key | Chloe IT Edith Bag  | Chloe Paddington  |  Suhali  |
Monogram Multicolore | Monogram Denim | Damier Canvas | Monogram
Ceries | Taiga | Damier Geant | Epi | Monogram Canvas | Winter 2005 /
2006 Collection  | Waltz Oskar  | Antigua  | Cruise Collection |
Onatah  | NEW ARRIVALS | Mini | vernis | Trapeze  | LV Stamped |
Perforated  | HERMES HANDBAG

ostrich | 35cm Hermes Birkin Crocodile | 42cm JPG Birkins  | Hermes
Tote  | 35cm Birkin Togo Leather CHANEL HANDBAGS Chanel Bag  | Cambon
Collection  |  CHRISTAIN DIOR HANDBAGS Dior Detective | Dior Rebelle |
Dior bag | Dior Gaucho  | BOTIKER HANDBAGS Luella | Jimmy Choo | Bulga
| Chanel Wallet | Marc Jacobs Wallet | Chloe wallet | Louis vuitton
Wallet | Gucci wallet | Miumiu Shoes | HERMES Shoes | TODS Shoes |
Salvafove Fenagamo Shoes | D&G Shoes | Dior Shoes | Chanel Shoes |
Prada shoes | Gucci Shoes | LV shoes | chloe shoes



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

Date: Wed, 05 Sep 2007 01:25:55 -0700
From:  HR Head <msmanu78@yahoo.com>
Subject: Fresh Programmers Required Urgently Visual Foxpro / VB / .NET
Message-Id: <1188980755.753002.273220@d55g2000hsg.googlegroups.com>




Dear All,

Fresh Programmers Required Urgently Visual Foxpro / VB / .NET

Skill set required :- Visual Foxpro 1 or 2 years Experince [Foxpro]
[VB-6] [.NET]

Location:- Malaysia / Singapore

Qulification ;- Any Graduate / Under Graduate

Effective communication skill in English prefered

Please send your CV's to isoft_staffATyahoo.com



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

Date: Wed, 05 Sep 2007 12:12:35 +0300
From: Timo Jokinen <jokinentimo@kolumbus.fi.invalid>
Subject: Re: Fresh Programmers Required Urgently Visual Foxpro / VB / .NET
Message-Id: <2ruDi.218439$eW4.150251@reader1.news.saunalahti.fi>

HR Head wrote:
> 
> 
> Dear All,
> 
> Fresh Programmers Required Urgently Visual Foxpro / VB / .NET
> 
> Skill set required :- Visual Foxpro 1 or 2 years Experince [Foxpro]
> [VB-6] [.NET]
> 
> Location:- Malaysia / Singapore
> 
> Qulification ;- Any Graduate / Under Graduate
> 
> Effective communication skill in English prefered
> 
> Please send your CV's to isoft_staffATyahoo.com
> 

"Fresh Programmers" hehehe
"Visual Foxpro 1 or 2 years Experince" "outch" hehehehe
"Location:- Malaysia / Singapore"  muahwhawwhaw


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

Date: Wed, 5 Sep 2007 04:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Sep  5 2007
Message-Id: <Jnvp2G.1Cpu@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.

Catalyst-Model-DBIC-Schema-QueryLog-0.01
http://search.cpan.org/~fayland/Catalyst-Model-DBIC-Schema-QueryLog-0.01/
DBIx::Class::QueryLog Model Class 
----
Catalyst-Model-DBIC-Schema-QueryLog-0.02
http://search.cpan.org/~fayland/Catalyst-Model-DBIC-Schema-QueryLog-0.02/
DBIx::Class::QueryLog Model Class 
----
Catalyst-Plugin-HashClass-0.02
http://search.cpan.org/~jrockway/Catalyst-Plugin-HashClass-0.02/
use a class to back $c->* 
----
Catalyst-Plugin-HashClass-0.03
http://search.cpan.org/~jrockway/Catalyst-Plugin-HashClass-0.03/
use a class to back $c->* 
----
CatalystX-Starter-0.04
http://search.cpan.org/~jrockway/CatalystX-Starter-0.04/
bootstrap a CPAN-able Catalyst component 
----
Class-Simple-0.13
http://search.cpan.org/~sullivan/Class-Simple-0.13/
Simple Object-Oriented Base Class 
----
DBD-Informix-2007.0904
http://search.cpan.org/~johnl/DBD-Informix-2007.0904/
IBM Informix Database Driver for Perl DBI 
----
DBIx-Class-0.08007
http://search.cpan.org/~ash/DBIx-Class-0.08007/
Extensible and flexible object <-> relational mapper. 
----
DBIx-Class-ResultSet-Data-Pageset-0.01
http://search.cpan.org/~bricas/DBIx-Class-ResultSet-Data-Pageset-0.01/
Get a Data::Pageset pager from a resultset 
----
DBIx-Class-ResultSet-Data-Pageset-0.02
http://search.cpan.org/~bricas/DBIx-Class-ResultSet-Data-Pageset-0.02/
Get a Data::Pageset pager from a resultset 
----
Data-Validate-XSD-1.02
http://search.cpan.org/~doctormo/Data-Validate-XSD-1.02/
Validate complex structures by definition 
----
DateTime-Format-Natural-0.38_01
http://search.cpan.org/~schubiger/DateTime-Format-Natural-0.38_01/
Create machine readable date/time with natural parsing logic 
----
Dispatch-Declare-0.0.7
http://search.cpan.org/~rlb/Dispatch-Declare-0.0.7/
Build a hash based dispatch table declaratively 
----
Dispatch-Declare-0.0.8
http://search.cpan.org/~rlb/Dispatch-Declare-0.0.8/
Build a hash based dispatch table declaratively 
----
Dispatch-Declare-0.0.9
http://search.cpan.org/~rlb/Dispatch-Declare-0.0.9/
Build a hash based dispatch table declaratively 
----
Dispatch-Declare-0.1.0
http://search.cpan.org/~rlb/Dispatch-Declare-0.1.0/
Build a hash based dispatch table declaratively 
----
File-Path-2.00_10
http://search.cpan.org/~dland/File-Path-2.00_10/
Create or remove directory trees 
----
Games-Tournament-Swiss-0.07
http://search.cpan.org/~drbean/Games-Tournament-Swiss-0.07/
FIDE Swiss Same-Rank Contestant Pairing 
----
Geo-Coordinates-OSGB-2.00
http://search.cpan.org/~toby/Geo-Coordinates-OSGB-2.00/
Convert Coordinates from Lat/Long to UK Grid 
----
Google-Adwords-v1.5.0
http://search.cpan.org/~rohan/Google-Adwords-v1.5.0/
an interface which abstracts the Google Adwords SOAP API 
----
HTML-Widget-Factory-0.059
http://search.cpan.org/~rjbs/HTML-Widget-Factory-0.059/
churn out HTML widgets 
----
IO-EventMux-1.01
http://search.cpan.org/~tlbdk/IO-EventMux-1.01/
Multiplexer for sockets, pipes and any other types of filehandles that you can set O_NONBLOCK on and does buffering for the user. 
----
Java-Swing-0.14
http://search.cpan.org/~philcrow/Java-Swing-0.14/
Perl extension providing direct access to the Java Swing API 
----
Language-MuldisD-0.6.0
http://search.cpan.org/~duncand/Language-MuldisD-0.6.0/
Formal spec of Muldis D relational DBMS lang 
----
Locale-Object-0.77
http://search.cpan.org/~hex/Locale-Object-0.77/
An object-oriented representation of locale information. 
----
MOSES-MOBY-0.82
http://search.cpan.org/~ekawas/MOSES-MOBY-0.82/
Perl extension for the automatic generation of BioMOBY web services 
----
Mollie-Micropayment-0.03
http://search.cpan.org/~ckras/Mollie-Micropayment-0.03/
Perl API for Mollie's Micropayment service 
----
Nagios-Plugin-0.19
http://search.cpan.org/~tonvoon/Nagios-Plugin-0.19/
a family of perl modules to streamline writing Nagios plugins 
----
Net-DNS-DynDNS-0.94
http://search.cpan.org/~ddick/Net-DNS-DynDNS-0.94/
Update dyndns.org with correct ip address for your domain name 
----
Net-Social-0.4
http://search.cpan.org/~simonw/Net-Social-0.4/
abstracted interface for social networks 
----
Ogre-0.23
http://search.cpan.org/~slanning/Ogre-0.23/
Perl binding for the OGRE C++ graphics library 
----
OpenGL-Shader-1.01
http://search.cpan.org/~bfree/OpenGL-Shader-1.01/
copyright 2007 Graphcomp - ALL RIGHTS RESERVED Author: Bob "grafman" Free - grafman@graphcomp.com 
----
POD2-Base-0.03
http://search.cpan.org/~ferreira/POD2-Base-0.03/
Base module for translations of Perl documentation 
----
POE-Component-Client-DNSBL-0.01
http://search.cpan.org/~bingos/POE-Component-Client-DNSBL-0.01/
A component that provides non-blocking DNSBL lookups 
----
POE-Component-Client-Stomp-0.01
http://search.cpan.org/~kesteb/POE-Component-Client-Stomp-0.01/
Perl extension for the POE Environment 
----
POE-Component-Server-DNS-0.08
http://search.cpan.org/~bingos/POE-Component-Server-DNS-0.08/
A non-blocking, concurrent DNS server POE component 
----
POE-Component-Server-DNS-0.09
http://search.cpan.org/~bingos/POE-Component-Server-DNS-0.09/
A non-blocking, concurrent DNS server POE component 
----
POE-Component-Server-DNS-0.10
http://search.cpan.org/~bingos/POE-Component-Server-DNS-0.10/
A non-blocking, concurrent DNS server POE component 
----
PSQL-Query-0.01_01
http://search.cpan.org/~ecarroll/PSQL-Query-0.01_01/
A framework to parse pg-query plans via the output of Explain / Explain Analyze 
----
Perl-Critic-1.073
http://search.cpan.org/~elliotjs/Perl-Critic-1.073/
Critique Perl source code for best-practices 
----
Perl-Critic-1.074
http://search.cpan.org/~elliotjs/Perl-Critic-1.074/
Critique Perl source code for best-practices 
----
Pod-Perldoc-3.14_03
http://search.cpan.org/~ferreira/Pod-Perldoc-3.14_03/
----
RPC-Async-1.01
http://search.cpan.org/~tlbdk/RPC-Async-1.01/
Asynchronous RPC framework 
----
RT-Extension-Converter-0.03
http://search.cpan.org/~falcone/RT-Extension-Converter-0.03/
base class for rtX-to-rt3 scripts 
----
RT-Extension-TicketLocking-0.02
http://search.cpan.org/~ruz/RT-Extension-TicketLocking-0.02/
Enables users to place advisory locks on tickets 
----
RT-Extension-TicketLocking-0.03
http://search.cpan.org/~ruz/RT-Extension-TicketLocking-0.03/
Enables users to place advisory locks on tickets 
----
ScatterPlot-0_2
http://search.cpan.org/~inventor/ScatterPlot-0_2/
Perl extension for drawing ASCII scatter plots 
----
Task-Catalyst-2.0001
http://search.cpan.org/~mramberg/Task-Catalyst-2.0001/
All you need to start with Catalyst 
----
Test-MockTime-0.06
http://search.cpan.org/~ddick/Test-MockTime-0.06/
Replaces actual time with simulated time 
----
Test-MockTime-0.07
http://search.cpan.org/~ddick/Test-MockTime-0.07/
Replaces actual time with simulated time 
----
Test-Smoke-1.20.05
http://search.cpan.org/~abeltje/Test-Smoke-1.20.05/
The Perl core test smoke suite 
----
WWW-Mechanize-TreeBuilder-1
http://search.cpan.org/~ash/WWW-Mechanize-TreeBuilder-1/
----
WWW-Spyder-0.21
http://search.cpan.org/~ashley/WWW-Spyder-0.21/
a simple non-persistent web crawler. 
----
WWW-Spyder-0.22
http://search.cpan.org/~ashley/WWW-Spyder-0.22/
a simple non-persistent web crawler. 


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/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Wed, 05 Sep 2007 05:19:25 -0000
From:  usenet@DavidFilmer.com
Subject: Re: Perl variable to shell command...?
Message-Id: <1188969565.004453.146680@r29g2000hsg.googlegroups.com>

On Sep 4, 4:43 pm, Tad McClellan <ta...@seesig.invalid> wrote:

> And use semicolons between statements.

Yeah, that too...




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

Date: Wed, 05 Sep 2007 02:09:19 GMT
From: "Peter Jamieson" <ldolan@thinkinghatbigpond.net.au>
Subject: Problem with reg expression
Message-Id: <jdoDi.31412$4A1.19444@news-server.bigpond.net.au>

#I want my script to parse HTML tables such as the one included below:

#!/usr/bin/perl -w
use strict;
use warnings;

my $moggy = '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD WIDTH=12% ALIGN=LEFT class=Tipster> RADIO TAB</TD>
<TD WIDTH=14% class=Tips> 3-2 </TD>
<TD WIDTH=16% ALIGN=LEFT class=Tipster></TD> <TD WIDTH=14% class=Tips></TD>
<TD WIDTH=14% ALIGN=CENTER></TD> <TD WIDTH=10% class=TrackCond> 520M</TD> 
<TD WIDTH=10%

class="TrackCond">FINE</TD> <TD WIDTH=10% class="TrackCondR">GOOD</TD> </TR>

</TABLE>';

# I tried this

$_ = $moggy;
  my ($d,$e,$f);
    $d=''; $e=''; $f='';

($d,$e,$f) = /TrackCond(.*)<\/TD>/g;

print "d ",$d," e ",$e," f ",$f,"\n";


 This produces for $d
 > 520M</TD> <TD WIDTH=10% class="TrackCond">FINE</TD> <TD WIDTH=10% 
class="TrackCondR">GOOD
 and no value for $e or $f

 I would have expected
 $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD

 Can anyone suggest why I don't get this and where I am going wrong here?
Any comments appreciated! 




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

Date: 05 Sep 2007 02:35:41 GMT
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: Problem with reg expression
Message-Id: <slrnfds5fs.2ofd.usenet@debranded.larseighner.com>

In our last episode, <jdoDi.31412$4A1.19444@news-server.bigpond.net.au>, the
lovely and talented Peter Jamieson broadcast on comp.lang.perl.misc:

> #I want my script to parse HTML tables such as the one included below:

> #!/usr/bin/perl -w
> use strict;
> use warnings;

> my $moggy = '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
><TR>
><TD WIDTH=12% ALIGN=LEFT class=Tipster> RADIO TAB</TD>
><TD WIDTH=14% class=Tips> 3-2 </TD>
><TD WIDTH=16% ALIGN=LEFT class=Tipster></TD> <TD WIDTH=14% class=Tips></TD>
><TD WIDTH=14% ALIGN=CENTER></TD> <TD WIDTH=10% class=TrackCond> 520M</TD> 
><TD WIDTH=10%

> class="TrackCond">FINE</TD> <TD WIDTH=10% class="TrackCondR">GOOD</TD> </TR>

></TABLE>';

> # I tried this

> $_ = $moggy;
>   my ($d,$e,$f);
>     $d=''; $e=''; $f='';

> ($d,$e,$f) = /TrackCond(.*)<\/TD>/g;

> print "d ",$d," e ",$e," f ",$f,"\n";


>  This produces for $d
> > 520M</TD> <TD WIDTH=10% class="TrackCond">FINE</TD> <TD WIDTH=10% 
> class="TrackCondR">GOOD
>  and no value for $e or $f

>  I would have expected
>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD

>  Can anyone suggest why I don't get this and where I am going wrong here?
> Any comments appreciated! 


First, regexes are extremely difficult to use to parse html.  Use
the HTML:Parser module.  (Yes, if you are a regex expert and know the
files you are working with, sometimes you can use quick and dirty
expressions for a particular ad hoc task, but if the nature of the files
change, your quick and dirty solution from last week is likely to be broken
this week.)

Second, regexes are naturally greedy.  Left unmodified they will make the
largest match possible, which is to say .*</TD> will not stop at the first
occurrence of </TD> but will do everything up to the last .*</TD>.  You
can consult the manual for ways of modifying this behavior, but it is still
not the way to parse HTML.

Third, what exactly did you think the values of $e and $f would be?
The assignment ($d,$e,$f) = /TrackCond(.*)<\/TD>/g; is nonsense whether
you are parsing html or a grocery list.

-- 
Lars Eighner     <http://larseighner.com/>     <http://myspace.com/larseighner>
                         Countdown: 503 days to go.
                    What do you do when you're debranded?


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

Date: Wed, 05 Sep 2007 05:06:57 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with reg expression
Message-Id: <5k6kqpF283tnU1@mid.individual.net>

Peter Jamieson wrote:
> #I want my script to parse HTML tables such as the one included below:
> 
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> 
> my $moggy = '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
> <TR>
> <TD WIDTH=12% ALIGN=LEFT class=Tipster> RADIO TAB</TD>
> <TD WIDTH=14% class=Tips> 3-2 </TD>
> <TD WIDTH=16% ALIGN=LEFT class=Tipster></TD> <TD WIDTH=14% class=Tips></TD>
> <TD WIDTH=14% ALIGN=CENTER></TD> <TD WIDTH=10% class=TrackCond> 520M</TD> 
> <TD WIDTH=10%
> 
> class="TrackCond">FINE</TD> <TD WIDTH=10% class="TrackCondR">GOOD</TD> </TR>
> 
> </TABLE>';
> 
> # I tried this
> 
> $_ = $moggy;
>   my ($d,$e,$f);
>     $d=''; $e=''; $f='';
> 
> ($d,$e,$f) = /TrackCond(.*)<\/TD>/g;
> 
> print "d ",$d," e ",$e," f ",$f,"\n";
> 
> 
>  This produces for $d
>  > 520M</TD> <TD WIDTH=10% class="TrackCond">FINE</TD> <TD WIDTH=10% 
> class="TrackCondR">GOOD
>  and no value for $e or $f
> 
>  I would have expected
>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD
> 
>  Can anyone suggest why I don't get this

Because regexes are greedy by default.

     ($d,$e,$f) = /TrackCond(.*?)<\/TD>/g;
------------------------------^

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 05 Sep 2007 05:09:44 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with reg expression
Message-Id: <5k6l00F283tnU2@mid.individual.net>

Lars Eighner wrote:
> In our last episode, <jdoDi.31412$4A1.19444@news-server.bigpond.net.au>, the
> lovely and talented Peter Jamieson broadcast on comp.lang.perl.misc:
>> 
>>  I would have expected
>>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD
> 
> Third, what exactly did you think the values of $e and $f would be?

The OP already let us know that, didn't he?

> The assignment ($d,$e,$f) = /TrackCond(.*)<\/TD>/g; is nonsense whether
> you are parsing html or a grocery list.

Why?

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: 05 Sep 2007 03:38:12 GMT
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: Problem with reg expression
Message-Id: <slrnfds953.9nr.usenet@debranded.larseighner.com>

In our last episode, 
<5k6l00F283tnU2@mid.individual.net>, 
the lovely and talented Gunnar Hjalmarsson 
broadcast on comp.lang.perl.misc:

> Lars Eighner wrote:
>> In our last episode, <jdoDi.31412$4A1.19444@news-server.bigpond.net.au>, the
>> lovely and talented Peter Jamieson broadcast on comp.lang.perl.misc:
>>> 
>>>  I would have expected
>>>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD
>> 
>> Third, what exactly did you think the values of $e and $f would be?

> The OP already let us know that, didn't he?

>> The assignment ($d,$e,$f) = /TrackCond(.*)<\/TD>/g; is nonsense whether
>> you are parsing html or a grocery list.

> Why?

because .* will eat everything that matches (if anything does) so
$e and $f will always be empty (and $d will be empty if there is no match).


-- 
Lars Eighner     <http://larseighner.com/>     <http://myspace.com/larseighner>
                         Countdown: 503 days to go.
                    What do you do when you're debranded?


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

Date: Wed, 05 Sep 2007 03:47:23 GMT
From: "Peter Jamieson" <ldolan@thinkinghatbigpond.net.au>
Subject: Re: Problem with reg expression
Message-Id: <fFpDi.31452$4A1.26896@news-server.bigpond.net.au>


>> #I want my script to parse HTML tables such as the one included below:
>
>> #!/usr/bin/perl -w
>> use strict;
>> use warnings;
>
>> my $moggy = '<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
>><TR>
>><TD WIDTH=12% ALIGN=LEFT class=Tipster> RADIO TAB</TD>
>><TD WIDTH=14% class=Tips> 3-2 </TD>
>><TD WIDTH=16% ALIGN=LEFT class=Tipster></TD> <TD WIDTH=14% 
>>class=Tips></TD>
>><TD WIDTH=14% ALIGN=CENTER></TD> <TD WIDTH=10% class=TrackCond> 520M</TD>
>><TD WIDTH=10%
>
>> class="TrackCond">FINE</TD> <TD WIDTH=10% class="TrackCondR">GOOD</TD> 
>> </TR>
>
>></TABLE>';
>
>> # I tried this
>
>> $_ = $moggy;
>>   my ($d,$e,$f);
>>     $d=''; $e=''; $f='';
>
>> ($d,$e,$f) = /TrackCond(.*)<\/TD>/g;
>
>> print "d ",$d," e ",$e," f ",$f,"\n";
>
>
>>  This produces for $d
>> > 520M</TD> <TD WIDTH=10% class="TrackCond">FINE</TD> <TD WIDTH=10%
>> class="TrackCondR">GOOD
>>  and no value for $e or $f
>
>>  I would have expected
>>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD
>
>>  Can anyone suggest why I don't get this and where I am going wrong here?
>> Any comments appreciated!
>
>
> First, regexes are extremely difficult to use to parse html.  Use
> the HTML:Parser module.  (Yes, if you are a regex expert and know the
> files you are working with, sometimes you can use quick and dirty
> expressions for a particular ad hoc task, but if the nature of the files
> change, your quick and dirty solution from last week is likely to be 
> broken
> this week.)

Thanks for the suggestion Lars, I will have a look at HTML::Parser module.
I have used my script for over 2 years, 62000 tables and this is oneof very 
few failures
so not too unhappy with it. If HTML::Parser beats this then I'll be very 
pleased.

> Second, regexes are naturally greedy.  Left unmodified they will make the
> largest match possible, which is to say .*</TD> will not stop at the first
> occurrence of </TD> but will do everything up to the last .*</TD>.  You
> can consult the manual for ways of modifying this behavior, but it is 
> still
> not the way to parse HTML.

Yes I hear what you claim but my script has performed very well so far, 
perhaps I was lucky.

> Third, what exactly did you think the values of $e and $f would be?

Perhaps you failed to read that part of the post?....I stated quite 
explicitly what I thought
the values should be as a guide to any would-be helper.

> The assignment ($d,$e,$f) = /TrackCond(.*)<\/TD>/g; is nonsense whether
> you are parsing html or a grocery list.

With  "use strict" and "use warnings" enabled I have been getting no warning 
messages
and output sent to my db is exactly as expected except for the one table 
above amongst may thousands.
Cheers and thanks for the advice to use HTML::Parser. I will have a look at 
it. 




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

Date: Wed, 05 Sep 2007 09:20:34 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: Problem with reg expression
Message-Id: <fbllc1$19p$1@nserver.hrz.tu-freiberg.de>

Peter Jamieson wrote:
> ($d,$e,$f) = /TrackCond(.*)<\/TD>/g;
> 
> print "d ",$d," e ",$e," f ",$f,"\n";
>  I would have expected
>  $d to be: > 520M, $e to be: ">FINE and $f: to be R">GOOD
>  Can anyone suggest why I don't get this and where I am going wrong here?

All has been said so far (all mysteries solved),
but I'd straighten up the whole thing a little bit:

    ...
    my $moggy = '
    <TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0>
     <TR>
       ...
       ...
     </TR>
    </TABLE>';

   my ($d, $e, $f) = ('','','');    # why is this necessary at all?

   ($d, $e, $f) = $moggy =~ /TrackCon[^>]+>\s*(.+?)<\/TD>/g;

   print "d=>'$d', e=>'$e', f=>'$f'\n"; # expand scalars in quotes
   ...

You don't need to put things into $_ in order
to get regular expressions applied, a $var =~ /regex/
will do fine. Furthermor, you can use [^>]+> if
you want to jump to the end of the <Tag name> of
any "TrackCond" variation.


Regards

M.


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

Date: Wed, 05 Sep 2007 11:48:06 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with reg expression
Message-Id: <5k7cauF2e7lrU1@mid.individual.net>

Lars Eighner wrote:
> In our last episode, 
> <5k6l00F283tnU2@mid.individual.net>, 
> the lovely and talented Gunnar Hjalmarsson 
> broadcast on comp.lang.perl.misc:
>> Lars Eighner wrote:
>>> The assignment ($d,$e,$f) = /TrackCond(.*)<\/TD>/g; is nonsense whether
>>> you are parsing html or a grocery list.
>> 
>> Why?
> 
> because .* will eat everything that matches (if anything does) so
> $e and $f will always be empty (and $d will be empty if there is no match).

I thought you had covered the greediness thing in your "Second" 
comment...  The failure to make .* non-greedy doesn't make the whole 
statement "nonsense" IMO.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

Date: Wed, 05 Sep 2007 09:48:32 -0000
From:  "satyakm79@gmail.com" <chinnari.kaddi@gmail.com>
Subject: To find size of an attachment in a POP3 server
Message-Id: <1188985712.756265.218150@w3g2000hsg.googlegroups.com>

Hi all,

I am trying to retrieve all the attachments from a POP3 server. But
before retrieving I would like to get the size of the attachment and
compare it with the available disk space in my local station and then
retrieve. Can anyone suggest me how to find the size of an attachment?
I am able to find the available disk space using File::Find. Plz find
my script below :

#!/usr/bin/perl

	use Carp;
	use Email::MIME;
	use File::Basename;
	use Net::POP3;
        use File::Find;

        my $server         = '192.168.100.254';
	my $receiveruname  = 'admin';
	my $password       = 'admin';
	my $attachment_dir = 'D:\\Attachments\\';

	my $pop = Net::POP3->new($server);
	croak "Couldn't connect to the server.\n\n" unless $pop;
	my $num_messages = $pop->login( $receiveruname, $password );
	croak "Connection trouble network password user ..."
	unless defined $num_messages;

	for my $i ( 1 .. $num_messages ) {

		my $aref = $pop->get($i);
  		my $em = Email::MIME->new( join '', @$aref );

  		for ( my @parts = $em->parts ) {
    			print $_->content_type, "\n";
    			next unless $_->content_type =~ m(^application/octet-stream)i;
    			my $filename = basename( $_->filename || '' );
    			my $basefilename = $filename || 'UNNAMED';

                        my $filesize = -s "$filename" ;
                        print "\nFilesize of $filename = $filesize
\n";

                        if ( $filename eq "null" ) {
                             	$pop->delete($i); 	# To avoid
downloading file "null" of 0KB
                        }
                        else {
                                open my $fh, ">", "$attachment_dir/
$filename" or croak $!;
    				binmode $fh;
    				print $fh $_->body;
                        	$pop->delete($i);
                        }

  		}
	}

	$pop->quit;



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

Date: Tue, 04 Sep 2007 20:09:24 -0700
From:  "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: Warning about unused lexical variables
Message-Id: <1188961764.611943.67570@g4g2000hsf.googlegroups.com>

On Sep 4, 3:25 am, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:
> Occasionally I notice a lexical variable sticking around which isn't
> used any more and can/should be deleted, like in this (stupid) example:
>
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my $x;
> my $y;
>
> $y = 42;
> print "$y\n";
> __END__
>
> This can be made slightly more complex by changing "my $x" to
>
> my $x = compute_some_value();
>
> where $x is assigned a value which is subsequently never used.
>
> It would be nice if perl could warn about lexical variables which are
> never used in their scope after their initialization. Does anybody else
> find this useful, and if so, is there a reason (besides "life is short")
> why it hasn't been implemented?
>
>         hp
>


You could use perl's backend to dump the lexical
variables and the line numbers on which they
appear:

$ nl -ba foo.pl
     1  #!/usr/bin/perl
     2  use strict;
     3  use warnings;
     4
     5  my $x;
     6  my $y;
     7
     8  $y = 42;
     9  print "$y\n";
    10


$ perl -MO=Xref foo.pl

File foo.pl
  Subroutine (definitions)
    Package Internals
      &HvREHASH         s0
      &SvREADONLY       s0
      &SvREFCNT         s0
      &hash_seed        s0
      &hv_clear_placeholders  s0
      &rehash_seed      s0
    Package PerlIO
      &get_layers       s0
    Package Regexp
      &DESTROY          s0
    Package UNIVERSAL
      &VERSION          s0
      &can              s0
      &isa              s0
  Subroutine (main)
    Package (lexical)
      $x                i5
      $y                i6, 8, 9
foo.pl syntax OK


This indicates that $x only appears on line 5.


--
Hope this helps,
Steven





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

Date: Wed, 05 Sep 2007 10:47:06 +0200
From: moldovenu <moldovenu@spamu.niet.interia.pl>
Subject: Re: web programming in perl
Message-Id: <fblqec$qbe$1@news.onet.pl>

> I have been out of the perl web programming sphere for a long time, so I 
> have a couple of quick question just to point me in the right direction.
> 
> - is perl used as much for web programming compared to f.ex php, ruby, 
> java?

It depends on many reasons - in companies where perl is used for years - 
yes - it is still in use. But it is more about perl at all compared to 
other langs, companies politics etc.

> - what are the primary forums for dicussing perl web programming these 
> days?
> - what are the most used web frameworks for perl? I have found out about 
> Catalyst, and it seems to be used on some known sites

Catalyst is probably the most popular and extensible MVC framework in 
perl. There are many "real business" projects made or in development 
using Catalyst. However it can take some time to be in production level 
in Cata. Check catalyst mail-list, irc; the documentation can a little 
suck but framework and community around it is really great.

There are also other modern frameworks like Jifty (people say: faster 
start-up compared to Catalyst) or kind of glue like CGI::App.

> links to articles discussing modern perl programming techniques and 
> frameworks would also be appreciated.

google for "MVC my_favourite_language"

mold


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

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


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