<div dir="ltr"><div dir="ltr"><div dir="ltr">If the data is coming from the DB it does not use the &quot;new&quot; 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 &lt;<a href="mailto:mansky@mindspring.com" target="_blank">mansky@mindspring.com</a>&gt; 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 &quot;Can&#39;t find source for XXX&quot; error message.<br>
<br>
I&#39;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 &quot;Can&#39;t find source for XXX&quot; error message when I try searching the table XXX.<br>
<br>
In my Schema object I have :<br>
<br>
__PACKAGE__-&gt;load_namespaces();<br>
<br>
and the usual &quot;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-&gt;storage_type(&#39;::DBI::mysql&#39;);<br>
    return $self-&gt;connect($dsn, $dbuser, $dbpw, { AutoCommit =&gt; 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 = &quot;dbi:mysql:database=$db&quot;;<br>
<br>
I&#39;ve checked the object returned by the constructor and it has the expected entries:<br>
<br>
class_mappings =&gt; { &#39;X::Y::Z::Result::Table1&#39; =&gt; &#39;Table1&#39;, <br>
                    &#39;X::Y::Z::Result::Table2&#39; =&gt; &#39;Table2&#39;,<br>
                     ...<br>
                   },<br>
<br>
source_registrations =&gt; {<br>
                          &#39;Table1&#39; =&gt; bless( { &#39;result_class&#39; =&gt; &#39;X::Y::Z::Result::Table1&#39;,<br>
                                               &#39;resultset_class&#39; =&gt; &#39;X::Y::Z::ResultSet::Table1&#39;,<br>
                                               &#39;name&#39; =&gt; &#39;Table1&#39;,<br>
                                               &#39;source_name&#39; =&gt; &#39;Table1&#39;,<br>
                                                ...<br>
                                              }, &#39;DBIx::Class::ResultSource::Table&#39;},<br>
<br>
                          ...<br>
                         },<br>
<br>
storage =&gt; { &#39;_connect_info&#39; =&gt; [ &#39;dbi:mysql:database=VSO&#39;,<br>
                                  &#39;dbuser&#39;,<br>
                                  &#39;dbpw&#39;,<br>
                                  {<br>
                                    &#39;AutoCommit&#39; =&gt; 1<br>
                                  },<br>
             &#39;_conn_pid&#39; =&gt; 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 &quot;Can&#39;t find source ...&quot; 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>