[25763] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8002 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 21 14:05:36 2005

Date: Thu, 21 Apr 2005 11:05: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           Thu, 21 Apr 2005     Volume: 10 Number: 8002

Today's topics:
        a perl version of flex? (Jay G. Scott)
    Re: a perl version of flex? <spamtrap@dot-app.org>
    Re: Cgi.pm and CSS [OT] <glex_nospam@qwest.invalid>
    Re: Cgi.pm and CSS [OT] <hackeras@gmail.com>
    Re: Cgi.pm and CSS [OT] <flavell@ph.gla.ac.uk>
    Re: Delete characters <jl_post@hotmail.com>
    Re: Delete characters (Anno Siegel)
        fields.pm and restricted-hashes: Why wait for perl 5.9. olafinsbraaten@hotmail.com
    Re: File::Spec(::Unix) eludes me. <glex_nospam@qwest.invalid>
        Grab characters up to a certain character <alex@fortworks.com>
    Re: Grab characters up to a certain character <xx087@freenet.carleton.ca>
    Re: How to test if a string is already in a array <jurgenex@hotmail.com>
        RE: Matching mixed up words (Michael T. Davis)
    Re: Perl and vmstat <usaims@yahoo.com>
    Re: Perl and vmstat <tadmc@augustmail.com>
    Re: PerlMagick Cropping Help <kuujinbo@hotmail.com>
    Re: PerlMagick Cropping Help hoyoul@gmail.com
    Re: PerlMagick Cropping Help hoyoul@gmail.com
    Re: PerlMagick Cropping Help hoyoul@gmail.com
        Problem with setting LD_LIBRARY_PATH <moritz.karbach@desy.de>
    Re: Problem with setting LD_LIBRARY_PATH <skuo@mtwhitney.nsc.com>
    Re: Q on BEGIN and INIT <tadmc@augustmail.com>
        Regular Expressions - Python vs Perl <codecraig@gmail.com>
    Re: Regular Expressions - Python vs Perl <phaylon@dunkelheit.at>
    Re: Regular Expressions - Python vs Perl <codecraig@gmail.com>
    Re: Regular Expressions - Python vs Perl <phaylon@dunkelheit.at>
    Re: Using Bind Params in MySQL <glex_nospam@qwest.invalid>
    Re: Using Bind Params in MySQL xhoster@gmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 21 Apr 2005 18:12:27 +0000 (UTC)
From: gl@csdsun1.arlut.utexas.edu (Jay G. Scott)
Subject: a perl version of flex?
Message-Id: <d48qeb$7hv$1@ns3.arlut.utexas.edu>


let me be specific:

i want a perl lexical analyzer generator that writes perl
code to do lexical analysis, akin to what flex does.

i want to write many small lexical analyzers, and i want
to run them from perl.  i am NOT going to analyze perl code.
i have a bunch of data files, and i want to use a lexical
analyzer on them.

there seem to be a lot of lexical analyzers for perl itself,
which is not what i want.  i want a lexical analyzer generator
written in perl, which writes lexical analyzers in perl for
whatever silly "language" i dream up.  (my silly languages
will never be as elaborate as the perl language.)

is there one?

thanks in advance.

-- 
Jay Scott		512-835-3553		gl@arlut.utexas.edu
Head of Sun Support, Sr. Operating Systems Specialist
Applied Research Labs, Computer Science Div.                   S224
University of Texas at Austin


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

Date: Thu, 21 Apr 2005 13:52:47 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: a perl version of flex?
Message-Id: <3_adnYWtD57ydfrfRVn-hA@adelphia.com>

Jay G. Scott wrote:

> i want a perl lexical analyzer generator that writes perl
> code to do lexical analysis, akin to what flex does.

A quick search for "lex" at <http://search.cpan.org> turns up several 
candidates. Have you tried those?

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Thu, 21 Apr 2005 10:35:17 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Cgi.pm and CSS [OT]
Message-Id: <VKP9e.32$dv5.1344@news.uswest.net>

John W. Kennedy wrote:
> J. Gleixner wrote:
> 
>> When using CSS correctly, your final HTML will not contain any font or 
>> align elements or attributes, and if done really well, you won't have 
>> any table elements at all.
> 
> 
> Whoa! CSS can replace abusive use of <TABLE>, but there are still such 
> things in this world as tables.
> 

There are still such things in the world as <font> and <blink> too, it 
doesn't mean they should be used. :-)


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

