The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

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

SYNOPSYS

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

  my @result = $r->values;

DESCRIPTION

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

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

Takaaki Mizuno <cpan@takaaki.info>

Nobuo Danjou <nobuo.danjou@gmail.com>

SEE ALSO

App::Hachero

App::Hachero::Result::Data