[30001] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1244 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 31 03:09:42 2008

Date: Thu, 31 Jan 2008 00:09:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 31 Jan 2008     Volume: 11 Number: 1244

Today's topics:
    Re: "negative" regexp <stoupa@practisoft.cz>
        Can't get PAR packager to run pp <tony@abc.edu>
    Re: Can't get PAR packager to run pp <ben@morrow.me.uk>
    Re: Can't get PAR packager to run pp <jl_post@hotmail.com>
    Re: Can't get PAR packager to run pp <ben@morrow.me.uk>
    Re: Can't get PAR packager to run pp <astewart1@cox.net>
        Getting application ReadLine and Perl debugger ReadLine <adefaria@gmail.com>
    Re: Getting application ReadLine and Perl debugger Read <ben@morrow.me.uk>
        Magic for object constructor wanted <koszalekopalek@interia.pl>
    Re: Magic for object constructor wanted <koszalekopalek@interia.pl>
    Re: Magic for object constructor wanted <m@rtij.nl.invlalid>
        new CPAN modules on Thu Jan 31 2008 (Randal Schwartz)
        perl problem <swarupapradhan@gmail.com>
    Re: perl problem <jurgenex@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 31 Jan 2008 01:54:11 +0100
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: "negative" regexp
Message-Id: <fnr6an$2rgq$1@ns.felk.cvut.cz>

Michele Dondi wrote:
> On Wed, 30 Jan 2008 16:10:15 +0100, "Petr Vileta"
> <stoupa@practisoft.cz> wrote:
>
>> I'm tending to not use HTMP parsers because these construct a huge
>> hashes and this is usually not needed for my purposes.
>
> Huh?!? Evidence?
>
>
Example for convert any basic html page to plain text.

# remove all except body content
$html=~s/^.+?<body.*?>(.+?)<\/body>.*$/$1/si;
# remove all scripts
$html=~s/<script.+?<\/script>//sig;
# remove all images
$html=~s/<img\s+.+?>//sig;
# remove all html coments
$html=~s/<\!\-\-.+?\-\->//sig;
# replace possible table end-of-row or <br> with new line
$html=~s/(<\/tr>|<br>)/\n/sig;
# remove all remaining html tags

$html=~s/<.+?>//sg;

Now I have plain text. Yes, this way is not ideal but is quickly and consumpt 
low memory.
-- 
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to <petr AT practisoft DOT cz>



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

Date: Wed, 30 Jan 2008 16:58:29 -0500
From: "Tony T." <tony@abc.edu>
Subject: Can't get PAR packager to run pp
Message-Id: <WLydnVgO1dmSbj3anZ2dnUVZ_jmdnZ2d@crocker.com>

Hi:

To create executables, in the past, I've simply used the ppm to install PAR.
This placed pp.bat in the \Perl\site\bin directory.
Easy.

Now, the same steps don't work. I've used both the ppm gui and the command 
line.
Everything seems to install just fine, but no pp is anywhere on my system.

Can someone tell me how to set this up?

Thanks,

Tony




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

Date: Wed, 30 Jan 2008 23:35:58 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can't get PAR packager to run pp
Message-Id: <u7e775-8nh.ln1@osiris.mauzo.dyndns.org>


Quoth "Tony T." <tony@abc.edu>:
> 
> To create executables, in the past, I've simply used the ppm to install PAR.
> This placed pp.bat in the \Perl\site\bin directory.
> Easy.
> 
> Now, the same steps don't work. I've used both the ppm gui and the command 
> line.
> Everything seems to install just fine, but no pp is anywhere on my system.
> 
> Can someone tell me how to set this up?

pp itself has moved into the PAR-Packer distribution. IIRC ActiveState
provide a ppm of this too.

Ben



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

Date: Wed, 30 Jan 2008 15:53:36 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Can't get PAR packager to run pp
Message-Id: <abf14ac0-3386-4274-877e-f8064e9ee65b@f47g2000hsd.googlegroups.com>

On Jan 30, 2:58 pm, "Tony T." <t...@abc.edu> wrote:
>
> To create executables, in the past, I've simply used the ppm to install PAR.
> This placed pp.bat in the \Perl\site\bin directory.
> Easy.
>
> Now, the same steps don't work. I've used both the ppm gui and the command
> line.
> Everything seems to install just fine, but no pp is anywhere on my system.


   A similar problem happened recently to a co-worker of mine.  For
