Perinci::Sub::Wrapper::Patch::HandlePHPArray - Convert {} to [] or vice versa to match functions' expectations
version 0.02
use Perinci::Sub::Wrapper::HandlePHPArray;
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.
{}
[]
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).
deconfuse_php_clients
Please visit the project's homepage at https://metacpan.org/release/Perinci-Sub-Wrapper-Patch-HandlePHPArray.
Source repository is at https://github.com/sharyanto/perl-Perinci-Sub-Wrapper-Patch-HandlePHPArray.
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.
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2014 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Perinci::Sub::Wrapper::Patch::HandlePHPArray, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perinci::Sub::Wrapper::Patch::HandlePHPArray
CPAN shell
perl -MCPAN -e shell install Perinci::Sub::Wrapper::Patch::HandlePHPArray
For more information on module installation, please visit the detailed CPAN module installation guide.