logo       

idiomatic way to handle manager class search results?: msg#00081

lang.perl.modules.dbi.rose-db-object

Subject: idiomatic way to handle manager class search results?

this works, just checking to see if its the idiomatic way-- as the
docs didn't point to it...

basically:
a query in a manager for non-key fields...
results are stuffed into $results
check scalar @$ to see if there are results

i *think* @$results is the right way to handle it. $results is a
rosedb object, but overloads make it seem like an arrayref

====

package MyApp::RoseDB::Object::Sample::Manager;
use Rose::DB::Object::Manager;
our @ISA = qw(Rose::DB::Object::Manager);
sub object_class { 'MyApp::RoseDB::Object:: Sample' }

sub seach_for_existence {
my ( $class, %args ) = @_ ;
my $results= $class->get_item(
query=> [
linked_id=> $args{linked_id} ,
type_id=> $args{type_id} ,
resource=> $args{resource}
],
db=> $args{db}
);
if ( scalar @$results ) {
return $results;
}
else {
return 0;
}
}










| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -





Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise