[26174] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8363 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 27 06:05:31 2005

Date: Sat, 27 Aug 2005 03:05:04 -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           Sat, 27 Aug 2005     Volume: 10 Number: 8363

Today's topics:
    Re: Is there any performance benefit to... <Peter@PSDT.com>
    Re: Perl regular expressions help <tadmc@augustmail.com>
        Template-Toolkit-2.14 fails make on FC3 <usenet@NOSPAM.obantec.net>
    Re: Using Crypt::DSA <mikef@brillig.security.berkeley.edu>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 27 Aug 2005 05:03:41 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Is there any performance benefit to...
Message-Id: <pan.2005.08.27.05.03.25.957824@PSDT.com>

On Thu, 25 Aug 2005 14:24:52 +0100, Derek Fountain wrote:
> I've inherited a piece of code that does something like this:
> 
> sub func {
>    my %hash = ();
> 
>    ...lots of code that populates and uses the hash
> 
>    %hash = ();
> }
> 
> There are hundreds of these functions and they are called millions of 
> times in a procedure which takes hours, sometimes days, to complete. The 
> guy who wrote it was obviously concerned about performance.

Have you asked him?

I would have said it was pointless myself, and if anything likely to
increase running time, but having written before that even the best
programmers are lousy at guessing about performance optimizations, I
didn't guess:

[peter@tweety ~]$ cat /tmp/foo
#!/usr/bin/perl
use strict;
use warnings;

use Benchmark qw(cmpthese);

cmpthese(20,
         { clear    => sub { my %h = map {$_,$_} 1..1E5; %h = () },
           no_clear => sub { my %h = map {$_,$_} 1..1E5          }
         }
        );
[peter@tweety ~]$ /tmp/foo
         s/iter no_clear    clear
no_clear   2.29       --      -3%
clear      2.22       3%       --

Go figure.

[peter@tweety ~]$ perl -v
This is perl, v5.8.5 built for i386-linux-thread-multi

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/



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

Date: Fri, 26 Aug 2005 22:24:16 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl regular expressions help
Message-Id: <slrndgvn70.89m.tadmc@magna.augustmail.com>

Rumpa <sgrumpa@yahoo.com> wrote:


> I want to extract the titles only in a loop. How can I do this?


Use a module that understands XML for processing XML data.


---------------------------
#!/usr/bin/perl
use warnings;
use strict;
use XML::Simple;

my $store = q(
<store>
   <book>
     <title>abc</title>
     <author>xyz</author>
   </book>
   <book>
     <title>pqr</title>
     <author>mno</author>
   </book>
</store>);

my $content = XMLin $store;

foreach my $book ( @{ $content->{book} } ) {  # perldoc perlreftut
   print "Title is '$book->{title}'\n";
}
---------------------------


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


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

Date: Sat, 27 Aug 2005 09:23:41 +0100
From: "Mark D Smith" <usenet@NOSPAM.obantec.net>
Subject: Template-Toolkit-2.14 fails make on FC3
Message-Id: <4310230a$0$3295$da0feed9@news.zen.co.uk>

Hi

perl Makefile.PL
make (using all defaults)

fails

Failed 2/90 test scripts, 97.78% okay. 2/2596 subtests failed, 99.92% okay.
make: *** [test_dynamic] Error 255

so i found an rpm an used yum

yum install perl-Template-Toolkit-2.14-1.1.fc3.rf.i386

<snip Processing Dependency output>

got these errors

Error: missing dep: perl(Text::Autoformat) for pkg perl-Template-Toolkit
Error: missing dep: perl(AppConfig) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::mixed) for pkg perl-Template-Toolkit
Error: missing dep: perl(XML::XPath) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::pie3d) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::pie) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::lines3d) for pkg perl-Template-Toolkit
Error: missing dep: perl(Pod::POM) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::linespoints) for pkg
perl-Template-Toolkit
Error: missing dep: perl(XML::RSS) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::area) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Text) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::bars3d) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::bars) for pkg perl-Template-Toolkit
Error: missing dep: perl(XML::Simple) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Text::Wrap) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Text::Align) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::points) for pkg perl-Template-Toolkit
Error: missing dep: perl(GD::Graph::lines) for pkg perl-Template-Toolkit

Yet i can see all the GD files in /usr/lib/perl5/site_perl/5.8.5/GD/Graph

what have i overlooked and why did yum not grab the Dependencies

Mark



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

Date: Sat, 27 Aug 2005 05:18:41 +0000 (UTC)
From: Mike Friedman <mikef@brillig.security.berkeley.edu>
Subject: Re: Using Crypt::DSA
Message-Id: <deot3h$13u8$1@agate.berkeley.edu>

Sisyphus <sisyphus1@nomail.afraid.org> wrote:
> 
> "Mike Friedman" <mikef@brillig.security.berkeley.edu> wrote in message
>
>> I want to be able to create a public key file and a signature in
>> formats that can be distributed to a user community whose
>> applications may be using other DSA implementations (e.g., Java
>> crypto lib, or other scripting languages besides perl).  So, it's
>> important that the public key file be in a reasonably standard format.
> 
> Which, afaik, would be a pem file. Crypt::DSA can parse them (as
> long as you have Convert::PEM) and so, presumably, can the other
> DSA implementations. To write a *public* key pem file with
> Crypt::DSA you just do (as in 04-pem.t):
> 
> $key->priv_key(undef);
> $key->write( Type => 'PEM', Filename => $keyfile);

Rob,

I do have Convert::PEM.

I tried your suggestion above, but I get only a private key.  In fact,
my script first writes the key object (using $key->write) returned
from sign(), as-is, to one file, then does the above in attempt to
write the *public* key to another file.  But both files are identical!

Here's the entirety of my little test script:

------------------------------------------
   #!/usr/local/bin/perl
   
   use Crypt::DSA;
   use strict;
   
   my $dsa = new Crypt::DSA;
   my $key = Crypt::DSA::Key->new;
   my $filename;
   
   $filename = "./dsakey";
   
   $key = $dsa->keygen (
      Size => 1024,
      Verbosity => 1,
      ) or die $dsa->errstr();
   
   $key->write(
      Type => 'PEM',
      Filename => "$filename.priv",
      );
   
   $key->priv_key(undef);
   
   $key->write(
      Type => 'PEM',
      Filename => "$filename.pub",
      );
   
   exit;
------------------------------------------

The result is that 'dsakey.priv' and 'dsakey.pub' have exactly
the same contents, including the 'BEGIN DSA PRIVATE KEY',
'END DSA PRIVATE KEY' delimiters, even though I've undefined priv_key.
What am I doing wrong?

>> Also, I'd be passing the signature as a base64-encoded string
>> via a web form field.  Once the application base64-decodes it,
>> the signature should be in a format easily fed to its DSA
>> verify routine.
> 
> Are you saying the signature part is not a problem ?  I find some
> ambiguity with "the signature should be in a format easily fed to
> its DSA verify routine" - not sure whether that means the signature
> is already in a suitable format, or whether it means that it needs
> to be in a suitable format (but isn't).

I was just expressing my concern that the signature as produced in your
earlier example (by writing out the separate components of the signature
object) wouldn't be 'standard' in some sense.  But I haven't yet gotten
far enough to try all that out.

Right now, I'm interested in your idea of how to write out a public
key file in PEM format;  it seems it should work, but I'm not getting
the right results.  So, probably I'm overlooking something obvious.

Thanks for your help so far.

Mike



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

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


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