https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28883

--- Comment #7 from Marcel de Rooy <[email protected]> ---
Seems to work as it is, but I am just wondering if we should force scalar
context within the map statement of _wrap ?
To prevent perl one day (another version etc) guessing list context and
creating an nice endless loop.
So making it:
my @objects = map { scalar $self->object_class->_new_from_dbic( $_ ) } etc

Instead of:

 sub _new_from_dbic {
     my ( $class, $resultset ) = @_;
+    if ( wantarray ) {
+        return $class->_wrap( $resultset->all() );
+    }
     my $self = { _resultset => $resultset };
     bless( $self, $class );
[..]

sub _wrap {
    my ( $self, @dbic_rows ) = @_;
    my @objects = map { $self->object_class->_new_from_dbic( $_ ) } @dbic_rows;
    return @objects;
}

Adding an optional follow-up for it too. Please let me know what you think.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to