#! perl -sw use vars qw/@scanners/; use strict; use constant PLUGINS => 'c:/test/plugins/*'; BEGIN { @scanners = glob PLUGINS; for(@scanners) { require $_; warn $@ if $@; my ($module) = m!.*/([^\.]+)\Q.pm\E$!; $_ = eval{ "$module"->new() }; warn "Attempt to load: $module failed\n" if ( !$_ or $@ ); } @scanners = grep{ $_ } @scanners; } # call the 'scan' routine in each module, and # print out the results from the array reference returned. print @{&{$_}}, $/ for @scanners; #### package method1; sub new{ my $class = shift; return bless \&scan, $class; } sub scan{ my @results = qw/foo bar baz/; #!do scan; return \@results; } 1; #### package method2; sub new{ my $class = shift; return bless \&scan, $class; } sub scan{ my @results = qw/the quick brown fox/; #!do scan; return \@results; } 1; #### C:\test>209857 foobarbaz thequickbrownfox C:\test>