Class::DBI::Plugin::AccessionSearch - easliy add search atters.


Class-DBI-Plugin-AccessionSearch documentation Contained in the Class-DBI-Plugin-AccessionSearch distribution.

Index


Code Index:

NAME

Top

Class::DBI::Plugin::AccessionSearch - easliy add search atters.

VERSION

Top

This documentation refers to Class::DBI::Plugin::AccessionSearch version 0.02

SYNOPSIS

Top



    package Your::Data;
    use base 'Class::DBI';
    use Class::DBI::AccessionSearch;

in your script:

    use Your::Data;
    my $d = Your::Data->accession({status => 'ok'});
    $d->accession_search({sex => 'male'});
    $d->accession_search({status => 'ng'});

Methods

Top

accession

create Class::DBI::AccessionSearch object.

search_where's wrapper.

AUTHOR

Top

Atsushi Kobayashi, <nekokak at gmail.com>

BUGS

Top

Please report any bugs or feature requests to bug-class-dbi-plugin-accessionsearch at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-DBI-Plugin-AccessionSearch. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc Class::DBI::Plugin::AccessionSearch

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/Class-DBI-Plugin-AccessionSearch

* CPAN Ratings

http://cpanratings.perl.org/d/Class-DBI-Plugin-AccessionSearch

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-DBI-Plugin-AccessionSearch

* Search CPAN

http://search.cpan.org/dist/Class-DBI-Plugin-AccessionSearch

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


Class-DBI-Plugin-AccessionSearch documentation Contained in the Class-DBI-Plugin-AccessionSearch distribution.

package Class::DBI::Plugin::AccessionSearch;
use strict;
use warnings;
use base qw/Class::DBI::Plugin/;

our $VERSION = '0.02';

sub accession : Plugged {
    my($pkg, $where, $attrs) = @_;

    my $param = {
        pkg   => $pkg,
        where => $where,
        attrs => $attrs,
    };

    bless $param , __PACKAGE__;
}

sub accession_search : Plugged {
    my ($self, $where, $attrs) = @_;

    $where ||= {};
    $attrs ||= {};

    my $our_where = $self->{where} || {};
    my $new_where = { %{$our_where} , %{$where} };

    my $our_atters = $self->{attrs} || {};
    my $new_attrs = { %{$our_atters} , %{$attrs} };

    $self->{where} = $new_where;
    $self->{attrs} = $new_attrs;

    return $self->{pkg}->search_where($new_where,$new_attrs);
}

1; # End of Class::DBI::Plugin::AccessionSearch