can´t call method xyz on an undefined value at...

2004-09-03 Thread Bastian Angerstein

Good Morning,

I, once again, have a question.

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




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




RE: can´t call method xyz on an undefined value at...

2004-09-03 Thread Charles K. Clarkson
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




can´t call method xyz on an undefined value at...

2004-09-03 Thread Bastian Angerstein
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




RE: can´t call method xyz on an undefined value at...

2004-09-03 Thread Charles K. Clarkson
Bastian Angerstein [EMAIL PROTECTED] wrote:

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

Show us your code.





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