-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm working through perlboot right now and have run up against a minor
challenge. Unlike the tutorial itself, I'm using "strict" since this
is the environment I wish to code in on a day to day basis. Following
is example code and the error message it generates.
> perl -w
use strict;
my $name = "Mr. Ed";
my $talking = \$name;
bless $talking, Horse; # <----<<< this is the source of the problem
print Horse->speak,
$talking->name, " says ", $talking->sound, "\n";
{ package Animal;
sub speak {
my $class = shift;
print "a $class goes ", $class->sound, "!\n"
}
}
{ package Horse;
use base qw(Animal);
sub sound { "neigh" }
sub name {
my $self = shift;
$$self;
}
}
^D
Bareword "Horse" not allowed while "strict subs" in use at - line 5.
Execution of - aborted due to compilation errors.
>
So ... what is the correct "strict" way to "bless $talking, Horse"?
- --
=====================
Shaun Fryer
=====================
http://sourcery.ca/
ph: 905-529-0591
=====================
Science is like sex: occasionally something useful
comes out of it, but that's not why we do it.
- -: Richard Feynmann
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (OpenBSD)
Comment: public key http://sourcery.ca/sfryer_gpg.txt
iD8DBQE/Z7hUvN1tsN5oC50RAt+SAJ9A6Td2fiRCQVYGWtb2OKTMdNm/BACfUd6f
Kl6pA+Z9ayRSN0wk4CAJYCs=
=j7Hs
-----END PGP SIGNATURE-----
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]