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;
In reply to newbie's question on inheritance by anaconda_wly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |