Em Sex, 2009-02-20 às 11:19 +1100, Timothy S. Nelson escreveu:
>       if(! defined($footree.root)) { warn "Unrooted tree"; }

There are some other very interesting possibilities:

  unless ($footree.can(root)) { warn "Unrooted tree"; }

or even better

  unless ($footree ~~ RootedTree) { warn "Unrooted tree"; }

or yet even better

  my RootedTree $footree = something()

and it fails automatically...

*That's* what Roles are for...


Reply via email to