<div dir="ltr"><div dir="ltr"><div dir="ltr">If the data is coming from the DB it does not use the "new" sub it uses a sub inflate_result.<div><br></div><div>Start by looking at these<br><br>(search for inflate_result)<br><a href="https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod">https://metacpan.org/pod/distribution/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod</a><br><br></div><div><a href="https://metacpan.org/pod/DBIx::Class::Row#inflate_result">https://metacpan.org/pod/DBIx::Class::Row#inflate_result</a><br><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 12:58 AM ejm <<a href="mailto:mansky@mindspring.com" target="_blank">mansky@mindspring.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
Another newbie question about the "Can't find source for XXX" error message.<br>
<br>
I've been able to establish a connection to my MySQL DB by specifying a storage type for my Schema,<br>
but I keep getting the "Can't find source for XXX" error message when I try searching the table XXX.<br>
<br>
In my Schema object I have :<br>
<br>
__PACKAGE__->load_namespaces();<br>
<br>
and the usual "use base qw(DBIx::Class::Schema);<br>
<br>
so that methods are correctly inherited from DBIx::Class::Schema.<br>
<br>
Then I have a new constructor in my Schema object which blesses my object in the namespace I need it in:<br>
<br>
sub new {<br>
my ($proto, $db) = @_;<br>
my $class = ref($proto) || $proto;<br>
my $self = bless {}, $class;<br>
<br>
$self->storage_type('::DBI::mysql');<br>
return $self->connect($dsn, $dbuser, $dbpw, { AutoCommit => 1});<br>
}<br>
<br>
where $db is the MySQL DB I need to access and $dbuser, $dbpw are local variables containing the usual User and PW.<br>
<br>
and $dsn = "dbi:mysql:database=$db";<br>
<br>
I've checked the object returned by the constructor and it has the expected entries:<br>
<br>
class_mappings => { 'X::Y::Z::Result::Table1' => 'Table1', <br>
'X::Y::Z::Result::Table2' => 'Table2',<br>
...<br>
},<br>
<br>
source_registrations => {<br>
'Table1' => bless( { 'result_class' => 'X::Y::Z::Result::Table1',<br>
'resultset_class' => 'X::Y::Z::ResultSet::Table1',<br>
'name' => 'Table1',<br>
'source_name' => 'Table1',<br>
...<br>
}, 'DBIx::Class::ResultSource::Table'},<br>
<br>
...<br>
},<br>
<br>
storage => { '_connect_info' => [ 'dbi:mysql:database=VSO',<br>
'dbuser',<br>
'dbpw',<br>
{<br>
'AutoCommit' => 1<br>
},<br>
'_conn_pid' => 10779,<br>
...<br>
<br>
}<br>
<br>
<br>
I see an entry in source_registrations for each of the tables in the DB VSO, all with their correct columns.<br>
However, I noted that the objects are all blessed into the generic DBIx::Class::ResultSource::Table class and not<br>
the X::Y::Z::ResultSource::Table1 class as I would have expected.<br>
<br>
Is that why I am getting the "Can't find source ..." error message ?<br>
<br>
I have a package for each table in X::Y::Z::Result namespace and additionally a package for the table I am testing<br>
in both X::Y::Z::ResultSource::Table1 and X::Y::Z::ResultSet::Table1<br>
<br>
I noted that the resultset_class key above was indeed set to my namespace-specific package for my test table.<br>
<br>
Any tips or ideas would be greatly appreciated.<br>
<br>
<br>
Thanks,<br>
<br>
--Ed<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" rel="noreferrer" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" rel="noreferrer" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" rel="noreferrer" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" rel="noreferrer" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
</blockquote></div>