<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 30, 2011, at 11:27 AM, Rohan M wrote:</div><blockquote type="cite"><div>I got carried away with the other work for the same app. Now I'm back to this point again.&nbsp;</div><div><br></div><div>I created a file called User.pm and put it under Model directory.&nbsp;</div>
<div>After putting, &nbsp;use base "Catalyst::Authentication::Store::Htpasswd::User";&nbsp;&nbsp;I am trying to use around find_user or any method that is present in the base class but I ended up getting following error.</div>
<div><br></div><div>"Couldn't load class (MyApp) because: The method 'check_password' was not found in the inheritance hierarchy."</div><div><br></div><div>I'm sorry to ask you again but I'm not sure how the following subclassing can be done.</div>
<div><br></div><div>Could you send few more details ( example) ?</div><div><br></div><div>====</div><div><div>package MyApp::Model::User;</div><div>use Moose;</div><div>use namespace::autoclean;</div><div>use Switch;</div>
<div>use base "Catalyst::Authentication::Store::Htpasswd::User";</div><div>extends 'Catalyst::Model';</div><div><br></div><div><br></div><div>around check_password =&gt; sub {</div><div>&nbsp;&nbsp; my ($orig, $self, $authinfo, $c, @args) = @_;</div>
<div>&nbsp;&nbsp; my $user = $self-&gt;$orig($authinfo, $c, @args);</div><div>&nbsp;&nbsp; return $user;</div><div>};&nbsp;</div></div><div><br></div><div>OR</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">around find_user =&gt; sub {<br>
&nbsp; &nbsp;my ($orig, $self, $authinfo, $c, @args) = @_;<br>&nbsp; &nbsp;my $user = $self-&gt;$orig($authinfo, $c, @args);<br>&nbsp; &nbsp;$user-&gt;extra_field($c-&gt;model('DB::User')-&gt;find({ username =&gt; $user-&gt;id })-&gt;first-&gt;extra_field;<br>
&nbsp; &nbsp;return $user;<br>};</span></div></blockquote><br></div><div>Rohan,</div><div><br></div><div>I haven't verified this but I think that what you want to do is make it be a regular class, not a Catalyst component. Then in your configuration where you specify your user_class for your store use MyApp::User rather than Catalyst::Authentication::Store::Htpasswd::User</div><div><br></div><div>package MyApp::User;</div><div>use Moose;</div><div>use namespace::autoclean;</div><div>extends 'Catalyst::Authentication::Store::Htpasswd::User';</div><div><br></div><div><div><div>around check_password =&gt; sub {</div><div>&nbsp;&nbsp; my ($orig, $self, $authinfo, $c, @args) = @_;</div><div>&nbsp;&nbsp; my $user = $self-&gt;$orig($authinfo, $c, @args);</div><div>&nbsp;&nbsp; return $user;</div><div>};</div></div><br></div><div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">around find_user =&gt; sub {<br>&nbsp; &nbsp;my ($orig, $self, $authinfo, $c, @args) = @_;<br>&nbsp; &nbsp;my $user = $self-&gt;$orig($authinfo, $c, @args);<br>&nbsp; &nbsp;$user-&gt;extra_field($c-&gt;model('DB::User')-&gt;find({ username =&gt; $user-&gt;id })-&gt;first-&gt;extra_field;<br>&nbsp; &nbsp;return $user;<br>};</span></div><div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><span class="Apple-tab-span" style="white-space:pre">        </span>- john romkey</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><span class="Apple-tab-span" style="white-space:pre">        </span><a href="http://www.romkey.com/">http://www.romkey.com/</a></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div></div><br></body></html>