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

Emmanuel Di Pretoro edipretoro at gmail.com
Mon Apr 4 17:24:21 CEST 2016


Hi,

Thanks a lot for the quick answer and the explanation.

Have a nice day!

Emmanuel

2016-04-04 15:44 GMT+02:00 Voß, Jakob <Jakob.Voss at gbv.de>:

> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.uni-bielefeld.de/mailman2/unibi/public/librecat-dev/attachments/20160404/e501031c/attachment.html>


More information about the librecat-dev mailing list