some reason, he just didn't have the "pp" executable anywhere in his
%PATH%.

   He eventually fixed the problem by going to the Perl Package
Manager and adding a new repository.  Then he was able to successfully
install PAR with the command:

      ppm install PAR

   As to which repository he added, I am not sure.  Perhaps someone
here can give a good repository to add, or maybe Googling around a bit
can help.

   If you get it to work by adding a new repository, let me know what
you added.

   Thanks.

   -- Jean-Luc


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

Date: Thu, 31 Jan 2008 00:13:25 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can't get PAR packager to run pp
Message-Id: <5eg775-l0i.ln1@osiris.mauzo.dyndns.org>


Quoth "jl_post@hotmail.com" <jl_post@hotmail.com>:
> On Jan 30, 2:58 pm, "Tony T." <t...@abc.edu> wrote:
> >
> > To create executables, in the past, I've simply used the ppm to install PAR.
> > This placed pp.bat in the \Perl\site\bin directory.
> > Easy.
> >
> > Now, the same steps don't work. I've used both the ppm gui and the command
> > line.
> > Everything seems to install just fine, but no pp is anywhere on my system.
> 
> 
>    A similar problem happened recently to a co-worker of mine.  For
> some reason, he just didn't have the "pp" executable anywhere in his
> %PATH%.
> 
>    He eventually fixed the problem by going to the Perl Package
> Manager and adding a new repository.  Then he was able to successfully
> install PAR with the command:
> 
>       ppm install PAR

ACK! Bad plan. This will probably give you an older version of PAR. It
would be much better to install the current versions of PAR and
PAR-Packer from the AS repo.

Ben



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

Date: Wed, 30 Jan 2008 18:29:36 -0800
From: Alan Stewart <astewart1@cox.net>
Subject: Re: Can't get PAR packager to run pp
Message-Id: <tgc2q311i8pd3qn2a0kr5oi9bbtgqbcbgn@4ax.com>

On Thu, 31 Jan 2008 00:13:25 +0000, Ben Morrow <ben@morrow.me.uk>
wrote:

>
>Quoth "jl_post@hotmail.com" <jl_post@hotmail.com>:
>> On Jan 30, 2:58 pm, "Tony T." <t...@abc.edu> wrote:
>> >
>> > To create executables, in the past, I've simply used the ppm to install PAR.
>> > This placed pp.bat in the \Perl\site\bin directory.
>> > Easy.
>> >
>> > Now, the same steps don't work. I've used both the ppm gui and the command
>> > line.
>> > Everything seems to install just fine, but no pp is anywhere on my system.
>> 
>> 
>>    A similar problem happened recently to a co-worker of mine.  For
>> some reason, he just didn't have the "pp" executable anywhere in his
>> %PATH%.
>> 
>>    He eventually fixed the problem by going to the Perl Package
>> Manager and adding a new repository.  Then he was able to successfully
>> install PAR with the command:
>> 
>>       ppm install PAR
>
>ACK! Bad plan. This will probably give you an older version of PAR. It
>would be much better to install the current versions of PAR and
>PAR-Packer from the AS repo.
>
>Ben

Actually, Activestate has frequently been behind the curve on PAR
releases. I recommend getting PAR from bribes, instructions at:

http://www.bribes.org/perl/ppmdir.html

It's up to date with CPAN for PAR.

Alan


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

Date: Wed, 30 Jan 2008 15:26:28 -0800 (PST)
From: Andrew DeFaria <adefaria@gmail.com>
Subject: Getting application ReadLine and Perl debugger ReadLine to cooperate
Message-Id: <8ac1cccd-79b8-4c16-93d9-9b0ff0d2e3f8@v4g2000hsf.googlegroups.com>

I have an example Perl script that uses Term::ReadLine::Gnu to provide
ReadLine support with command history:

#!/usr/local/bin/perl
use Term::ReadLine;
use Term::ReadLine::Gnu;

my $term = new Term::ReadLine "test";

while () {
  $_ = $term->readline ("Command:");

  last if !$_;

  print "Read command: $_\n":
} # while

exit;

When run it runs fine, doesn't do much, but dutifully reads commands
and stores them in the history. IOW up arrow works to recall commands
and I can edit them. IOW Term::ReadLine::Gnu is installed properly and
functioning.

