AnyEvent-Groonga

 view release on metacpan or  search on metacpan

lib/AnyEvent/Groonga/Result.pm  view on Meta::CPAN

package AnyEvent::Groonga::Result;
use strict;
use warnings;
use base qw( Class::Accessor::Fast );
use AnyEvent::Groonga::Result::Select;
use Data::Dumper;
use Encode;

__PACKAGE__->mk_accessors($_) for qw( data posted_command );

sub new {
    my $class = shift;
    my $self = $class->SUPER::new( {@_} );
    if ( $self->posted_command and ( $self->posted_command eq 'select' ) ) {
        return AnyEvent::Groonga::Result::Select->new( data => $self->data );
    }
    return $self;
}

sub dump {
    my $self = shift;
    {
        no warnings 'redefine';
        local *Data::Dumper::qquote = sub { return shift; };
        local $Data::Dumper::Useperl = 1;

        return encode( "utf8", decode( "utf8", Dumper( $self->data ) ) );
    }
}

sub status {
    my $self   = shift;
    my $status = $self->data->[0]->[0];
    return $status ? 0 : 1;
}



( run in 0.226 second using v1.01-cache-2.11-cpan-4d50c553e7e )