CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Not sure where im wrong

 



MattC
Novice

Nov 7, 2012, 10:40 AM

Post #1 of 4 (1995 views)
Not sure where im wrong Can't Post

I am writing a simple subroutine to grab the latest registered users. Doesn't seem to run, and I can not - for the life of me - figure it out.


Code
sub get_recent_users { 

my ($self, $limit) = @_;
$limit = $limit || 30;

my $users = $self->search(
{

},

{
result_class => 'DBIx::Class::ResultClass::HashRefInflator',
order_by => { -asc => 'me.ts' },
rows => $limit,
select => [(
'user.uid',
'user.complete_name',
)],
}
);

return $users;
}


Cheers.


MattC
Novice

Nov 7, 2012, 1:31 PM

Post #2 of 4 (1985 views)
Re: [MattC] Not sure where im wrong [In reply to] Can't Post

Figured it out. Stupid mistake, but I had:
[% FOREACH user IN c.model('DB::Users').get_recent_users(5) %]

When it should have been:
[% FOREACH user IN c.model('DB::User').get_recent_users(5) %]


Laurent_R
Veteran / Moderator

Nov 7, 2012, 1:58 PM

Post #3 of 4 (1981 views)
Re: [MattC] Not sure where im wrong [In reply to] Can't Post

Good that you found out, I am happy for you, but if I understood it right, the error was in something you did not show us. How could we have found out?


MattC
Novice

Nov 7, 2012, 1:59 PM

Post #4 of 4 (1980 views)
Re: [Laurent_R] Not sure where im wrong [In reply to] Can't Post

Because I thought the error was within the actual sub routine and not the template part.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives