19 Feb 2020 15:34:56 UTC
- Distribution: MooX-XSConstructor
- Module version: 0.002
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (354 / 7 / 0)
- KwaliteeBus factor: 1
- 76.64% Coverage
- License: perl_5
- Perl: v5.8.1
- Activity24 month
- Download (14.31KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE userTOBYINK Toby Inkster
MooX::XSConstructor - glue between Moo and Class::XSConstructor
package Foo; use Moo; use MooX::XSConstructor; # do normal Moo stuff here
MooX::XSConstructor will look at your class attributes, and see if it could be built using the simple constructor that Class::XSConstructor is able to provide.
If your class is too complicated, it is a no-op.
If your class is simple enough, you will hopefully get a faster constructor.
Things that are deemed too complicated if they appear in any attributes (even an inherited one):
Eager builders and defaults. (Lazy builders and defaults are fine.)
Type constraints. (Except Type::Tiny, which is fine.)
Also if your class has a
FOREIGNBUIDARGSmethod, it will be too complicated. (The default
BUILDARGSinherited from Moo::Object is fine.)
So what Moo features are okay?
Required versus optional attributes, Type::Tiny type constraints (but not coercions), reader/writer/predicate/clearer, lazy defaults/builders, and delegation (
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooX-XSConstructor.
You may also be interested in Class::XSAccessor. Moo already includes all the glue to interface with that, so a MooX module like this one isn't necessary.
Toby Inkster <firstname.lastname@example.org>.
This software is copyright (c) 2018 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Module Install Instructions
To install MooX::XSConstructor, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install MooX::XSConstructor
For more information on module installation, please visit the detailed CPAN module installation guide.