Date: Thu, 21 Apr 2005 19:47:45 +0300
From: Nikos <hackeras@gmail.com>
Subject: Re: Cgi.pm and CSS [OT]
Message-Id: <d48lf9$pg6$1@nic.grnet.gr>

J. Gleixner wrote:
> John W. Kennedy wrote:

>> Whoa! CSS can replace abusive use of <TABLE>, but there are still such 
>> things in this world as tables.
>>
> 
> There are still such things in the world as <font> and <blink> too, it 
> doesn't mean they should be used. :-)

By what have they been replaced? In my script i have an extensive use of 
<table> and <font> and i want o get rid of them :-)


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

Date: Thu, 21 Apr 2005 18:43:15 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Cgi.pm and CSS [OT]
Message-Id: <Pine.LNX.4.62.0504211840580.21216@ppepc56.ph.gla.ac.uk>

On Thu, 21 Apr 2005, J. Gleixner wrote:

> John W. Kennedy wrote:
> > J. Gleixner wrote:
> > 
> > > When using CSS correctly, your final HTML will not contain any font or
> > > align elements or attributes, and if done really well, you won't have any
> > > table elements at all.
> > 
> > Whoa! CSS can replace abusive use of <TABLE>, but there are still 
> > such things in this world as tables.
> 
> There are still such things in the world as <font> and <blink> too, 
> it doesn't mean they should be used. :-)

The trouble with off-topic answers is that they're so often 
fundamentally misleading.  Anyone who happens by this thread should be 
advised that it could be injurious to their WWW health, and to please
seek answers in a more-appropriate place.


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

Date: 21 Apr 2005 07:02:48 -0700
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: Delete characters
Message-Id: <1114092168.921907.267620@f14g2000cwb.googlegroups.com>

Anno Siegel wrote:
>
> It is more effort to read a file in a scalar
> variable than to read the lines into an array.
> Since the problem is line-oriented, that
> would be a better solution:
>
>     my @text = <FILE>;
>     print @text[ -500 .. -1];


   I thought about that solution, but I decided not to mention it
because it would generate warnings if the number of lines were less
than 500 (of course, "use warnings;" would have to be turned on as
well).

   Giving this more though, I find that this problem is easily
prevented with the following line:

      @text = @text[-500 .. -1]  if @text > 500;

This line uses the same "if" logic as my solution, while maintaining
the better efficiency of yours.

   -- Jean-Luc



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

Date: 21 Apr 2005 15:12:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Delete characters
Message-Id: <d48fs9$5hf$1@mamenchi.zrz.TU-Berlin.DE>

jl_post@hotmail.com <jl_post@hotmail.com> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> >
> > It is more effort to read a file in a scalar
> > variable than to read the lines into an array.
> > Since the problem is line-oriented, that
> > would be a better solution:
> >
> >     my @text = <FILE>;
> >     print @text[ -500 .. -1];
> 
> 
>    I thought about that solution, but I decided not to mention it
> because it would generate warnings if the number of lines were less
> than 500 (of course, "use warnings;" would have to be turned on as
> well).
> 
>    Giving this more though, I find that this problem is easily
> prevented with the following line:
> 
>       @text = @text[-500 .. -1]  if @text > 500;
> 
> This line uses the same "if" logic as my solution, while maintaining
> the better efficiency of yours.

That's correct, though I was aiming for clarity more than efficiency.
Your solution keeps @text intact if there are fewer than 500 elements.
That is the behavior one usually wants in that case.

Anno


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

Date: 21 Apr 2005 06:53:06 -0700
From: olafinsbraaten@hotmail.com
Subject: fields.pm and restricted-hashes: Why wait for perl 5.9.0?
Message-Id: <1114091586.841176.130280@f14g2000cwb.googlegroups.com>

Hi,

I have some modules that use fields.pm (INST_VERSION 2.03) on perl
5.8.0, linux 2.4, i386.

I get repeated warnings that "Pseudo-hashes are deprecated", which is
fine, I asked for it ("use warnings").  I also know the the warnings
can be disabled by 'no warnings "deprecated"'.

perldoc fields says:

perl before 5.9.0: fields::new() creates and blesses a pseudohash [..]
perl 5.9.0 and higher: fields::new() creates and blesses a
restricted-hash [..]

Is there a good reason why fields.pm does not use restricted-hash in
perl 5.8?  Why wait for perl 5.9.0?  Are there incompatible changes
between the two?

What's the risk of using restricted-hashes in perl 5.8.0?

