Name : perl-MooseX-SingleArg
| |
Version : 0.09
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.48
| Date : 2024-08-05 20:44:19
|
Group : Development/Libraries/Perl
| Source RPM : perl-MooseX-SingleArg-0.09-1.48.src.rpm
|
Size : 0.03 MB
| |
Packager : (none)
| |
Summary : No-fuss instantiation of Moose objects using a single argument
|
Description :
This module allows Moose instances to be constructed with a single argument. Your class or role must use this module and then use the single_arg sugar to declare which attribute will be assigned the single argument value.
If the class is constructed using the typical argument list name/value pairs, or with a hashref, then things work as is usual. But, if the arguments are a single non-hashref value then that argument will be assigned to whatever attribute you have declared.
The reason for this module\'s existence is that when people want this feature they usually find Moose::Cookbook::Basics::Person_BUILDARGSAndBUILD which asks that something like the following be written:
around BUILDARGS => sub { my $orig = shift; my $class = shift;
if ( AATT_ == 1 && ! ref $_[0] ) { return $class->$orig(ssn => $_[0]); } else { return $class->$orig(AATT_); } };
The above is complex boilerplate for a simple feature. This module aims to make it simple and fool-proof to support single-argument Moose object construction.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-M/openSUSE_Tumbleweed/noarch |