A better way might be to perform an explicit import, e.g. something like
or, if you can trust that the function isn't AUTOLOADED, look at the module's namespace for the functioneval { $yaml_class->import( 'Dump'); 1; } or croak( "Can't find Dump in $yaml_class\n" );
The only foolproof method is to just wait for a runtime error:Package::Stash->new( $yaml_class )->has_symbol( '&Dump' ) or croak( "Can't find Dump in $yaml_class\n" );
my $Dump = $yaml_class . "::Dump"; [... later in the code ...] my $var = eval { &$Dump(...) } or croak( "bad return or Dump not imple +mented\n" );
In reply to Re^2: What's the best way to use Any YAML (not YAML::Any)
by djerius
in thread What's the best way to use Any YAML (not YAML::Any)
by djerius
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |