I forgot to describe my environment. it's here. C:\Documents and Settings\jackm\usetest>perl -v
This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 50 registered patches, see perl -V for more detail) Copyright 1987-2006, Larry Wall Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com<http://www.activestate.com/> Built Jan 23 2007 15:57:46 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. wirh Windows XP SP2. Thank you ! -- jackm 2007/7/18, Jack Minoshima <[EMAIL PROTECTED]>:
Hi! Nice to see you. I'm new to OOP Peal. Let me ask you a silly question. When I try to use 'use base', I encountered an problem. I wrote this program; --------------------------------------------------------------- Animal.pm<http://animal.pm/> package Animal; sub speak { my $class = shift; print "a $class goes ", $class->sound, "!\n"; } sub AUTOLOAD { my $class = shift; print "AUTOLOAD: a $class goes ", $class->sound, "!\n"; } 1; --------------------------------------------------------------- Mouse.pm<http://mouse.pm/> use strict subs; package Mouse; use base 'Animal'; sub sound { 'squek' }; 1; --------------------------------------------------------------- farm.pl use Mouse; Mouse->speak; and it work fine. C:\Documents and Settings\jackm\usetest>farm.pl a Mouse goes squek! but when I unquote the quote of use base 'Animal'; like this use base Animal; It would cause an error; C:\Documents and Settings\jackm\usetest>farm.pl Unknown error Compilation failed in require at C:\Documents and Settings\jackm\usetest\farm.pl line 1. BEGIN failed--compilation aborted at C:\Documents and Settings\jackm\usetest\farm.pl line 1. use Animal is allowed, but is use base Animal not allowed? FYI, if you remove use strict subs, it won't be an error. but in the file farm.pl, use Mouse; works but use 'Mouse' would be syntax error. In summary ... no strict sub use Mouse OK use 'Mouse' NG use base Animal OK use base 'Animal' OK use strict sub use Mouse OK use 'Mouse' NG use base Animal NG use base 'Animal' OK Please tell my why I need quote after use base while using strict subs. Thank you very much in advance ! -- jackm