[29190] in Perl-Users-Digest
Perl-Users Digest, Issue: 434 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 14 14:10:07 2007
Date: Mon, 14 May 2007 11:09:11 -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 Mon, 14 May 2007 Volume: 11 Number: 434
Today's topics:
ASX parser module? <arnoud.zwemmer@gmail.com>
Re: ASX parser module? <bik.mido@tiscalinet.it>
Re: ASX parser module? <thepoet_nospam@arcor.de>
Re: ASX parser module? <bik.mido@tiscalinet.it>
Re: ASX parser module? <arnoud.zwemmer@gmail.com>
Re: Creating Packages <sisyphus1@nomail.afraid.org>
Re: Diff files with regex comparing <josef.moellers@fujitsu-siemens.com>
Re: Diff files with regex comparing <josef.moellers@fujitsu-siemens.com>
Dynamic page break <edMbj@aes-intl.com>
look <seventeen_7@hotmail.com>
looking for perl professionals <roaring.chicken@gmail.com>
Re: looking for perl professionals <lambik@kieffer.nl>
Re: looking for perl professionals <uri@stemsystems.com>
new CPAN modules on Mon May 14 2007 (Randal Schwartz)
Parsing a text file line-by-line: skipping badly-formed denis.papathanasiou@gmail.com
Re: Parsing a text file line-by-line: skipping badly-fo (Greg Bacon)
Re: suggestions on intelligent processing of data sets alt.testing@{g}mail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 May 2007 05:00:18 -0700
From: arz <arnoud.zwemmer@gmail.com>
Subject: ASX parser module?
Message-Id: <1179144018.313020.243980@l77g2000hsb.googlegroups.com>
Hi,
I need an ASX link checker script that parses ASX media description
files and checks whether the resulting links point to valid media
streams.
Searching at CPAN, it seems that there are some modules available for
creating ASX files, but not for parsing. So I was wondering is there
anything specifically available for parsing ASX or do I just need to
use any of the XML::* modules?
XML::Simple would seem good enough with the least amount of code, only
I guess the associative array will have case-insensitive keys, because
the ASX is case-insensitive, so the values will not be directly
addressable, and I'll have to iterate over the keys each time to find
which case is used...
Any other suggestion welcome.
Thanks,
Arnoud.
------------------------------
Date: Mon, 14 May 2007 14:33:53 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: ASX parser module?
Message-Id: <8mlg43l28o6vlemfpopbcu323vtrvire0m@4ax.com>
On 14 May 2007 05:00:18 -0700, arz <arnoud.zwemmer@gmail.com> wrote:
>Searching at CPAN, it seems that there are some modules available for
>creating ASX files, but not for parsing. So I was wondering is there
>anything specifically available for parsing ASX or do I just need to
>use any of the XML::* modules?
AIUI any XML parsing module would do.
>XML::Simple would seem good enough with the least amount of code, only
I second that.
>I guess the associative array will have case-insensitive keys, because
>the ASX is case-insensitive, so the values will not be directly
>addressable, and I'll have to iterate over the keys each time to find
>which case is used...
Nope, keys are strings, and as such *are* case sensitive. You have to
deal with ASX's case insensitiveness yourself. Doesn't seem a hard
task.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Mon, 14 May 2007 15:21:13 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: ASX parser module?
Message-Id: <4648624a$0$20296$9b4e6d93@newsspool3.arcor-online.net>
arz wrote:
> I need an ASX link checker script that parses ASX media description
> files and checks whether the resulting links point to valid media
> streams.
>
> Searching at CPAN, it seems that there are some modules available for
> creating ASX files, but not for parsing. So I was wondering is there
> anything specifically available for parsing ASX or do I just need to
> use any of the XML::* modules?
>
> XML::Simple would seem good enough with the least amount of code, only
> I guess the associative array will have case-insensitive keys, because
> the ASX is case-insensitive, so the values will not be directly
> addressable, and I'll have to iterate over the keys each time to find
> which case is used...
>
> Any other suggestion welcome.
Another relatively straight forward way would be with XML::TreeBuilder.
Instead of addressing hash keys you'd do something like
my $tree = XML::TreeBuilder->new;
$tree->parse_file('example.asx');
for my $entry ( $tree->look_down('_tag', 'entry' ) )
{
my $ref = $entry->look_down('_tag', 'ref');
if( $ref && $ref->attr('href') && validstream( $ref->attr('href') ) )
...
}
IMHO not too much typing overhead to get case-insensitive tag matching.
-Chris
------------------------------
Date: Mon, 14 May 2007 16:14:34 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: ASX parser module?
Message-Id: <42rg43ta12keqmquntqbvp72ak8uilgo6d@4ax.com>
On Mon, 14 May 2007 15:21:13 +0200, Christian Winter
<thepoet_nospam@arcor.de> wrote:
>Another relatively straight forward way would be with XML::TreeBuilder.
>Instead of addressing hash keys you'd do something like
Thanks, I have used H::T but didn't know X::T (although I may have
guessed) and for all of my XML stuff, since I'm really a noob at that
and don't have particular "performance" requirements, I use X::S. Now,
this is of course good news!
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 14 May 2007 08:30:46 -0700
From: arz <arnoud.zwemmer@gmail.com>
Subject: Re: ASX parser module?
Message-Id: <1179156646.849539.107920@h2g2000hsg.googlegroups.com>
On 14 mei, 15:21, Christian Winter <thepoet_nos...@arcor.de> wrote:
> arz wrote:
> > I need an ASX link checker script that parses ASX media description
> > files and checks whether the resulting links point to valid media
> > streams.
>
> > Searching at CPAN, it seems that there are some modules available for
> > creating ASX files, but not for parsing. So I was wondering is there
> > anything specifically available for parsing ASX or do I just need to
> > use any of the XML::* modules?
>
> > XML::Simple would seem good enough with the least amount of code, only
> > I guess the associative array will have case-insensitive keys, because
> > the ASX is case-insensitive, so the values will not be directly
> > addressable, and I'll have to iterate over the keys each time to find
> > which case is used...
>
> > Any other suggestion welcome.
>
> Another relatively straight forward way would be with XML::TreeBuilder.
> Instead of addressing hash keys you'd do something like
>
> my $tree = XML::TreeBuilder->new;
> $tree->parse_file('example.asx');
>
> for my $entry ( $tree->look_down('_tag', 'entry' ) )
> {
> my $ref = $entry->look_down('_tag', 'ref');
> if( $ref && $ref->attr('href') && validstream( $ref->attr('href') ) )
> ...
>
> }
>
> IMHO not too much typing overhead to get case-insensitive tag matching.
>
> -Chris
Thanks! This looks like what I need. Now I only need case checking for
'href' as an attribute, but all mixed-case tags are covered.
Straightforward indeed.
Arnoud.
------------------------------
Date: Tue, 15 May 2007 00:29:12 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: Creating Packages
Message-Id: <46487224$0$27448$afc38c87@news.optusnet.com.au>
"IanW" <whoami@whereami.net> wrote in message
news:f283pr$s1g$1@energise.enta.net...
.
.
>
> Would someone like to take a quick look at the script and tell me how
> difficult it would be to convert into a module, given the way I've written
> it? Would it require a huge amount of changing?
>
Not much changing at all. At the minimum (assuming you want the module to be
named GD::3DBarGrapher) all you need to do is place (at the beginning of the
file) the line:
package GD::3DBarGrapher;
Then if the file was saved as 3DBarGrapher.pm and placed in the GD folder
under one of the @INC directories, it could be accessed by:
use GD::3DBarGrapher;
But the functions contained in the 3DBarGrapher.pm would have to be accessed
by their "fully qualified" name - ie it would not be possible to call the
"creategraph" function by that name. It would have to be called as
GD::3DBarGrapher::creategraph().
Alternatively if you were to also put (near the top of 3DBarGrapher.pm) the
lines:
require Exporter;
@GD::3DBarGrapher::ISA = qw(Exporter);
@GD::3DBarGrapher::EXPORT_OK = qw(creategraph);
The module could then be loaded as:
use GD::3DBarGrapher qw(creategraph);
and the function creategraph() could be used - there would be no need for
the "fully qualified" name. (See 'perldoc Exporter' for full
details/options.)
You don't really need Exporter at all - it's just a convenience that's
usually provided, so that users can call (for example) the creategraph
function as 'creategraph()' instead of having to write
'GD::3DBarGrapher::creategraph()'
And you'll want to designate a version number:
$GD::3DBarGrapher::VERSION = '0.01'; # or whatever number you want
To create a proper CPAN distro, you'll also need a Makefile.PL, a CHANGES
file , a README file , and a test suite (or at least a test.pl) to ensure
that things are working as expected.
Cheers,
Rob
------------------------------
Date: Mon, 14 May 2007 10:49:35 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Diff files with regex comparing
Message-Id: <f297r1$nnl$1@nntp.fujitsu-siemens.com>
Michael Yang wrote:
> Here I have two files to diff, I want them compared with my rules.
> Let's one is base file, the other is result file:
> base file:
> Connected to the '.*'
> Hello everyone, I am .*
> Glad to see you, .*
>=20
> result file:
> Connected to the 'www.perl.com'
> Hello everyone, I am michael
> Nice to see you, all
>=20
> There are regex string ".*" in the base file, indicating that it could
> be replaced by any string. When the two lines being compared, I want
> it be considered equal when the ".*" matches the couter-part of the
> other, like the first two lines in the files shown above.
>=20
> So when diff these two files, only the last line is the difference
> data after diff.
> Glad to see you, .*
> Nice to see you, all
>=20
> I need to change the rules of diff program, and for that I need to
> implement my own diff algorithm.
> Is there any ways simpler to achieve this?
>=20
> I don't know if there are any interface providing user-defined
> comparison function to diff.
> If there is, I can implement my own comparison function telling it how
> to compare two lines and pass the function as the reference to the
> diff function. The diff function will compare and diff files using my
> comparison rules.
>=20
> Your helps are greatly appreciated!!
1. Be patient, posting the same request twice within a few minutes with=20
different subject lines is bad.
2. This is no place to ask for ready-to-run scripts. Have a try=20
yourself, post your code and we'll help getting bugs ironed out.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 14 May 2007 10:51:03 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Diff files with regex comparing
Message-Id: <f297tp$nnl$3@nntp.fujitsu-siemens.com>
Michael Yang wrote:
[ Problem description deleted ]
> Your helps are greatly appreciated!!
1. Be patient, posting the same request twice within a few minutes with=20
different subject lines is bad.
2. This is no place to ask for ready-to-run scripts. Have a try=20
yourself, post your code and we'll help getting bugs ironed out.
--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html
------------------------------
Date: Mon, 14 May 2007 10:55:02 -0700
From: Ed Jay <edMbj@aes-intl.com>
Subject: Dynamic page break
Message-Id: <0e8h431pdis9mudimvcgk938oe1jigltmp@4ax.com>
I have a Perl script that dynamically generates a report for printing. I
have so far been unable to conjure up a method for inserting page breaks at
the appropriate point in the report. Can someone offer a clue? TIA.
--
Ed Jay (remove 'M' to respond by email)
------------------------------
Date: 13 May 2007 23:34:09 -0700
From: fida <seventeen_7@hotmail.com>
Subject: look
Message-Id: <1179124449.043232.48930@n59g2000hsh.googlegroups.com>
aHR0cDovL3NhYWlkLm5ldC9mbGFzaC9yYXNvb2wwNS5odG0g2uQgx+HkyO0g483jzyDV4ewgx+Hh
5SDa4e3lIObT4eMKIGh0dHA6Ly9zYWFpZC5uZXQvZmxhc2gvVGhlVHJ1ZVJlbGlnaW9uLmh0bSDK
2tHt3SDIx+HH0+HH4wpodHRwOi8vc2FhaWQubmV0L2ZsYXNoL2xhc3QtYnJlYXRoLmh0bSDH4eTd
0yDH4cfO7dEKaHR0cDovL3NhYWlkLm5ldC9mbGFzaC90aGUtc2VhbC1vZi10aGUtcHJvcGhldHMu
aHRtIM7HyuMgx+HH5Mjtx8EKaHR0cDovL3NhYWlkLm5ldC9mbGFzaC8xMTM2NDQuaHRtINTRzSDH
4cfT4cfjCg==
------------------------------
Date: 14 May 2007 06:20:06 -0700
From: Doug <roaring.chicken@gmail.com>
Subject: looking for perl professionals
Message-Id: <1179148806.890620.115580@u30g2000hsc.googlegroups.com>
Hello ,
My name is Doug Cohen and I am a Senior Recruiter for c CIDC is a
profitable and growing Internet-based software company that has been
developing and refining its online gaming technology and eBusiness
operational expertise for over seven years. Through our technology, we
have become the most trusted name in online gaming and entertainment
worldwide. CIDC developed the gaming and entertainment software for
sites such as Everest Poker and Everest Casino at
www.everestpoker.com/www.everestcasino.com. For more information,
please visit our corporate site at www.cidc.com. We have an excellent
benefits package including Medical/Dental, 401K, vacation, informal,
team and fun environment. (sorry, no telecommuting at this time)
Due to our growth we are currently recruiting for a full time Software
engineer-Perl for our Cambridge, MA location:
Job Summary
You would become a member of our Server Team build, in which you would
be able to use all of your software skills to implement, maintain and
extend dynamic web applications for on-line gaming and Internet
marketing. In addition, you would develop and maintain a number of
support and data analysis scripts.
Requirements
To be successful in this role your background will need 2 to 5 years
of:
=B7 Perl in Unix/Linux environment
=B7 Experience with development of e-commerce applications involving
mod_perl, Mason, Catalyst, Template Toolkit, Apache web servers, DBI,
CGI, SQL, HTML, and relational databases.
=B7 Experience with financial applications, Informix, AJAX,
Internationalization and Localization a plus
=B7 Computer Science degree or equivalent is a must
=B7 Good communication and organizational skills
If you are interested in this position or finding out other
opportunities at CDIC forward your resume to dcohen@cidc.com or call
him at 617-547-6323 x315 (relocation is available)
------------------------------
Date: Mon, 14 May 2007 19:44:38 +0200
From: "Lambik" <lambik@kieffer.nl>
Subject: Re: looking for perl professionals
Message-Id: <46489ff4$0$37754$5fc3050@dreader2.news.tiscali.nl>
"Doug" <roaring.chicken@gmail.com> wrote in message
news:1179148806.890620.115580@u30g2000hsc.googlegroups.com...
> <Cut some SPAM>
#!/bin/perl
use strict;
use Net::NNTP;
my $nntpserver = 'news3.telebyte.nl';
my $newsgroup = 'alt.jobs';
my $server = Net::NNTP->new( $nntpserver, Debug => 0) || die $!;
my ($aantal, $first, $last, $group) = $server->group($newsgroup);
for (my $tel=$last; $tel >= $first;$tel--) {
my $header = $server->head($tel) || next;
foreach (@$header) {
print if (/^From|^Subject|^Date/i);
} #end foreach
print "\n";
} ## end for
$server->quit();
------------------------------
Date: Mon, 14 May 2007 17:45:39 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: looking for perl professionals
Message-Id: <x7ejlj8fjv.fsf@mail.sysarch.com>
>>>>> "D" == Doug <roaring.chicken@gmail.com> writes:
D> My name is Doug Cohen and I am a Senior Recruiter for c CIDC is a
D> profitable and growing Internet-based software company that has
D> been developing and refining its online gaming technology and
D> eBusiness operational expertise for over seven years. Through our
D> technology, we have become the most trusted name in online gaming
D> and entertainment worldwide. CIDC developed the gaming and
D> entertainment software for sites such as Everest Poker and Everest
D> Casino at www.everestpoker.com/www.everestcasino.com. For more
D> information, please visit our corporate site at www.cidc.com. We
D> have an excellent benefits package including Medical/Dental, 401K,
D> vacation, informal, team and fun environment. (sorry, no
D> telecommuting at this time)
this is not the place for job postings. and you have already posted job
leads to the boston.pm list and jobs.perl.org. this group is for
discussing perl and not perl jobs.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 14 May 2007 04:42:09 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon May 14 2007
Message-Id: <JI0L29.2183@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Acme-Dahut-Call-0.01
http://search.cpan.org/~perigrin/Acme-Dahut-Call-0.01/
replicates the melodious sound of the wild Dahut ... in Text.
----
Acme-POE-Acronym-Generator-1.01
http://search.cpan.org/~bingos/Acme-POE-Acronym-Generator-1.01/
Generate random POE acronyms.
----
Algorithm-Combinatorics-0.21
http://search.cpan.org/~fxn/Algorithm-Combinatorics-0.21/
Efficient generation of combinatorial sequences
----
Algorithm-Combinatorics-0.22
http://search.cpan.org/~fxn/Algorithm-Combinatorics-0.22/
Efficient generation of combinatorial sequences
----
Bundle-Bender-1.0
http://search.cpan.org/~perigrin/Bundle-Bender-1.0/
Bundle to install all Bender related Modules
----
Bundle-POE-IRC-1.02
http://search.cpan.org/~bingos/Bundle-POE-IRC-1.02/
Bundle to install all POE related IRC modules.
----
Catalyst-Model-DBI-0.19
http://search.cpan.org/~alexp/Catalyst-Model-DBI-0.19/
DBI Model Class
----
DBI-1.56
http://search.cpan.org/~timb/DBI-1.56/
Database independent interface for Perl
----
DBIx-Class-StorageReadOnly-0.05
http://search.cpan.org/~nekokak/DBIx-Class-StorageReadOnly-0.05/
Can't insert and update and delete for DBIC
----
DBIx-VersionedSubs-0.05
http://search.cpan.org/~corion/DBIx-VersionedSubs-0.05/
all your code are belong into the DB
----
Data-Alias-1.05
http://search.cpan.org/~xmath/Data-Alias-1.05/
Comprehensive set of aliasing operations
----
Devel-Backtrace-0.04
http://search.cpan.org/~pepe/Devel-Backtrace-0.04/
Object-oriented backtrace
----
Egg-Plugin-SessionKit-Auth-2.00
http://search.cpan.org/~lushe/Egg-Plugin-SessionKit-Auth-2.00/
Authentication of session base.
----
Egg-Release-2.04
http://search.cpan.org/~lushe/Egg-Release-2.04/
Version of Egg WEB Application Framework.
----
Email-Folder-Exchange-1.10
http://search.cpan.org/~wsmith/Email-Folder-Exchange-1.10/
Email::Folder access to exchange folders via WebDAV
----
ExtUtils-CBuilder-0.19
http://search.cpan.org/~kwilliams/ExtUtils-CBuilder-0.19/
Compile and link C code for Perl modules
----
Gaim-Log-Parser-0.08
http://search.cpan.org/~mschilli/Gaim-Log-Parser-0.08/
Parse Gaim's Log Files
----
HTML-Menu-TreeView-0.6
http://search.cpan.org/~lze/HTML-Menu-TreeView-0.6/
----
IPC-Messaging-0.01_03
http://search.cpan.org/~gruber/IPC-Messaging-0.01_03/
process handling and message passing, Erlang style
----
JE-0.012
http://search.cpan.org/~sprout/JE-0.012/
Pure-Perl ECMAScript (JavaScript) Engine
----
JSON-Any-1.07
http://search.cpan.org/~perigrin/JSON-Any-1.07/
Wrapper Class for the various JSON classes.
----
JSON-DWIW-0.10
http://search.cpan.org/~dowens/JSON-DWIW-0.10/
JSON converter that Does What I Want
----
Lyrics-Fetcher-LyricWiki-0.01
http://search.cpan.org/~bigpresh/Lyrics-Fetcher-LyricWiki-0.01/
Get song lyrics from www.LyricWiki.org
----
Net-AIML-0.0.2
http://search.cpan.org/~perigrin/Net-AIML-0.0.2/
Perl interface to the Pandorabots.com AIML server
----
Net-CascadeCopy-v0.0.11
http://search.cpan.org/~vvu/Net-CascadeCopy-v0.0.11/
efficiently copy files to many servers in multiple locations
----
OpenGuides-0.60
http://search.cpan.org/~dom/OpenGuides-0.60/
A complete web application for managing a collaboratively-written guide to a city or town.
----
POE-Component-Client-MPD-0.2.0
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.2.0/
a full-blown mpd client library
----
POE-Component-Client-MPD-0.3.0
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.3.0/
a full-blown mpd client library
----
POE-Component-Client-MPD-0.3.1
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.3.1/
a full-blown mpd client library
----
POE-Component-Client-MPD-0.4.0
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.4.0/
a full-blown mpd client library
----
Parse-Fedora-Packages-0.01
http://search.cpan.org/~szabgab/Parse-Fedora-Packages-0.01/
Parse Fedora package information
----
Parse-QTEDI-0.11
http://search.cpan.org/~dongxu/Parse-QTEDI-0.11/
Parse QT/KDE preprocessed headers
----
RRDTool-OO-0.19
http://search.cpan.org/~mschilli/RRDTool-OO-0.19/
Object-oriented interface to RRDTool
----
Template-Plugin-CSV-Escape-0.01
http://search.cpan.org/~miyazaki/Template-Plugin-CSV-Escape-0.01/
CSV escape a string
----
Template-Plugin-Filter-VisualTruncate-0.01
http://search.cpan.org/~bokutin/Template-Plugin-Filter-VisualTruncate-0.01/
Filter Plugin for trimming text by the number of the columns of terminals and mobile phones.
----
Template-Plugin-Filter-VisualTruncate-0.02
http://search.cpan.org/~bokutin/Template-Plugin-Filter-VisualTruncate-0.02/
Filter Plugin for trimming text by the number of the columns of terminals and mobile phones.
----
WWW-CheckSite-0.018
http://search.cpan.org/~abeltje/WWW-CheckSite-0.018/
OO interface to an iterator that checks a website
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: 14 May 2007 08:10:29 -0700
From: denis.papathanasiou@gmail.com
Subject: Parsing a text file line-by-line: skipping badly-formed lines?
Message-Id: <1179155429.727899.261790@k79g2000hse.googlegroups.com>
I have a script which reads a plain text (dos) file line-by-line and
splits it into several smaller files, based on a single attribute.
The code (below) works, except when a line is malformed (i.e., the
line contains binary or control characters), and the script just exits
with an error:
open(IN, "$IN_FILE") or die "\n\terror: Could not read $IN_FILE $!
\n"; ;
binmode(IN);
while( $ln=<IN> ) {
if( $ln =~ m/\r\n$/ ) {
$ln =~ s/\r\n$/\n/; # dos2unix: convert CR LF to LF
if( $. > 0 ) { # skip the header line
$sym = substr($ln, 10, 16);
$sym =~ s/ //g;
if( $prior_sym ne $sym ) {
if( $prior_sym ne '' ) { close(OUT); }
$sym_file = $OUT_PATH . "/" . $sym . "." . $OUT_SUFFIX ;
open(OUT, ">$sym_file") or die "\n\terror: Could not write to
$sym_file $!\n";
binmode(OUT);
}
print OUT $ln;
$prior_sym = $sym ;
}
}
}
close(IN);
What I'd like it to do, instead, is if it hits a bad line, write a
warning and keep going to the end of the file.
I've tried wrapping the block above in "eval { }; warn $@ if $@;" but
that doesn't trap the error; even with eval/warn, a bad line will
cause the script to exit.
Is there a better way of doing this?
------------------------------
Date: Mon, 14 May 2007 16:42:21 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Parsing a text file line-by-line: skipping badly-formed lines?
Message-Id: <134h4bddro5qa79@corp.supernews.com>
In article <1179155429.727899.261790@k79g2000hse.googlegroups.com>,
<denis.papathanasiou@gmail.com> wrote:
: I've tried wrapping the block above in "eval { }; warn $@ if $@;" but
: that doesn't trap the error; even with eval/warn, a bad line will
: cause the script to exit.
You say your program exits with an error, but you didn't say what
the error is.
What's the error? What version of perl are you using? What's your
operating system?
Your chances of receiving a helpful reply are even better if you can
provide input that causes the problem. Yes, transmitting non-printable
characters on Usenet is a pain, so uuencode the input or write a Perl
program that can recreate it!
Greg
--
When buying and selling are controlled by legislation, the first
things to be bought and sold are legislators.
-- P. J. O'Rourke
------------------------------
Date: Mon, 14 May 2007 17:47:28 +1000
From: alt.testing@{g}mail.com
Subject: Re: suggestions on intelligent processing of data sets in a file
Message-Id: <vv4g439iuc9rpubqeov7f6b3oq8g27r2l4@4ax.com>
On Wed, 9 May 2007 06:05:40 -0500, Tad McClellan
<tadmc@augustmail.com> wrote:
>alt.testing@{g}mail.com <alt.testing@{g}mail.com> wrote:
>
>> Some of the files even vary in the number of fields therein.
>>
>> Example: (fields are email, name, postcode, phone)
>> email@email.com, Firstname Lastname
>> email@email.com, Firstname Lastname, 2004, 0412 321 512
>> email@email.com, Firstname Lastname, 0412 321 512
>
>
>> I want to build a mechanism that can:
>>
>> 1. Autodetect the number of fields and "line-by-line" respectively
>> build the data structure as it goes.
>> 2. Verify (or guess the "type" of field using regex)
>
>
>------------------------
>#!/usr/bin/perl
>use warnings;
>use strict;
>use Data::Dumper;
>
>while ( <DATA> ) {
> chomp;
> my %record;
> foreach my $part ( split /,\s*/ ) {
> if ( $part =~ /^\d+$/ ) # all digits
> { $record{postcode} = $part }
> elsif ( $part =~ /^[\d\s]+$/ ) # digits with spaces
> { $record{phone} = $part }
> elsif ( $part =~ /@/ ) # contains at-sign
> { $record{email} = $part }
> else
> { $record{name} = $part }
> }
> print Dumper \%record;
>}
>
>__DATA__
>email@email.com, Firstname Lastname
>email@email.com, Firstname Lastname, 2004, 0412 321 512
>email@email.com, Firstname Lastname, 0412 321 512
>------------------------
thanks Tad
------------------------------
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 434
**************************************