<div dir="ltr">My bad, in the above script, the $self was holding the 1st argument, rather than the reference of RT::Users class.<div><br></div><div>The original subroutine returns the ref of RT::Users.</div><div>As per the documentation of Hook::Lexwrap, the returned value from the original subroutine should be accessible from the post subroutine using $_[-1].</div><div><br></div><div>When I access $_[-1], using print or warn, I get the warning</div><div><b> [warning]: Use of uninitialized value $_[-1] in concatenation (.) or string</b><br></div><div><b><br></b></div><div>Users_Local.pm</div><div>-----------------------</div><div><div>package RT::Users;</div><div>use strict;</div><div>use Hook::LexWrap;</div><div>wrap 'SimpleSearch' =></div><div> post=> sub {</div><div> RT::Logger->info("accessing return value here $_[-1]");</div><div> RT::Logger->info("I got the arguments in post: [@_]");</div><div>},</div><div>;</div><div>1;</div></div><div><br></div><div>Can anybody please help how will I be able to fetch the value returned by the original subroutine ?</div><div>Thanks.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 21, 2016 at 1:05 PM, aniket tripathy <span dir="ltr"><<a href="mailto:aniket.tripathy@gmail.com" target="_blank">aniket.tripathy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I intend to filter the results returned by SimpleSearch method in Users.pm based on the custom field value set in the current user logged in.</div><div><br></div><div>I am using Hook::LexWrap in the Users_Local.pm overlay file, to write a post method to filter the results of SimpleSearch. How can I get a ref of CurrentUser which in turn will help to fetch the custom field value on that user?</div><div><br></div><div>I tried using </div><div>my $user = $self->CurrentUser;</div><div><br></div><div>But getting the following error:</div><div>[error]: Can't locate object method "CurrentUser" via package "Privileged" (perhaps you forgot to load "Privileged"?) <br></div><div><br></div><div>Can anybody suggest what am I doing wrong here? </div><div><br></div><div>Thanks in Advance.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Aniket</div></font></span></div>
</blockquote></div><br></div>