On Fri, Feb 08, 2008 at 19:34:43 -0500, Ricardo SIGNES wrote:

> The problem is that I do not want to write:
> 
>   coerce 'Class::A' => from 'HashRef' => via { Class::A->new($_) };
>   coerce 'Class::B' => from 'HashRef' => via { Class::B->new($_) };
>   coerce 'Class::C' => from 'HashRef' => via { Class::C->new($_) };

What about writing:

        foreach my $class ( Class::Base->meta->subclasses ) {
                coerce $class from 'HashRef' => via { $class->new($_) };
        }

?

-- 
  Yuval Kogman <[EMAIL PROTECTED]>
http://nothingmuch.woobling.org  0xEBD27418

Attachment: pgpir0LgzsEE6.pgp
Description: PGP signature

Reply via email to