package Tie::Scalar;
+our $VERSION = '1.00';
+
=head1 NAME
Tie::Scalar, Tie::StdScalar - base class definitions for tied scalars
are summarized below. The L<perltie> section not only documents these, but
has sample code as well:
-=over
+=over 4
=item TIESCALAR classname, LIST
=cut
use Carp;
+use warnings::register;
sub new {
my $pkg = shift;
sub TIESCALAR {
my $pkg = shift;
- if (defined &{"{$pkg}::new"}) {
- carp "WARNING: calling ${pkg}->new since ${pkg}->TIESCALAR is missing"
- if $^W;
+ if ($pkg->can('new') and $pkg ne __PACKAGE__) {
+ warnings::warnif("WARNING: calling ${pkg}->new since ${pkg}->TIESCALAR is missing");
$pkg->new(@_);
}
else {