my $pkg = "Test::Command::$command"; ( my $mod = $pkg ) =~ s{::}{/}g; $mod .= '.pm'; my $exists = eval { require $mod }; #### ... $pkg->handle_output(); #### sub new { my $class = shift; my $command = shift; my $self = $class->SUPER::new(); print "DEBUG : handling command $command in " . __PACKAGE__ . "\n" if ( $command ); }