$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
+use Moose::Meta::Method::Accessor::Native::Number::abs;
+use Moose::Meta::Method::Accessor::Native::Number::add;
+use Moose::Meta::Method::Accessor::Native::Number::div;
+use Moose::Meta::Method::Accessor::Native::Number::mod;
+use Moose::Meta::Method::Accessor::Native::Number::mul;
+use Moose::Meta::Method::Accessor::Native::Number::set;
+use Moose::Meta::Method::Accessor::Native::Number::sub;
+
with 'Moose::Meta::Attribute::Native::Trait';
sub _helper_type { 'Num' }
-# NOTE: we don't use the method provider for this module since many of
-# the names of the provided methods would conflict with keywords - SL
-
-has 'method_constructors' => (
- is => 'ro',
- isa => 'HashRef',
- lazy => 1,
- default => sub {
- return +{
- set => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $_[1] ) };
- },
- add => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $reader->( $_[0] ) + $_[1] ) };
- },
- sub => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $reader->( $_[0] ) - $_[1] ) };
- },
- mul => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $reader->( $_[0] ) * $_[1] ) };
- },
- div => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $reader->( $_[0] ) / $_[1] ) };
- },
- mod => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], $reader->( $_[0] ) % $_[1] ) };
- },
- abs => sub {
- my ( $attr, $reader, $writer ) = @_;
- return sub { $writer->( $_[0], abs( $reader->( $_[0] ) ) ) };
- },
- };
- }
-);
-
no Moose::Role;
1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::abs;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {0}
+sub _maximum_arguments {0}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "abs($slot_access);";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access = abs($slot_access)";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::add;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "$slot_access + \$_[0];";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access += \$_[0];";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::div;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "$slot_access / \$_[0];";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access /= \$_[0];";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::mod;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "$slot_access % \$_[0];";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access %= \$_[0];";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::mul;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "$slot_access * \$_[0];";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access *= \$_[0];";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::set;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {'$_[0]'}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access = \$_[0];";
+}
+
+1;
--- /dev/null
+package Moose::Meta::Method::Accessor::Native::Number::sub;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.13';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _minimum_arguments {1}
+sub _maximum_arguments {1}
+
+sub _potential_value {
+ my ( $self, $slot_access ) = @_;
+
+ return "$slot_access - \$_[0];";
+}
+
+sub _inline_optimized_set_new_value {
+ my ( $self, $inv, $new, $slot_access ) = @_;
+
+ return "$slot_access -= \$_[0];";
+}
+
+1;