I don't know how to take that and actually refer to the user's name.
That local *getUserByUserId = make_closure( 'users', 'user_id' ); simply gives a name to the sub ref returned by make_closure(). You can call it exactly as if you had the code sub getUserByUserId { . . . } instead. To get at the name, you only have to know that the function returns the results of a fetchrow_hashref(). So, something like this should do fine:
my $user_data = getUserByUserId( $id ); my $user_name = $user_data->{name};
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Re: Code factory
by sauoq
in thread Code factory
by Notromda
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |