App::Hachero::Result - represents a series of result of App::Hachero


App-Hachero documentation  | view source Contained in the App-Hachero distribution.

Index


NAME

Top

App::Hachero::Result - represents a series of result of App::Hachero

SYNOPSYS

Top

  my $r = App::Hachero::Result->new;
  $r->push(
    {
        'some_key' => 'some_value',
        'another_key' => 'another_value',
    }
  );

  my @result = $r->values;

DESCRIPTION

Top

A class to store analyzed data from Hachero. You can override this result class in your analyze plugin class like this:

  package App::Hachero::Plugin::Analyze::MyAnalyzer;
  use base 'App::Hachero::Plugin::Base';

  sub analyze : Hook {
      my ($self, $context) = @_;
      $context->result->{MyAnalyzer} = App::Hachero::Result::MyAnalyzer->new;
      $context->result->{MyAnalizer}->push(
        {
            mykey => 'hoo',
        }
      );
  }

  package App::Hachero::Result::MyAnalyzer;
  use base 'App::Hachero::Result';
  __PACKAGE__->mk_classdata('primary' => [qw(mykey)]);

  1;

You need to specify 'primary' arrayref classdata in your subclass.

METHODS

Top

new

constructor.

push($hashref)

pushes new data hashref to the result and counts up the data.

values

returns data array of this result.

sort

sorts data array for values method. you can override this method for your result class.

key($data) (internal use only)

returns md5_hex key for the result data.

AUTHOR

Top

Takaaki Mizuno <cpan@takaaki.info>

Nobuo Danjou <nobuo.danjou@gmail.com>

SEE ALSO

Top

App::Hachero

App::Hachero::Result::Data


App-Hachero documentation  | view source Contained in the App-Hachero distribution.