How to test for existance ?
From: no spam (uce_at_ftc.gov)
Date: 02/13/05
- Previous message: Gary Harvey: "Re: Using more than 2G of memory with PERL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 13 Feb 2005 01:21:43 GMT
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.
----
Yves Dorfsman
http://www.cuug.ab.ca/dorfsmay
http://www.SollerS.ca
- Previous message: Gary Harvey: "Re: Using more than 2G of memory with PERL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|