Now I wish to debug this script. So I do perl -d testReadLine.pl.
Initially the Perl debugger works. I can do commands like l for list
or s for step. However, as soon as I return from the new
Term::ReadLine the debugger is confused. No command does anything.

I fully suspect that the problem lies in the fact that both my Perl
script and the Perl debugger are fighting over STDIN/STDOUT and
confusing each other. The question is how to get them both to play
nice.

Suggestions? Workarounds? Solutions?


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

Date: Wed, 30 Jan 2008 23:46:45 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Getting application ReadLine and Perl debugger ReadLine to cooperate
Message-Id: <5se775-8nh.ln1@osiris.mauzo.dyndns.org>


Quoth Andrew DeFaria <adefaria@gmail.com>:
> I have an example Perl script that uses Term::ReadLine::Gnu to provide
> ReadLine support with command history:
> 
> #!/usr/local/bin/perl
> use Term::ReadLine;
> use Term::ReadLine::Gnu;
> 
<snip>
> 
> When run it runs fine, doesn't do much, but dutifully reads commands
> and stores them in the history. IOW up arrow works to recall commands
> and I can edit them. IOW Term::ReadLine::Gnu is installed properly and
> functioning.
> 
> Now I wish to debug this script. So I do perl -d testReadLine.pl.
> Initially the Perl debugger works. I can do commands like l for list
> or s for step. However, as soon as I return from the new
> Term::ReadLine the debugger is confused. No command does anything.
> 
> I fully suspect that the problem lies in the fact that both my Perl
> script and the Perl debugger are fighting over STDIN/STDOUT and
> confusing each other. The question is how to get them both to play
> nice.

It may also be because the debugger is also using Term::Readline::Gnu. I
don't know if the underlying readline library can cope with two users at
once. You may want to try the debugger options TTY and ReadLine (see
perldoc perldebug).

Ben



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

Date: Wed, 30 Jan 2008 22:05:45 -0800 (PST)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Magic for object constructor wanted
Message-Id: <ef169115-f788-4659-9984-a47f3274ace8@j20g2000hsi.googlegroups.com>

My code creates new objects and then populates them with
data, like this:

my $joe = Dude->new();
my $tom = Dude->new();
my $ann = Dude->new();
my $jane = Dude->new();

$joe->fill(
	name => "joe",
	friends => [ $ann, $tom ]
);

$jane->fill(
	name => "jane",
	friends => [ $ann ]
);

You will notice that the name field is always the same as
the variable that stores the object. What kind of magic
would I have to use in the constructor (or in the fill()
method) so that the name of the object does not have
to be specified explicitly? In other words, I would like to
be able to say:

$joe->fill(
	friends => [ $ann, tom ]
);

$jane->fill(
	friends => [ $ann ]
);

and still have the name field set. This saves typing and
makes sure the variable name and the name field match.

Is this possible?

Koszalek


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

Date: Wed, 30 Jan 2008 22:14:11 -0800 (PST)
From: Koszalek Opalek <koszalekopalek@interia.pl>
Subject: Re: Magic for object constructor wanted
Message-Id: <d47b6e25-3efc-4a9f-a021-ddfe2d2f251d@j20g2000hsi.googlegroups.com>

On Jan 31, 7:05 am, Koszalek Opalek <koszalekopa...@interia.pl> wrote:

(...)

> the name of the object does not have
> to be specified explicitly? In other words, I would like to
> be able to say:
>
> $joe->fill(
>         friends => [ $ann, tom ]
> );
>
> $jane->fill(
>         friends => [ $ann ]
> );
>
> and still have the name field set. This saves typing and
> makes sure the variable name and the name field match.


The following just occurred to me. It would be cool...
if it worked :-) I have created a @Dudes array and then
iterate over the array creating objects dynamically
with eval() and passing whatever I need to the constructor.

The code errors out with
    Can't call method "friends" on an undefined value at q.pl line 35.

Is there a way to declare variables with eval() in the
calling scope?

#!/usr/bin/perl
use strict;
no strict "vars";
use warnings;


{
package Dude;

sub new
{
	my $class = shift;
	my $self = {@_};
	print "new() executed\n";
	bless $self, $class;
};

sub friends
{
	print "hello from $_[0]->{name}\n";
}
}


my @Dudes = ("joe", "tim");

