Problems? Is your data what you think it is? | |
PerlMonks |
Re: How to call Moduleby Zed_Lopez (Chaplain) |
on Aug 24, 2004 at 17:22 UTC ( [id://385461]=note: print w/replies, xml ) | Need Help?? |
Package != Module != Object class perlmod perlmodlib perlmodstyle perlboot Your code suggests that you really want to just use a module for library routines, rather than to create an object class... you're pretty much ignoring the point of object-oriented programming by having your methods try to create disposable objects to perform single operations (and you're not storing the results of CreateEncryptDecryptObject, so it's a no-op, anyway.) Further, if your methods were actually invoked through objects, they'd have the object itself as the first item in @_, meaning that, as written, your Encrypt and Decrypt methods, would be trying to encrypt and decrypt the object reference. (And your uses of $log are going to fail... they'll be trying to use $Config::Confmanager::log which will be undefined.) How you would use these in a program would depend on whether you go with OOP or not. Here's one easy way with a closure and an ordinary, non-object-oriented module:
And here's how you'd use it.
(I agree with tilly about @EXPORT_OK, but didn't change it in this example to keep it just a little closer to your original.)
In Section
Seekers of Perl Wisdom
|
|