-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Okay ... ignore my last questions. Seems the list-server is a bit slow today, so after a few hours banging away, I figured it out by a combination of trial & error + RTFMs <doh!> (solution below).
{ package Generic; sub MkInstance { my $class = shift; my $var = shift; bless \$var, $class; } sub ReturnPkgName { my $ref = shift; ref $ref ? ref $ref : $ref; } sub DeBless { # was "Curse", but too close to `curses (3)` my $scalar = shift; ref $scalar # is it a class or instance (blessed reference)? ? $$scalar # it's an instance, return dereferenced value : $scalar; # it's a class, return generic } } { package Guy; use base qw(Generic); } my $scalar_ref = Guy->MkInstance("Bubba"); print $scalar_ref->DeBless, "\n"; my @names_array = qw/ Tom Dick Harry /; my $array_ref = Guy->MkInstance([EMAIL PROTECTED]); ####### ## 1 ## ####### Answer: print "Class = ", $array_ref->ReturnPkgName, "\n"; ####### ## 2 ## ####### Answer: print "Ref_Type = ", ref $array_ref->DeBless, "\n"; print "Instance = qw/ ", join ' ', @{$array_ref->DeBless}, "/\n"; ####### Combined... foreach my $var (@{$array_ref->DeBless}) { print "Some ", $array_ref->ReturnPkgName, " named $var.\n"; } I'm still working on how to properly bless then dereference hashes using Generic->methods. The saga continues... Any pointers are welcomed of course. ;) - -- ===================== 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: http://sourcery.ca/sfryer-public_pgp_key.txt iD8DBQE/aUmx2rKegHkuEpoRAgTjAKCkqWvaROMfaCXPqoe7ioUmqRXdZgCeKvGe mu9WkR5LvSdjmsLw1o28SwQ= =ingE -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]