summaryrefslogtreecommitdiff
path: root/lib/Moose/Meta/Method/Accessor/Native/Bool
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /lib/Moose/Meta/Method/Accessor/Native/Bool
downloadMoose-tarball-master.tar.gz
Diffstat (limited to 'lib/Moose/Meta/Method/Accessor/Native/Bool')
-rw-r--r--lib/Moose/Meta/Method/Accessor/Native/Bool/not.pm20
-rw-r--r--lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm24
-rw-r--r--lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm29
-rw-r--r--lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm24
4 files changed, 97 insertions, 0 deletions
diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/not.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/not.pm
new file mode 100644
index 0000000..60eb646
--- /dev/null
+++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/not.pm
@@ -0,0 +1,20 @@
+package Moose::Meta::Method::Accessor::Native::Bool::not;
+our $VERSION = '2.1405';
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Reader';
+
+sub _maximum_arguments { 0 }
+
+sub _return_value {
+ my $self = shift;
+ my ($slot_access) = @_;
+
+ return '!' . $slot_access;
+}
+
+1;
diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm
new file mode 100644
index 0000000..725da20
--- /dev/null
+++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/set.pm
@@ -0,0 +1,24 @@
+package Moose::Meta::Method::Accessor::Native::Bool::set;
+our $VERSION = '2.1405';
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _maximum_arguments { 0 }
+
+sub _potential_value { 1 }
+
+sub _inline_optimized_set_new_value {
+ my $self = shift;
+ my ($inv, $new, $slot_access) = @_;
+
+ return $slot_access . ' = 1;';
+}
+
+no Moose::Role;
+
+1;
diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm
new file mode 100644
index 0000000..663b1a2
--- /dev/null
+++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/toggle.pm
@@ -0,0 +1,29 @@
+package Moose::Meta::Method::Accessor::Native::Bool::toggle;
+our $VERSION = '2.1405';
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _maximum_arguments { 0 }
+
+sub _potential_value {
+ my $self = shift;
+ my ($slot_access) = @_;
+
+ return $slot_access . ' ? 0 : 1';
+}
+
+sub _inline_optimized_set_new_value {
+ my $self = shift;
+ my ($inv, $new, $slot_access) = @_;
+
+ return $slot_access . ' = ' . $slot_access . ' ? 0 : 1;';
+}
+
+no Moose::Role;
+
+1;
diff --git a/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm b/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm
new file mode 100644
index 0000000..6c5c62b
--- /dev/null
+++ b/lib/Moose/Meta/Method/Accessor/Native/Bool/unset.pm
@@ -0,0 +1,24 @@
+package Moose::Meta::Method::Accessor::Native::Bool::unset;
+our $VERSION = '2.1405';
+
+use strict;
+use warnings;
+
+use Moose::Role;
+
+with 'Moose::Meta::Method::Accessor::Native::Writer';
+
+sub _maximum_arguments { 0 }
+
+sub _potential_value { 0 }
+
+sub _inline_optimized_set_new_value {
+ my $self = shift;
+ my ($inv, $new, $slot_access) = @_;
+
+ return $slot_access . ' = 0;';
+}
+
+no Moose::Role;
+
+1;