/usr/lib/perl5/5.8.0/fields.pm
113c113
< if ($] < 5.009) {
---
> if ($] < 5.008) {

--

(BTW: Links to perl590delta/perl591delta on
http://search.cpan.org/dist/perl/pod/perl.pod -> "Not found") 

--



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

Date: Thu, 21 Apr 2005 11:24:23 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: File::Spec(::Unix) eludes me.
Message-Id: <XsQ9e.36$dv5.1223@news.uswest.net>

Dale Wiles wrote:
> I'm trying to use the File::Spec module under Linux to make my code
[...]
> Isn't this just wrong?
> 
> I know how to write code that gives me the results I expect, but I find
> the existing results wildly non-intuitive.  Can anyone shed any info as to
> why "/a/b/../c" is preferable to "/a/c"?

Check the documentation for File::Spec:

"cannonpath()

Note that this does *not* collapse x/../y sections into y. This is by 
design. If /foo on your system is a symlink to /bar/baz, then 
/foo/../quux is actually /bar/quux, not /quux as a naive ../-removal 
would give you. If you want to do this kind of processing, you probably 
want Cwd's realpath() function to actually traverse the filesystem 
cleaning up paths like this."


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

Date: 21 Apr 2005 09:10:33 -0700
From: "imphasing" <alex@fortworks.com>
Subject: Grab characters up to a certain character
Message-Id: <1114099833.580562.150450@f14g2000cwb.googlegroups.com>

I'm writing a script, that parses a chat log into an html file, and
I've done a fairly good job so far, it works quite well. But I want to
make the nickname of a person bold. I have a string like so:

imphasing: Hi people.

and I want to replace all the characters up to the ": " with
"<b>imphasing: </b>"
I tried an index, but it didn't seem to return the character position
of ": "...I can't search and replace "imphasing: ", because other
people are going to be talking too.

Any ideas? if I could just get the "imphasing: " into a string, it
would be nice and easy...

Thanks,
Alex



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

Date: 21 Apr 2005 17:51:22 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Grab characters up to a certain character
Message-Id: <slrnd6fq0r.ff6.xx087@smeagol.ncf.ca>

At 2005-04-21 12:10PM, imphasing <alex@fortworks.com> wrote:
>  I have a string like so:
>  
>  imphasing: Hi people.
>  
>  and I want to replace all the characters up to the ": " with
>  "<b>imphasing: </b>"

Try:
    $string =~ s|^(.*?:)|<b>$1</b>|;


-- 
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca


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

Date: Thu, 21 Apr 2005 14:06:46 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: How to test if a string is already in a array
Message-Id: <WrO9e.39169$qO6.22473@trnddc05>

Marc Eggenberger wrote:
[...]
> substr to get an emailadress of the line. Now the textfile has some
> 10k lines and a lot of dublicate mail addresses. I only need each
> emailaddress once ..

See the very last sentence in "perldoc -q duplicate"

jue 




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

Date: 21 Apr 2005 16:56:48 GMT
From: DAVISM@ecr6.ohio-state.edu (Michael T. Davis)
Subject: RE: Matching mixed up words
Message-Id: <d48m0g$soa$1@charm.magnus.acs.ohio-state.edu>

	I really appreciate all the work you folks have put into answering
this for me.  I think I'm close to implementing something, but as you may
have guessed, it's time for me to complicate things, again. (;-)

	The whole system I'm developing works like this...  I have some string
obtained from an environment variable.  I also have a list of potential
pattern matches in a text file.  My code reads the file and attempts to match
each pattern against the env. string until it hits the end-of-file or a match
occurs.  Each line from the data file is the argument to a case-insensitive
regex match (i.e. "m//i", or -- for the pattern "<pattern>" read from the
file -- "m/(<pattern>)/i"), so the code looks something like this:

[...]
# $string is value obtained from environment
              while ( $pattern = <> ) {
                  $pattern = '(' . $pattern . ')';
                  last if ( $match ) = $string =~ /$pattern/i;
[...]         }

Since $pattern is basically just what's being read in from the data file, I'm
looking for a way to handle anagram matching within it.  Here's something
along these lines (though it's not correct):

          \sg((?i)[a-z]+?)s?\W(?{anagram($+,'host','houl','remlin')})

(The Perl code might include "use re 'eval'" [I know...nasty], and will include
"sub anagram {...}".)  I'm having trouble understanding how I might trigger a
match for the whole regex iff (if and only if) the result returned by anagram()
indicates a match.  (If there's a way to avoid "use re 'eval'", that would be
helpful, too.)

Thanks,
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: 21 Apr 2005 06:46:32 -0700
From: "usaims" <usaims@yahoo.com>
Subject: Re: Perl and vmstat
Message-Id: <1114091192.967931.204150@f14g2000cwb.googlegroups.com>

Tad McClellan wrote:
> usaims <usaims@yahoo.com> wrote:
>
> > my @memusage = system("vmstat -n 1 | awk '{print \$14}'");
>
>
> Read up on the return value that you get from system().
>
> Why do you want to save that to an array?

No reason, why?. Is there a better way?

>
>
> > I have googled for "vmstat" in the perl group, but
> > didn't come up with anything.
>
>
> Of course not, since you would have the same problem if you
> were running a program that was not named "vmstat".
>
>
> > I have searched perldoc, didn't see
> > anything.
>
>
>    perldoc -f system

>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas



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

Date: Thu, 21 Apr 2005 09:02:05 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl and vmstat
Message-Id: <slrnd6fcit.95q.tadmc@magna.augustmail.com>

usaims <usaims@yahoo.com> wrote:
> Tad McClellan wrote:
>> usaims <usaims@yahoo.com> wrote:
>>
>> > my @memusage = system("vmstat -n 1 | awk '{print \$14}'");
>>
>>
>> Read up on the return value that you get from system().
>>
>> Why do you want to save that to an array?
> 
> No reason, 


Then why are you doing it?

There must be *some* reason why you thought that that was useful...


> why?. 


If you had read up on the return value from system() you could
answer that yourself.


> Is there a better way?


Yes.


>> --
>>     Tad McClellan                          SGML consulting
>>     tadmc@augustmail.com                   Perl programming
>>     Fort Worth, Texas


Please do not quote .sigs, it is poor netiquette.

Have you seen the Posting Guidelines that are posted here frequently?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 21 Apr 2005 07:10:30 -0700
From: "ko" <kuujinbo@hotmail.com>
Subject: Re: PerlMagick Cropping Help
Message-Id: <1114092630.367591.76000@g14g2000cwa.googlegroups.com>

hoy...@gmail.com wrote:
> Hi,
>
> I am using ImageMagick 6.2.0.7-2 and PerlMagick to create thumbnails
> from images. Basically I am reading in an image with ImageMagick,
> resizing it so either the width or the height is 100 pixels
(depending
> on which is smaller) and then cropping it to 100 by 100 pixels. So
for
> instance, I have an image that is 325 by 500 pixels. After the
process
> above, instead of ending up with a thumbnail that's 100 by 100 pixels
> (centered), I get an image that's 100 by 154 (basically resized from
> 325 by 500) and the top and bottom of the image is white while the
> middle 100 by 100 is the image. So instead of cropping the image,
it's
> just turning the cropped areas into a white background. Any clues as
to
> why? Here is the code:
>
> sub createThumbnail {
>   my $this = shift;
>
>   if (!$this->{'image'} || !$this->{'size'}) { return; }
>
>   my $image = Image::Magick->new;
>   #$image->Read(blob => $this->{'image'});
>   $image->BlobToImage($this->{'image'});
>
>   my ($width, $height) = $image->Get('width', 'height');
>   my $offsetx = 0;
>   my $offsety = 0;
>
>   # Resize image before attempting to crop the image
>   if ($width <= $height) {
>     my $h = $this->round(($height / $width) *
$this->{'_thumb_width'});
>     $offsety = $this->round(($h - $this->{'_thumb_height'}) / 2);
>     $image->Resize(width => $this->{'_thumb_width'}, height => $h);
>   }
>   else {
>     my $w = $this->round(($width / $height) *
> $this->{'_thumb_height'});
>     $offsetx = $this->round(($w - $this->{'_thumb_width'}) / 2);
>     #$image->Resize(width => $w, height => $this->{'_thumb_height'});
>     $image->Resize(geometry => $w.'x'.$this->{'_thumb_height'});
>   }
>
>   # Croping image with a re-adjusted offset
>  $image->Crop(
>    width => $this->{'_thumb_width'},
>    height => $this->{'_thumb_height'},
>    x => $offsetx, y => $offsety);
>
> print "Content-type: image/gif\n\n";
> print $image->ImageToBlob;
> exit;
> }
>
> I tried $image->Chop but that function doesn't seem to work at all
with
> my version. Any help would greatly be appreciated!
>
> Thanks
> Hoyoul

Try passing 100 to Crop() for width and height instead of the
'_thumb_width' and '_thumb_height' attributes.

Or you could set another attribute like 'crop_size' => '100x100' for
the desired size and do:

$image->Crop(geometry => $this->{crop_size},
  x => $offsetx, y => $offsety);

HTH - keith



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

Date: 21 Apr 2005 09:43:18 -0700
From: hoyoul@gmail.com
Subject: Re: PerlMagick Cropping Help
Message-Id: <1114101798.524096.44010@f14g2000cwb.googlegroups.com>

Hi Keith,

I tried with actual numbers as such:

$image->Crop(geometry => '100x100', x => 0, y => 27);

and:

$image->Crop(geometry => '100x100+0+27');

Still no luck. Same results, with the image remaining 100x154 and the
top and bottom with a white margin or 27 pixels wide.

-Hoyoul



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

Date: 21 Apr 2005 09:50:05 -0700
From: hoyoul@gmail.com
Subject: Re: PerlMagick Cropping Help
Message-Id: <1114102205.458382.51480@l41g2000cwc.googlegroups.com>

I discovered another thing, this only occurs with GIF file formats,
PNG, JPG/JPEG are cropped correctly. Is there something I need to set
for GIF format files to behave correctly? I tried a variety of GIF
files and no luck.



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

Date: 21 Apr 2005 10:13:56 -0700
From: hoyoul@gmail.com
Subject: Re: PerlMagick Cropping Help
Message-Id: <1114103636.080890.170440@l41g2000cwc.googlegroups.com>

Well if anybody runs into this problem, my solution was to basically
convert the image into something other than GIF and then crop it. If
you absolutely want it GIF, you can convert it back afterwards.

$image->Set(magick => 'JPG');
$image->Crop(geometry => 'some geometry');
$image->Set(magick => 'GIF');

Might be a bug on how Cropping behaves for GIF formats...

Regards,
Hoyoul



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

Date: Thu, 21 Apr 2005 17:04:35 +0200
From: Moritz Karbach <moritz.karbach@desy.de>
Subject: Problem with setting LD_LIBRARY_PATH
Message-Id: <d48fe4$2f1rc$1@claire.desy.de>

Hi experts,

I'd like to run a program out of a perl script. The program needs a special
library path, which I'd very much like to set inside the perl script. Here
is what I tried:

--- perl script ---

#!/usr/bin/perl -w
$ENV{'LD_LIBRARY_PATH'} .= ":" . `pwd`;
exec 'ldd', 'fplist';


--- output ---
 ...
        libreadline.so.4 => /lib/libreadline.so.4 (0x40a9a000)
 ...


That is, the fplist program still uses the system library instead of using
the one in the working directory. It works, if I do it completely on the
shell:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
$ ldd fplist
 ...
        libreadline.so.4 =>
/afs/desy.de/user/m/mkarbach/h1/grid/h1mcjobwrapper/libreadline.so.4
(0x40a9a000)
 ...


Can anybody tell me, what the problem is?

Thanks,

- Moritz


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

Date: Thu, 21 Apr 2005 09:20:52 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: Problem with setting LD_LIBRARY_PATH
Message-Id: <Pine.GSO.4.21.0504210916280.4344-100000@mtwhitney.nsc.com>

On Thu, 21 Apr 2005, Moritz Karbach wrote:

> Hi experts,
> 
> I'd like to run a program out of a perl script. The program needs a special
> library path, which I'd very much like to set inside the perl script. Here
> is what I tried:
> 
> --- perl script ---
> 
> #!/usr/bin/perl -w
> $ENV{'LD_LIBRARY_PATH'} .= ":" . `pwd`;



Forgot that the output from `pwd` includes newline at the end?



> exec 'ldd', 'fplist';
> 
> 
> --- output ---
> ...
>         libreadline.so.4 => /lib/libreadline.so.4 (0x40a9a000)
> ...
> 
> 
> That is, the fplist program still uses the system library instead of using
> the one in the working directory. It works, if I do it completely on the
> shell:
> 
> $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
> $ ldd fplist
> ...
>         libreadline.so.4 =>
> /afs/desy.de/user/m/mkarbach/h1/grid/h1mcjobwrapper/libreadline.so.4
> (0x40a9a000)
> ...
> 
> 
> Can anybody tell me, what the problem is?


See perldoc -f chomp
and perldoc -f qx


-- 
Hope this helps,
Steven



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

Date: Thu, 21 Apr 2005 09:03:14 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Q on BEGIN and INIT
Message-Id: <slrnd6fcl2.95q.tadmc@magna.augustmail.com>

J Krugman <jkrugman345@yahbitoo.com> wrote:
> 
> 
> Thanks!  Much appreciated.


What is appreciated?

Please quote some context in followups like everyone else does.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 21 Apr 2005 07:13:47 -0700
From: "Java and Swing" <codecraig@gmail.com>
Subject: Regular Expressions - Python vs Perl
Message-Id: <1114092827.150920.312680@z14g2000cwz.googlegroups.com>

Hi,
  I am interested in regular expressions and how Perl and Python
compare.  Particulary, I am interested in performance (i.e. speed),
memory usage, flexibility, completeness (i.e. supports simple and
complex regex operations...basically is RegEx a strong module/library
in Perl?)

  Anyone have any information on this?  Any numbers, benchmarks?

Thanks so much.  I know this is a perl user group...but try to be has
un-biased as you can.



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

Date: Thu, 21 Apr 2005 16:27:30 +0200
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Regular Expressions - Python vs Perl
Message-Id: <pan.2005.04.21.14.27.30.871781@dunkelheit.at>

Java and Swing wrote:

> Anyone have any information on this?  Any numbers, benchmarks?

If you want to try for yourself:
  <http://perldoc.perl.org/search.html?q=perlre>

hth,p

-- 
http://www.dunkelheit.at/
I want, therefore I can.



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

Date: 21 Apr 2005 07:45:36 -0700
From: "Java and Swing" <codecraig@gmail.com>
Subject: Re: Regular Expressions - Python vs Perl
Message-Id: <1114094736.082901.32030@g14g2000cwa.googlegroups.com>

i am not looking to do the coding, I was hoping for answers from
already performed benchmarks and or knowledge from developers who
"know".

If i have time I'll try and pick up perl, one day :)



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

Date: Thu, 21 Apr 2005 18:08:51 +0200
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: Regular Expressions - Python vs Perl
Message-Id: <pan.2005.04.21.16.08.51.970276@dunkelheit.at>

Java and Swing wrote:

> If i have time I'll try and pick up perl, one day :)

You were also interested in: 
| [..] memory usage, flexibility, completeness (i.e. supports simple and
| complex regex operations...basically is RegEx a strong module/library
| in Perl?)

Also, Perl is perfect (in my eyes) for prototyping and testing of
prototyped algorithms. Take a look at 'Benchmark' on search.cpan.org to
get an idea. If you just want lists, benchmarks and done work, I'm sorry
that I can't offer that.

-- 
http://www.dunkelheit.at/
That is not dead, which can eternal lie,
and with strange aeons even death may die.
		-- H.P. Lovecraft



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

Date: Thu, 21 Apr 2005 10:28:38 -0500
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Using Bind Params in MySQL
Message-Id: <FEP9e.772$o_6.584@news.uswest.net>

mike wrote:
> I am using MySQL and this was working, but all of sudden it is not. I
> suspect that I have some kind of error, but my error logic must not be
> working.
> 
> 
> I am getting "Insert - Complete", but no data is getting inserted to
> the table.

Check your logs.

You don't show your connect() call, do you need to 'AutoCommit' or to 
call commit()?

> $sth = $dbh->prepare( $sql );

>  eval { $sth->execute; };
>  if ( $@ )
>   {
>      print "Error in the database: $@";
>   }
>   else
>   {
>   # execute worked was success
>   print "<center><b>Insert - Complete</b></center>\n";
>   } 
>  } 

I'm not sure if die is called or $@ is set on an execute error. It's 
more typical/appropriate to set the RaiseError attribute or use the 
errstr method.

$sth = $dbh->prepare( $sql ) or die $dbh->errstr();
$sth->execute or die $dbh->errstr();


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

Date: 21 Apr 2005 16:57:16 GMT
From: xhoster@gmail.com
Subject: Re: Using Bind Params in MySQL
Message-Id: <20050421125716.932$Fg@newsreader.com>

"mike" <hillmw@charter.net> wrote:

>
> $sth = $dbh->prepare( $sql );
>
> if ( !defined $sth )

This suggests that you are not using RaiseError.


>  eval { $sth->execute; };
>  if ( $@ )

This suggests that you are using RaiseError.  If in fact you are not
using RaiseError, then this won't do what you want.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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


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