my $comp_class = "${prefix}::${comp}";
eval "use $comp_class"; # If it fails, assume the user fixed it
if ($@) {
- die $@ unless $@ =~ /Can't locate/;
+ $comp_class =~ s/::/\//g;
+ die $@ unless $@ =~ /Can't locate.+$comp_class\.pm\sin\s\@INC/;
+ warn $@ if $@;
}
push(@to_register, [ $comp, $comp_class ]);
}
eval {
# Need to differentiate between scalar/list context to allow for returning
# a list in scalar context to get the size of the list
+
if ($wantarray) {
+ # list context
@return_values = $coderef->(@args);
- } else {
+ } elsif (defined $wantarray) {
+ # scalar context
$return_value = $coderef->(@args);
+ } else {
+ # void context
+ $coderef->(@args);
}
$self->txn_commit;
};
my ($self, $name, $data) = @_;
my $rs = $self->resultset($name);
my @names = @{shift(@$data)};
+ my @created;
foreach my $item (@$data) {
my %create;
@create{@names} = @$item;
- $rs->create(\%create);
+ push(@created, $rs->create(\%create));
}
+ return @created;
}
=head2 throw_exception