2009/9/6 Chas. Owens <chas.ow...@gmail.com>:
> It sounds like you want the blessed function from [Scalar::Util][1]:
>
> croak "Pgp::Graph::FSG::writefsg didn't get a Graph object"
>    unless blessed $graph and $graph->isa('Graph');

Yes, that's pretty much ideal. The test might succeed wrongly if
someone overrides isa() in their own class but I think I can rely on
people not to do that.

> If you are using an OO style then you should really look into
> [Moose][2].  It is Perl 6's object module backported to Perl 5.  I
> would also suggest using [MooseX::Declare][3] which changes the way
> Perl 5 parses code to allow a simple declarative style of creating
> classes:

I had a look and it's really interesting and exactly what perl OO
needs! Unfortunately I'm not doing this in an OO manner so its not
directly useful (unless I want to reformulate it as an OO problem,
which I don't).

Phil

-- 
"I have always wished for my computer to be as easy to use as my
telephone; my wish has come true because I can no longer figure out
how to use my telephone."
  --Bjarne Stroustrup

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to