FP::Struct::Show
package FP_Struct_Show_Example::Foo { use FP::Struct ["a","b"], 'FP::Struct::Show'; _END_ } FP_Struct_Show_Example::Foo::constructors->import; use FP::Show; is( show(Foo(1,1+1)), "Foo(1, 2)" ); # Whereas the default: package FP_Struct_Show_Example::Bar { use FP::Struct ["a","b"]; _END_ } FP_Struct_Show_Example::Bar::constructors->import; use FP::Show; is( show(Bar(1, 2)), "bless(+{a => 1, b => 2}, 'FP_Struct_Show_Example::Bar')" );
This class simply provides an `FP_Show_show` method that uses inspection specific to FP::Struct classes to get to know the public field values of the object it is being called on, and reconstructs a constructor call based on this information. Meaning, for the typical `FP::Struct` based class, it will do the right thing.
This is alpha software! Read the status section in the package README or on the website.
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.