Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Matthew Pounsett
July 27, 2011, 10:16 pm
rate this thread
asn't shown up ... making a second try.
I'm building some code that makes checksums of several files, using a confi=
gurable digest algo. In order to avoid having to repeat the same if() bloc=
k all over the place when creating new digest objects, I'd like to do that =
once, and assign a reference to the constructor for the appropriate digest =
module at that point, which I can just re-use. I seem to be having a hard =
time coming up with the right syntax however.
The closest I've got so far is a proof of concept that looks like this:
$digest = \&Digest::MD5::new;
$foo = &$digest;
$foo->add( "blahblahblah" );
This throws an error when I try to execute &$digest... I get Digest::MD5::n=
ew's usage help. It seems it wants me to do "$foo = &$digest('Digest::MD=
5')" which doesn't really help with my original problem. Does anyone have =
a suggestion for how to get what I want out of this?
- » Trouble running Perl script from within a Perl script
- — Next thread in » PERL Discussions