Problems with delegation using "handles"

[email protected] (Marcos Barbeitos)
Newsgroups perl.moose
Message-ID <CA+gEHsWrHo3TTQE24j+KG-f2ytCmXNNHTTL=ByyvXExE=uyMHw@mail.gmail.com>
Howdy moosers, if I try to use the following package:

--
package Test_Handle;

use Moose;
use MooseX::StrictConstructor;

use DBIx::Custom;

has 'dbix_custom' =>
(
    is => 'ro'
  , isa => 'DBIx::Custom'
  , lazy_build => 1
  , handles => qr/.+/
);
__PACKAGE__->meta->make_immutable;
1;

--
perl -e 'use Test_Handle'
--

I get:

Can't use string ("Test_Handle") as a HASH ref while "strict refs" in
use at reader Test_Handle::dbix_custom (defined at Test_Handle.pm line
8) line 5.
BEGIN failed--compilation aborted at -e line 1.

However, if I try to delegate a single method:

--
package Test_Handle;

use Moose;
use MooseX::StrictConstructor;

use DBIx::Custom;

has 'dbix_custom' =>
(
    is => 'ro'
  , isa => 'DBIx::Custom'
  , lazy_build => 1
  , handles => qr/update/
);
__PACKAGE__->meta->make_immutable;
1;

--
perl -e 'use Test_Handle'
--

It works. Any ideas?  Thanks!

Marcos.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.