X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=Debbugs%2FCollection.pm;h=cbfd56b31eb8dbb283fdcefbabe1f5372c8e8e1a;hb=78d0e4e290ccf88f7a7c968ffb2527ad7f6b9463;hp=c1faa6f6804c745d02649072d9e94b520ccc26d5;hpb=c0375a86e3710174d12844848b99ffcf81ecd816;p=debbugs.git diff --git a/Debbugs/Collection.pm b/Debbugs/Collection.pm index c1faa6f..cbfd56b 100644 --- a/Debbugs/Collection.pm +++ b/Debbugs/Collection.pm @@ -22,6 +22,7 @@ Debbugs::Collection -- Collection base class which can generate lots of objects use Mouse; use strictures 2; use namespace::autoclean; +use List::AllUtils qw(pairmap); extends 'Debbugs::OOBase'; @@ -161,9 +162,14 @@ sub get_or_create { has 'constructor_args' => (is => 'rw', isa => 'ArrayRef', - default => sub {[]}, + lazy => 1, + builder => '_build_constructor_args', ); +sub _build_constructor_args { + return []; +} + sub add_by_key { my $self = shift; # we'll assume that add does the right thing. around this in subclasses