for (@Dudes) {
	my $code = qq{my \$$_ = Dude->new( "name" => "$_"); \$joe-
>friends();};
	print "$code\n";
	eval $code;
};

$joe->friends();


__END__

Koszalek


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

Date: Thu, 31 Jan 2008 08:39:32 +0100
From: Martijn Lievaart <m@rtij.nl.invlalid>
Subject: Re: Magic for object constructor wanted
Message-Id: <pan.2008.01.31.07.39.32@rtij.nl.invlalid>

On Wed, 30 Jan 2008 22:05:45 -0800, Koszalek Opalek wrote:

> My code creates new objects and then populates them with data, like
> this:
> 
> my $joe = Dude->new();
> my $tom = Dude->new();
> my $ann = Dude->new();
> my $jane = Dude->new();
> 
> $joe->fill(
> 	name => "joe",
> 	friends => [ $ann, $tom ]
> );
> 
> $jane->fill(
> 	name => "jane",
> 	friends => [ $ann ]
> );
> 
> You will notice that the name field is always the same as the variable
> that stores the object. What kind of magic would I have to use in the
> constructor (or in the fill() method) so that the name of the object
> does not have to be specified explicitly? In other words, I would like
> to be able to say:
> 
> $joe->fill(
> 	friends => [ $ann, tom ]
> );
> 
> $jane->fill(
> 	friends => [ $ann ]
> );
> 
> and still have the name field set. This saves typing and makes sure the
> variable name and the name field match.

Sure. Just don't put the objects in separate variables, put them in a 
hash.


Even better, bless the hash, iow make it its own class.

Then you get something like:

use Friends;

$friends = new Friends;


$friends->add(
	name => "joe",
	friends => [ "ann", "tom" ]
);

$friends->add(
	name => "jane",
	friends => [ "ann" ]
);

Or, if these are the only options, even shorter, either:

$friends->add("joe",[ "ann", "tom" ]);

or even:

$friends->add("joe", "ann", "tom" );

The disadvantage is that you loose the compile time checking wether those 
friends exist. You code will not compile if I use $anne instead of $ann, 
my suggestion will compile, run and probably not even notice.

What you also can do, is store the name of the Dude in the Dude object. 
This is better design anyhow, but does not save you the extra redundancy 
of specifying the name twice:

my $joe = Dude->new("joe");
my $tom = Dude->new("tom");
my $ann = Dude->new("ann");
my $jane = Dude->new("jane");

$joe->add_friends($ann, $tom);
$jane->add_friends($ann);


M4


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

Date: Thu, 31 Jan 2008 05:42:24 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jan 31 2008
Message-Id: <JvHuIo.6Fq@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.

