package NewScalar;
require Tie::Scalar;
- @ISA = (Tie::Scalar);
+ @ISA = qw(Tie::Scalar);
sub FETCH { ... } # Provide a needed method
sub TIESCALAR { ... } # Overrides inherited method
package NewStdScalar;
require Tie::Scalar;
- @ISA = (Tie::StdScalar);
+ @ISA = qw(Tie::StdScalar);
# All methods provided by default, so define only what needs be overridden
sub FETCH { ... }
are summarized below. The L<perltie> section not only documents these, but
has sample code as well:
-=over
+=over 4
=item TIESCALAR classname, LIST
sub TIESCALAR {
my $pkg = shift;
- if (defined &{"{$pkg}::new"}) {
+ if ($pkg->can('new') and $pkg ne __PACKAGE__) {
warnings::warnif("WARNING: calling ${pkg}->new since ${pkg}->TIESCALAR is missing");
$pkg->new(@_);
}
# tweak a small bit.
#
package Tie::StdScalar;
-@ISA = (Tie::Scalar);
+@ISA = qw(Tie::Scalar);
sub TIESCALAR {
my $class = shift;