NAME

Perinci::Sub::Wrapper::Patch::HandlePHPArray - Convert {} to [] or vice versa to match functions' expectations

VERSION

This document describes version 0.04 of Perinci::Sub::Wrapper::Patch::HandlePHPArray (from Perl distribution Perinci-Sub-Wrapper-Patch-HandlePHPArray), released on 2017-07-10.

SYNOPSIS

use Perinci::Sub::Wrapper::HandlePHPArray;

DESCRIPTION

This module patches Perinci::Sub::Wrapper so the generated function wrapper code can convert argument {} to [] when function expects argument to be an array, or vice versa [] to {} when function expects a hash argument. This can help if function is being called by PHP clients, because in PHP Array() is ambiguous, it can be an empty hash or an empty array.

To make this work, you have to specify schema in your argument specification in your Rinci metadata, and the type must be hash or array.

This is a temporary/stop-gap solution. The more "official" solution is to use Perinci::Access::HTTP::Server which has the deconfuse_php_clients option (by default turned on).

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Perinci-Sub-Wrapper-Patch-HandlePHPArray.

SOURCE

Source repository is at https://github.com/perlancar/perl-Perinci-Sub-Wrapper-Patch-HandlePHPArray.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Sub-Wrapper-Patch-HandlePHPArray

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017, 2015, 2014, 2013 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.