On Fri, 13 Nov 2009, Peter Rabbitson wrote:

> Mark Hedges wrote:
> > I get this error for any class in which I try to use
> > inflate_column(), even if I have empty stub coderefs for
> > inflate and deflate.  This is in a test script by itself,
> > I'm not using Catalyst.  I saw some archive messages about
> > this error and tried the suggestions but I don't see what
> > I'm doing wrong...
> >
> >
> > Can't locate object method "result_source_instance" via package 
> > "DeSpam::DC::Lame" at 
> > /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/ResultSourceProxy.pm line 47, 
> > <DATA> line 114.
> >
> > ###########
> >
> > package DeSpam::DC::Lame;
> > use strict;
> > use warnings FATAL => 'all';
> > use English '-no_match_vars';
> >
> > use base qw( DBIx::Class );
> > __PACKAGE__->load_components(qw( InflateColumn Core ));
> >
> > my %allowed = map {($_ => 1)} qw( foo bar biz baz );
> >
> > __PACKAGE__->inflate_column('lamer', {
> >     inflate => sub { [ split m{\s*,\s*}mxs, shift ] },
> >     deflate => sub {
> >         my $value = shift;
> >         die "non-array reftype for deflating lamer" if ref $value ne 
> > 'ARRAY';
> >         die "lamer value '$_' not allowed" for grep !exists $allowed{$_}, 
> > @{$value};
> >         return join q{,}, @{$value};
> >     },
> > });
> >
> > ###############
>
> ^^^ A resultsource is useless until you declare a table() on it (this is not 
> only
> an accessor but also an initializer).


Perhaps you did not read my example.  I am not using a
resultsource explicitly.  I am simply trying to 'use' the
package above, which includes an inflate_column statement.
If I comment out the __PACKAGE__->inflate_column statement,
it loads fine with 'use'.  Otherwise, 'use' generates the
result_source error.

Help - take it seriously - please?

Mark

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to