AI-NaiveBayes1-1.5
http://search.cpan.org/~vlado/AI-NaiveBayes1-1.5/
Bayesian prediction of categories 
----
App-Bondage-0.2.2
http://search.cpan.org/~hinrik/App-Bondage-0.2.2/
A featureful easy-to-use IRC bouncer 
----
App-Bondage-0.2.3
http://search.cpan.org/~hinrik/App-Bondage-0.2.3/
A featureful easy-to-use IRC bouncer 
----
Authen-Krb5-Admin-0.10
http://search.cpan.org/~korty/Authen-Krb5-Admin-0.10/
Perl extension for MIT Kerberos 5 admin interface 
----
CHI-0.05
http://search.cpan.org/~jswartz/CHI-0.05/
Unified cache interface 
----
CPAN-Site-0.17
http://search.cpan.org/~markov/CPAN-Site-0.17/
CPAN.pm subclass for adding site local modules 
----
Catalyst-Plugin-Shortcut-0.02
http://search.cpan.org/~cub/Catalyst-Plugin-Shortcut-0.02/
shortcut collection for some methods of Catalyst. 
----
CatalystX-Controller-Tabs-0.02
http://search.cpan.org/~jasonk/CatalystX-Controller-Tabs-0.02/
Automatically build tab sets for a controller 
----
Class-Simple-0.18
http://search.cpan.org/~sullivan/Class-Simple-0.18/
Simple Object-Oriented Base Class 
----
Device-Davis-1.2.3
http://search.cpan.org/~stsander/Device-Davis-1.2.3/
Perl extension for communicating with Davis weather stations 
----
Dir-Self-0.03
http://search.cpan.org/~mauke/Dir-Self-0.03/
a __DIR__ constant for the directory your source file is in 
----
HTML-Mason-1.39
http://search.cpan.org/~drolsky/HTML-Mason-1.39/
High-performance, dynamic web site authoring system 
----
IO-CaptureOutput-1.07_01
http://search.cpan.org/~dagolden/IO-CaptureOutput-1.07_01/
capture STDOUT and STDERR from Perl code, subprocesses or XS 
----
LIMS-Controller-1.5
http://search.cpan.org/~cjones/LIMS-Controller-1.5/
Perl object layer controlling the LIMS database and its web interface 
----
Microarray-0.33
http://search.cpan.org/~cjones/Microarray-0.33/
A Perl module for creating and manipulating microarray objects 
----
MooseX-InsideOut-0.002
http://search.cpan.org/~hdp/MooseX-InsideOut-0.002/
inside-out objects with Moose 
----
Proc-Exists-0.08
http://search.cpan.org/~brianski/Proc-Exists-0.08/
quickly check for process existence 
----
Rose-DB-Object-0.7662
http://search.cpan.org/~jsiracusa/Rose-DB-Object-0.7662/
Extensible, high performance RDBMS-OO mapper. 
----
Rose-HTML-Objects-0.5521
http://search.cpan.org/~jsiracusa/Rose-HTML-Objects-0.5521/
Object-oriented interfaces for HTML. 
----
Safe-2.14
http://search.cpan.org/~rgarcia/Safe-2.14/
Compile and execute code in restricted compartments 
----
Sphinx-Search-0.10
http://search.cpan.org/~jjschutz/Sphinx-Search-0.10/
Sphinx search engine API Perl client 
----
Tk-GridColumns-0.05
http://search.cpan.org/~matthiasw/Tk-GridColumns-0.05/
Columns widget for Tk 
----
WWW-HatenaLogin-0.03
http://search.cpan.org/~yappo/WWW-HatenaLogin-0.03/
login/logout interface to Hatena 
----
Win32-GUITaskAutomate-0.02
http://search.cpan.org/~zoffix/Win32-GUITaskAutomate-0.02/
A module for automating GUI tasks. 
----
Win32-IdentifyFile-1.00
http://search.cpan.org/~clive/Win32-IdentifyFile-1.00/
Perl extension for to obtain an identity for an NTFS file 
----
Win32-IdentifyFile-1.01
http://search.cpan.org/~clive/Win32-IdentifyFile-1.01/
Perl extension for to obtain an identity for an NTFS file 
----
Win32-MSI-HighLevel-1.0001
http://search.cpan.org/~grandpa/Win32-MSI-HighLevel-1.0001/
Perl wrapper for Windows Installer API 
----
XML-Comma-1.995
http://search.cpan.org/~brianski/XML-Comma-1.995/
A framework for structured document manipulation 
----
XML-XSLT-0.50_1
http://search.cpan.org/~jstowe/XML-XSLT-0.50_1/
A perl module for processing XSLT 
----
pfacter-1.9
http://search.cpan.org/~sschneid/pfacter-1.9/
Collect and display facts about the system 
----
pfacter-1.9-1
http://search.cpan.org/~sschneid/pfacter-1.9-1/
Collect and display facts about the system 
----
pfacter-1.9-2
http://search.cpan.org/~sschneid/pfacter-1.9-2/
Collect and display facts about the system 


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, 30 Jan 2008 21:16:27 -0800 (PST)
From: arup <swarupapradhan@gmail.com>
Subject: perl problem
Message-Id: <d1101f3b-5202-47c0-b4b8-3027b529c830@e10g2000prf.googlegroups.com>

hi, I have around 400 proteins and I have to retrieve all protein
pages using Perl script or .....I m new in Programmig ...Can anyone
help me how to solve it....


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

Date: Thu, 31 Jan 2008 05:38:48 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: perl problem
Message-Id: <1ln2q3tu59tq9cpmgu6sml86e97s28jm56@4ax.com>

arup <swarupapradhan@gmail.com> wrote:
>hi, I have around 400 proteins and I have to retrieve all protein
>pages using Perl script or .....I m new in Programmig ...Can anyone
>help me how to solve it....

I have a basic understanding about what a protein is. But I have absolutely
no idea what a protein page is and what you mean by retrieving it.

Maybe if you could explain how would you approach the problem without Perl
or in a different programming language then we might understand what you are
talking about.

jue


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

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


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