anaconda_wly has asked for the wisdom of the Perl Monks concerning the following question:
I saved all the following lines in one file test.pl and run and got an error(Can't call method "isExist" on an undefined value at test.pl line). Anyone may help point out my problem?Thanks;
The code:package testor; my $componentName = ''; sub new{ $componentName = $_; } sub isExist{ return 0; } 1; #use testor; my $myComponent = '7-Zip 9.20 (x64 edition)'; my $checker = testor->new($myComponent); if( $checker->isExist() ){ print '$myComponent already installed\n'; }else{ print '$myComponent not installed\n'; } exit 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: newbie's question on inheritance
by tobyink (Canon) on Oct 28, 2012 at 06:43 UTC | |
by anaconda_wly (Scribe) on Oct 28, 2012 at 06:52 UTC |