Hi again and thank you

On 13/02/07, Igor Sutton <[EMAIL PROTECTED]> wrote:

Hi Ana,

> Don't I have to put "use" and the name of packages A and B anywhere on
the
> main program?

I advice you to use Module::Pluggable for that (as I think you're
designing a pluggable system or whatever):



Yes, it is a pluggable system :o)


$ cat > module-pluggable-sample.pl
use strict;
use warnings;

package Application;
use Module::Pluggable;

package main;

foreach my $plugin (Application->plugins()) {
    if (my $code = $plugin->can("my_routine")) {
        $code->();
    }
}
^D
$ mkdir -p Application/Plugin
$ cat > Application/Plugin/A.pm
package Application::Plugin::A;
sub my_routine {
    print __PACKAGE__, "::my_routine()\n";
}
^D
$ cat > Application/Plugin/B.pm
package Application::Plugin::B;
sub my_routine {
    print __PACKAGE__, "::my_routine()\n";
}
^D
$ perl module-pluggable-sample.pm
Application::Plugin::A::my_routine()
Application::Plugin::B::my_routine()



I have done everything and I don't get anything when doing $ perl
module-pluggable-sample.pm, would you know why?

Thanks

Regards

Ana

--
"El más baldío de todos los días
es aquél en que no hemos reído"
                          (de Chamfort)

Reply via email to