[librecat-dev] Questions about the behavior of perlcode in Fix

Voß, Jakob Jakob.Voss at gbv.de
Mon Apr 4 15:44:12 CEST 2016


Hi Emmanuel,

Thanks for pointing to the error in our documentation. I created an issue to fix this:

https://github.com/LibreCat/Catmandu/issues/230

You wrote:

> sub {
>    my ( $data ) = @_;
>    foreach my $key (keys %$data) {
>      $data->{ $data->{$key } } = $key;
>      delete $data->{$key};
>    }
>    return 3; # <- return a constant
> }
> 
> And so, I understood that the returned value is apparently not used by Catmandu. And the first argument is in fact a reference.
> 
> I guess it’s a feature and not a bug, but can anybody confirm it is the right behavior?

Yes almost: you get a reference of the data to modify and an optional special value $reject. The return value is only checked whether it is equal to $reject or not.

Jakob


More information about the librecat-dev mailing list