Ok,
In Perl we use the following code to make a sub class of a class.
@ISA = (inherited class);
However if you are using strict like below,
package MySubClass; use strict; @ISA = qw( MyClass ); ...
you will get the error Global symbol “@ISA” requires explicit package name (did you forget to declare “my @ISA”?)
Using My @ISA like below will just give you the error Can’t locate object method “MyMethod” via package “MySubClass” because you just made it local.
package MySubClass; use strict; my @ISA = qw( MyClass ); ...
So how can I fix this? Well there are many different options, I have listed some of them here.
The first one is simple, just place the use strict after the @ISA
package MySubClass; @ISA = qw( MyClass ); use strict; ...
Another option is to use the vars declaration.
package MySubClass; use strict; use vars ('@ISA'); @ISA = qw( MyClass ); ...
This one is probably the most correct way and that is to declare the @ISA with our. However I believe this will only work with perl greater than 5.6 so you may want to add use 5.6.0;
package MySubClass; use strict; use 5.6.0; our @ISA = qw( MyClass ); ...
So there you go, some fine examples on how to use @ISA and strict.