G
Guest
Here's a small script to show what I am trying to do:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/perl -w
sub print_yep
{
print "yep...\n";
}
$function1 = "print_yep";
$function2 = "rubbish";
$vector->{ACTION1} = \&$function1;
$vector->{ACTION2} = \&$function2;
print "something's fishy !\n" if (! exists $vector->{ACTION2});
$vector->{ACTION1}();
$vector->{ACTION2}();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How can I test if a function exist or not ?
Shouldn't this print "something's fishy" ??
I've tried to use defined, to deference in different ways, but I can't get
it working.
Thanks,
Yves.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#!/usr/bin/perl -w
sub print_yep
{
print "yep...\n";
}
$function1 = "print_yep";
$function2 = "rubbish";
$vector->{ACTION1} = \&$function1;
$vector->{ACTION2} = \&$function2;
print "something's fishy !\n" if (! exists $vector->{ACTION2});
$vector->{ACTION1}();
$vector->{ACTION2}();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
How can I test if a function exist or not ?
Shouldn't this print "something's fishy" ??
I've tried to use defined, to deference in different ways, but I can't get
it working.
Thanks,
Yves.