Now I gate canīt call methode can on an undefined value xyz line xyz.
Any Idea?


-----Ursprüngliche Nachricht-----
Von: Charles K. Clarkson [mailto:[EMAIL PROTECTED]
Gesendet: Freitag, 3. September 2004 10:37
An: 'Bastian Angerstein'; 'Mailinglist Perl Beginners'
Betreff: RE: canīt call method "xyz" on an undefined value at...


Bastian Angerstein <[EMAIL PROTECTED]> wrote:

: How can I check if a Method is undefined or not without
: getting this error?


    Assuming you mean the method to an object. Use the
UNIVERSAL method 'can'.


use CGI;
my $q = CGI->new();
print "method 'xyz' invalid for '\$q'\n" unless $q->can( 'xyz' );
print "method 'xyz' valid for '\$q'\n";

__END__

use CGI ('xyz');
my $q = CGI->new();
print "method 'xyz' invalid for '\$q'\n" unless $q->can( 'xyz' );
print "method 'xyz' valid for '\$q'\n";

__END__


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to