our $VERSION = '0.001000';
- use aliased 'IronMunger::Monger';
use aliased 'IronMunger::PlaggerLoader';
use aliased 'IronMunger::StatsSaver';
+ use aliased 'IronMunger::Monger';
use MooseX::Types::Moose qw(HashRef ClassName Str);
- use namespace::autoclean;
-
has mongers => (
is => 'ro', isa => HashRef[Monger], required => 1,
default => sub { {} },
my $loader = PlaggerLoader->new(dir => $dir);
my $munger = $class->new;
$munger->mongers->{$_->full_name}
- = $_ for @{$loader->mongers};
+ = $_ for $loader->mongers;
+ return $munger;
}
method save_monger_stats (Str $dir) {
my $saver = StatsSaver->new(dir => $dir);
- $saver->mongers([ sort $_->full_name, values %{$self->mongers} ]);
+ $saver->mongers([
+ sort { $a->full_name cmp $b->full_name }
+ values %{$self->mongers}
+ ]);
}
}
has name => (is => 'ro', isa => Str, required => 0, predicate => 'has_name');
has nick => (is => 'ro', isa => Str, required => 0, predicate => 'has_nick');
+ method full_name () {
+ join(' aka ',$self->name||'nameless',$self->nick||'anoncow');
+ }
+
has posts => (
is => 'ro', isa => ArrayRef[Post], required => 1,
default => sub { [] },
use IO::All;
use File::Path qw(mkpath);
use Text::CSV_XS;
- use namespace::autoclean;
has dir => (is => 'ro', isa => Dir, required => 1, coerce => 1);
--- /dev/null
+use strict;
+use warnings;
+use Test::More qw(no_plan);
+use File::Temp 'tempdir';
+
+BEGIN {
+ use_ok "IronMunger";
+}
+
+my $munger = IronMunger->load_from_plagger('t/csv');
+
+$munger->save_monger_stats('whut');