[25730] in Perl-Users-Digest
Perl-Users Digest, Issue: 7970 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 13 06:05:34 2005
Date: Wed, 13 Apr 2005 03:05: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 Wed, 13 Apr 2005 Volume: 10 Number: 7970
Today's topics:
Re: [perl-python] Python documentation moronicities (co axel@white-eagle.invalid.uk
Alternative to MLDBM - MLDBM still state of the art? edw@gmx.at
Re: Creating o non-existing database <tadmc@augustmail.com>
Re: File::Find - following s'linked directories? <josef.moellers@fujitsu-siemens.com>
Is Perl open source? soup_or_power@yahoo.com
Re: Is Perl open source? <postmaster@castleamber.com>
Re: Is Perl open source? <tadmc@augustmail.com>
Re: Matching mixed up words <1usa@llenroc.ude.invalid>
RE: Matching mixed up words (Michael T. Davis)
Re: Matching mixed up words <tassilo.von.parseval@rwth-aachen.de>
Re: Matching mixed up words (Anno Siegel)
Re: Matching mixed up words (Anno Siegel)
Openings in an online game company for programmers step_y@yahoo.com
Re: Perl on Rails? <bigiain@mightymedia.com.au>
perlapp question (justme)
PerlNomic perlnomic@gmail.com
Problem with inline -java <urgearun@gmail.com>
Re: s/(.)/($1)/g vs s/(.)/$to/eg where $to='($1)' jilerner@yahoo.com
Re: s/(.)/($1)/g vs s/(.)/$to/eg where $to='($1)' <tadmc@augustmail.com>
Re: Web Interface and index.pl separated?!? <tadmc@augustmail.com>
Re: Web Interface and index.pl separated?!? axel@white-eagle.invalid.uk
Re: Web Interface and index.pl separated?!? axel@white-eagle.invalid.uk
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 12 Apr 2005 18:31:08 -0500
From: axel@white-eagle.invalid.uk
Subject: Re: [perl-python] Python documentation moronicities (continued)
Message-Id: <q5ednRaNl_yhx8HfRVn-3A@adelphia.com>
In comp.lang.perl.misc Xah Lee <xah@xahlee.org> wrote:
> The answer to the questions are resounding yeses, you fucking asses.
> paypal me a hundred dollars and i'll rewrite the whole re doc in a few
> hours.
> Fuck you the standard IT morons. Excuse me for i didn't have time to
> write a more coherent and detailed analysis of the stupidities of the
> re doc.
Don't worry! Very soon, some nice men in white coats will show you
a comfortable room with soft walls in which you can write such
documentation to your hearts content.
Axel
------------------------------
Date: 12 Apr 2005 22:43:13 GMT
From: edw@gmx.at
Subject: Alternative to MLDBM - MLDBM still state of the art?
Message-Id: <Xns963785878A92edwgmxatlooksgreat@67.98.68.27>
Hi group,
is there an alternative to MLDBM module for storing hashes of { hashes,
arrays, scalars } doing the task in a - maybe - faster, better way?
Is MLDBM still state of the art for perl?
Thanx
edw.
------------------------------
Date: Tue, 12 Apr 2005 20:25:21 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Creating o non-existing database
Message-Id: <slrnd5ot81.2ma.tadmc@magna.augustmail.com>
Nikos <hackeras@gmail.com> wrote:
> This is soem per of my make.pl
Huh?
Is that supposed to be an English sentence?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 13 Apr 2005 08:44:17 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: File::Find - following s'linked directories?
Message-Id: <d3ifbf$5qj$1@nntp.fujitsu-siemens.com>
Peter Ensch wrote:
> It's been a while since I used File::Find and I was under the impressio=
n=20
> that it now supported traversal of symbolically linked directories; the=
> POD indicates that this is the case in the following warning:
>=20
> "Be aware that the option to follow symbolic links can be dangerous.
> Depending on the structure of the directory tree (including symbolic li=
nks
> to directories) you..."
>=20
> I cannot seem to make F::F follow links to directories however. Using=20
> find2perl to generate an example script from this find command:
>=20
> find2perl /an/example/dir/tree -follow -print
>=20
> I get this (comments, shebang Etc. removed):
>=20
> ###########
> use File::Find ();
>=20
> use vars qw/*name *dir *prune/;
> *name =3D *File::Find::name;
> *dir =3D *File::Find::dir;
> *prune =3D *File::Find::prune;
>=20
> sub wanted;
>=20
> File::Find::find( {wanted =3D> \&wanted, follow =3D> 1},
> '/an/example/dir/tree');
> exit;
>=20
> sub wanted {
> print("$name\n");
> }
> ###########
>=20
> Why doesn't this follow symbolically linked directories like the=20
> unix find command used to create it does?
Must be something else, caus on my box it does (follows if follow =3D> 1,=
=20
does not follow if follow =3D> 0).
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
------------------------------
Date: 12 Apr 2005 19:06:23 -0700
From: soup_or_power@yahoo.com
Subject: Is Perl open source?
Message-Id: <1113355491.285810.321470@f14g2000cwb.googlegroups.com>
If much of perl is implemented in C, why should we prefer Perl over C
for performance critical projects?
Please don't get me wrong. I prefer Perl over C if performance is not
the issue.
Thank you.
------------------------------
Date: 13 Apr 2005 02:17:25 GMT
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Is Perl open source?
Message-Id: <Xns9636D87FBE795castleamber@130.133.1.4>
wrote:
Don't use subjects that are have no relation to the body of your message.
> If much of perl is implemented in C, why should we prefer Perl over C
> for performance critical projects?
Who says "we" do?
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: Tue, 12 Apr 2005 22:51:15 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Is Perl open source?
Message-Id: <slrnd5p5pj.2vg.tadmc@magna.augustmail.com>
soup_or_power@yahoo.com <soup_or_power@yahoo.com> wrote:
> Subject: Is Perl open source?
Please put the subject of your article in the Subject of your article.
Your article has nothing to do with open source.
> If much of perl is implemented in C, why should we prefer Perl over C
> for performance critical projects?
We shouldn't.
I would think that would be obvious.
Did someone say otherwise?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Apr 2005 23:27:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Matching mixed up words
Message-Id: <Xns9636C5E6759C0asu1cornelledu@127.0.0.1>
"Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de> wrote in
news:slrnd5ohfe.178.tassilo.von.parseval@localhost.localdomain:
> sub check_sort {
> my ($orig, $target) = @_;
> my $o = join '', sort split //, $orig;
> my $t = join '', sort split //, $target;
> return $o eq $t;
> }
...
> Also, check_sort() is more correct as it wont falsely report 'sinan'
> and 'nasina' as matching, which check() does. ;-)
And to think that I actually look at the output, and somehow did not
notice my error. Thank you for catching that.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 13 Apr 2005 01:41:13 GMT
From: DAVISM@ecr6.ohio-state.edu (Michael T. Davis)
Subject: RE: Matching mixed up words
Message-Id: <d3htbp$iik$1@charm.magnus.acs.ohio-state.edu>
Just to be clear, I'm looking for a regex-based mechanism that will
work within the confines of "m/.../". I would imagine it's going to need to
rely on the "(${code})" construct.
BTW, my signature includes a trailing space at the end of the first
line, but the gateway I'm using apparently strips it off. I have alerted
them to the mistake.
Regards,
Mike
--
| Systems Specialist: CBE,MSE
Michael T. Davis | Departmental Networking/Computing
http://www.ecr6.ohio-state.edu/~davism/ | The Ohio State University
| 197 Watts, (614) 292-6928
------------------------------
Date: Wed, 13 Apr 2005 07:42:52 +0200
From: "Tassilo v. Parseval" <tassilo.von.parseval@rwth-aachen.de>
Subject: Re: Matching mixed up words
Message-Id: <slrnd5pcas.pf.tassilo.von.parseval@localhost.localdomain>
Also sprach Michael T. Davis:
> Just to be clear, I'm looking for a regex-based mechanism that will
> work within the confines of "m/.../". I would imagine it's going to need to
> rely on the "(${code})" construct.
Most likely even (??{CODE}). However, any of my attempts so far ended up
in a segmentation fault or 'panic: '. I knew that some of these extended
patterns are flagged as experimental but I didn't expect them to be that
fragile. It's tricky enough coming up with a pure regex solution but
here you'll also need to find one that wont crash perl. So I wouldn't
bother.
Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
------------------------------
Date: 13 Apr 2005 09:43:35 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Matching mixed up words
Message-Id: <d3ipk7$c9n$1@mamenchi.zrz.TU-Berlin.DE>
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> DAVISM@ecr6.ohio-state.edu (Michael T. Davis) wrote in
> news:d3h7bu$hbt$1@charm.magnus.acs.ohio-state.edu:
[how to test for anagrams]
> use strict;
> use warnings;
>
> use Data::Dumper;
>
> sub check {
> my ($orig, $target) = @_;
>
> my %c;
>
> use integer;
> my @l = split //, $orig;
> ++$c{$_} for @l;
>
> @l = split //, $target;
> for (@l) {
> if(exists($c{$_}) and $c{$_}) {
> --$c{$_};
> }
> }
>
> @l = grep { $_ > 0 } values %c;
> scalar @l ? 0 : 1;
> }
>
> my %check = (
> sinan => [ 'nasin', 'nasina', 'lasin' ],
> gremlin => [ 'mergnil', 'mgrelanl', 'gremlin' ],
> );
>
> for my $k (keys %check) {
> for my $t (@{ $check{$k} }) {
> print "$k matches $t?: ";
> if(check($k, $t)) {
> print "Yes\n";
> } else {
> print "No\n";
> }
> }
> }
>
>
> __END__
>
>
> I am sure someone will show a regex solution that I have overlooked.
A regex solution seems unlikely. It would require jumping back and
forth in a string while keeping track of what was matched where.
Regexes aren't very good at that.
Using a hash for counting is just fine. It is basically a well known
data structure that implements what has been called "bags". Bags are
like sets, but each element (a hash key) can be contained multiple times
(the hash value). Containment and equality of bags are defined in the
obvious way. Then, to check if two strings are anagrams, create the
corresponding bags and test for equality. Code:
my %check = (
sinan => [ 'nasin', 'nasina', 'lasin' ],
gremlin => [ 'mergnil', 'mgrelanl', 'gremlin' ],
);
for my $k (keys %check) {
my $bk = Bag->embag( $k);
for my $t (@{ $check{$k} }) {
print "$k matches $t?: ";
print $bk eq Bag->embag( $t) ? "Yes\n" : "No\n";
}
}
#########################################################################
package Bag;
sub embag { # create a bag of letters from a string
my $class = shift;
my %bag;
$bag{ $_} ++ for split //, shift;
bless \ %bag, $class;
}
sub contained {
my ( $b1, $b2) = @_;
$b2->{ $_} and $b1->{ $_} > $b2->{ $_} and return 0 for keys %$b1;
1;
}
use overload(
le => 'contained',
eq => sub { $_[ 0] le $_[ 1] and $_[ 1] le $_[ 0] },
);
__END__
Anno
------------------------------
Date: 13 Apr 2005 09:58:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Matching mixed up words
Message-Id: <d3iqfd$c9n$2@mamenchi.zrz.TU-Berlin.DE>
Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote in comp.lang.perl.misc:
> Also sprach A. Sinan Unur:
>
> > DAVISM@ecr6.ohio-state.edu (Michael T. Davis) wrote in
> > news:d3h7bu$hbt$1@charm.magnus.acs.ohio-state.edu:
[anagram detection by counting letters]
> A faster solution appears to involve sort(): split both strings, sort
> them and compare for equality. According to a benchmark:
[benchmark snipped]
Interesting, since counting is linear and sorting is n*log n. Presumably,
with huge words, counting would win in the end, but there probably
never was a language (not even German) with words long enough to bring
out the difference.
Anno
------------------------------
Date: 13 Apr 2005 00:32:16 -0700
From: step_y@yahoo.com
Subject: Openings in an online game company for programmers
Message-Id: <1113377536.093518.43970@o13g2000cwo.googlegroups.com>
Those who is interested in computers, games can check out a free
massive online strategy scifi game at http://www.spacefederation.net
This game is also looking for staff, especially those in the computer
line like programming, development, it and Internet security. to apply,
goto the game and click on jobs, or click on contact to send them an
email to apply. they are always on the lookout for talented and
passionate people, if there is no such post available they will make
one for you.
Cowly the Game player
Visit some of the games I play
http://www.gamestotal.com
http://mmorpg.gamestotal.com
http://www.gamestotal.com/news/
http://free_mmorpg.gamestotal.com
http://strategy_games.gamestotal.com
http://www.gamestotal.com/strategygames/
http://free_strategy_games.gamestotal.com
------------------------------
Date: Wed, 13 Apr 2005 15:07:14 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: Perl on Rails?
Message-Id: <bigiain-8137CA.15071413042005@individual.net>
In article <42565f7d_2@x-privat.org>,
Gregory Toomey <nospam@bigpond.com> wrote:
> I've been playing around with Ruby of Rails for a day so I wonder if
> somebody has been working on a Perl equivalent.
>
> It consists of
> - an application generator, which generates for web front end to a
> relational database.
> Basic add/insert/delete web forms are generated by default, and you can add
> your own logic as classes.
> - automatic object-relations mapping. Database tables are seen as objects
> inside the framework.
> - automated data modelling eg you can specify 1:many relationships & the
> code is automaticly generated
You might want to look at Simon Cozens' "Maypole"
(though I don't seem to be able to get to
http://maypole.simon-cozens.org/ right now)
(full disclosure, I've read about it and downloaded it, but haven't
actually made the time to play with it yet...)
big
--
On my tombstone they will carve, "IT NEVER GOT FAST
ENOUGH FOR ME."' - Hunter S Thompson, 1937-2005 RIP
------------------------------
Date: 12 Apr 2005 18:19:56 -0700
From: eight02645999@yahoo.com (justme)
Subject: perlapp question
Message-Id: <c0837966.0504121719.7e6dc633@posting.google.com>
hi
i am developing on Windows using activestate Perl.
i have perlapp to convert my script to exe..
i also have other command line tools (.exe) that is called from my
script. (eg pslist.exe )
the question is , how can i "compile" my script using perlapp such
that "pslist.exe" is "combined" into the final output file of perlapp
and it becomes one big .exe file? (so that i don't have to carry
pslist.exe around when i install my exe file to computers )
can perlapp support that.?
thanks..
------------------------------
Date: 12 Apr 2005 19:09:12 -0700
From: perlnomic@gmail.com
Subject: PerlNomic
Message-Id: <1113358152.273215.229350@f14g2000cwb.googlegroups.com>
Hi,
I've hacked together a set of CGI scripts which allow you to edit the
scripts themselves, in the style of Peter Suber's game "Nomic". It's a
reasonably fun thing to bend your brain around:
http://perlnomic.org/
------------------------------
Date: 12 Apr 2005 18:39:35 -0700
From: "arun" <urgearun@gmail.com>
Subject: Problem with inline -java
Message-Id: <1113356375.747492.98280@g14g2000cwa.googlegroups.com>
Hi,
I have installed inline-java perl module to communicate with java from
my CGI-PERL everthing was working fine . Suddenly one day the code
failed giving an error "Couldnot connect next available port number
using port 7890 jinstead. JVM taking more than 30 seconds to start or
died before perl could connect". Need some assistance to solve this
problem.
With Regards
Arun
------------------------------
Date: 12 Apr 2005 16:04:24 -0700
From: jilerner@yahoo.com
Subject: Re: s/(.)/($1)/g vs s/(.)/$to/eg where $to='($1)'
Message-Id: <1113345595.844325.110870@l41g2000cwc.googlegroups.com>
> http://birmingham.pm.org/talks/faq/Hello.html
Thanks a lot for the link and the answers therein.
Can you explain what are shortcomings
of the following solution that you mention ?:
my $search = 'foo(.*?)bar';
my $replace = 'wibble$1wobble';
s/$search/qq!"$replace"!/eeg;
die $@ if $@;
Thanks
Yakov
------------------------------
Date: Tue, 12 Apr 2005 20:33:53 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: s/(.)/($1)/g vs s/(.)/$to/eg where $to='($1)'
Message-Id: <slrnd5oto1.2ma.tadmc@magna.augustmail.com>
jilerner@yahoo.com <jilerner@yahoo.com> wrote:
>> http://birmingham.pm.org/talks/faq/Hello.html
>
> Thanks a lot for the link and the answers therein.
>
> Can you explain what are shortcomings
> of the following solution that you mention ?:
>
> my $search = 'foo(.*?)bar';
> my $replace = 'wibble$1wobble';
>
> s/$search/qq!"$replace"!/eeg;
> die $@ if $@;
* Using eval() on data that comes from outside your program will
seriously damage your security
* Do not use it unless the template comes from
o Within your program
o A file considered part of your program source from the
point of view of security
o A user who has shell access anyhow (not in SUID scripts)
* You have to be really sure the above will always be true
my $evil_data='Ha ha ha... @{[ system "rm -rf /" ]}';
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Apr 2005 20:28:29 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Web Interface and index.pl separated?!?
Message-Id: <slrnd5otdt.2ma.tadmc@magna.augustmail.com>
Nikos <hackeras@gmail.com> wrote:
> Inside my webpage index.pl
That is a mighty strange name for a webpage.
They usually have a .html or .htm filename extension...
> i ahve the Perl code
You cannot put Perl code into a webpage.
(well you can, but it will not be executed, so what would be the point?)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 12 Apr 2005 22:03:13 -0500
From: axel@white-eagle.invalid.uk
Subject: Re: Web Interface and index.pl separated?!?
Message-Id: <3fedneaWY-1sFsHfRVn-1A@adelphia.com>
Tad McClellan <tadmc@augustmail.com> wrote:
> Nikos <hackeras@gmail.com> wrote:
>> Inside my webpage index.pl
> That is a mighty strange name for a webpage.
Not really if it's a CGI script.
Axel
------------------------------
Date: Tue, 12 Apr 2005 22:17:58 -0500
From: axel@white-eagle.invalid.uk
Subject: Re: Web Interface and index.pl separated?!?
Message-Id: <WtidnRCQCsv7EsHfRVn-sQ@adelphia.com>
Nikos <hackeras@gmail.com> wrote:
> Inside my webpage index.pl i ahve the Perl code and the interface of the
> page: Do you think that i must separate the page's interface in a file
> by itself and then in another index.pl make calculations and stuff with it:
It is probably easiest to work with the both in the same file.
> i have i as follows to generate graphics. here is a asmall part:
> print start_form(-action=>"show.pl");
> print table( {-border=>1, -width=>"60%", -align=>"center",
> -style=>"border: ridge magenta; color: lime; font-family: Times;
> font-size: 18", -background=>"../data/images/swirl.jpg"},
> Tr( {-align=>'center'}, td( "??? ?? ???? ???????" ),
> td( textfield( 'onoma' ))),
> Tr( {-align=>'center'}, td( "???? ????? ? ????? ??? ??? ??? ???????
> \"????? ????? ?????? ??????? ??\"?"
> ), td( textarea( -name=>'sxolio', -rows=>5, -columns=>30 ))),
> Tr( {-align=>'center'}, td( "???????? ???? ??? ??? ???? ?? ????? ???
> ???????? ????????? ??? ??????????
> ????????
> ??? ??????? ??????? ???? ?????? ???
> ????????? ??????? (?? ?????? ?????
> :-)" ), td( textarea( -name=>'symvan', -rows=>7, -columns=>30 ))),
> Tr( {-align=>'center'}, td( "???? ????? ?? e-mail ????" ),
> td( textfield( 'email' ))),
> Tr( {-align=>'center'}, td( submit( '???????? ???? ??? ???????'
> )), td( submit( '????????' ))));
> print end_form(), br(), br();
>
> also inside index.pl a have javascript embedded in a here document.
>
> Is this wrong approach?
No... it is whatever you find most convenient.
> For example how could i rewrite the above script?
> The funny stuff is actually Greek! :-)
One way would be to do the calculations required and then print all the
HTML with any results inserted as a 'here' document (or several to keep
the relevant calculations close to the output templates).
But then I have never really seen much point in adding an extra layer of
complexity by using functions in creating HTML.
Axel
------------------------------
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 V10 Issue 7970
***************************************