"Gupta, Sharad" wrote:
> Maybe OT. But just curious. What do the experts say about exporting function from OO
> modules??.
> Everytime i need something like this, i end up making those functions as Class
> methods.
>
> -Sharad
In most cases, you should. Access through an object provides context and, IMHO much
needed,
grounding for a function. I took this up in an earlier thread more specific to the
topic, and you
may profit by starting a new original thread.
In brief, if you want to be able to access a package function directly, you have to
have it in the
@EXPORT array of the package, or in the @EXPORT_OK and call it specifically:
in module
package MyCommon;
use strict;
use warnings;
use Exporter;
our @ISA = 'Exporter';
our @EXPORT = qw(your_function_name1, your_function_name2, etc);
sub your_function_name1 {
my $in_string = $_[0];
my $string2 = ucfirst lc $in_string;
print "$string2\n";
}
...
In script:
use MyCommon;
your_function_name1('hello, packaged functionality');
Joseph
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]