use base 'Class::MOP::Attribute';
+sub method_metaclasses {
+ return {
+ %{ shift->SUPER::method_metaclasses },
+ history_accessor => 'AttributesWithHistory::Method::AccessorWithHistory',
+ accessor => 'AttributesWithHistory::Method::Accessor',
+ writer => 'AttributesWithHistory::Method::Writer',
+ };
+}
+
# this is for an extra attribute constructor
# option, which is to be able to create a
# way for the class to access the history
});
package # hide the package from PAUSE
- AttributesWithHistory::Method::Accessor;
+ AttributesWithHistory::Method::AccessorWithHistory;
use strict;
use warnings;
# generate the methods
-sub _generate_history_accessor_method {
+sub _generate_method {
my $attr_name = (shift)->associated_attribute->name;
eval qq{sub {
unless (ref \$_[0]->meta->get_attribute('$attr_name')->_history()->\{\$_[0]\}) \{
}};
}
-sub _generate_accessor_method {
+package # hide the package from PAUSE
+ AttributesWithHistory::Method::Accessor;
+
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+use base 'Class::MOP::Method::Accessor';
+
+sub _generate_method {
my $attr_name = (shift)->associated_attribute->name;
eval qq{sub {
if (scalar(\@_) == 2) {
}};
}
-sub _generate_writer_method {
+package # hide the package from PAUSE
+ AttributesWithHistory::Method::Writer;
+
+use strict;
+use warnings;
+
+our $VERSION = 0.01;
+
+use base 'Class::MOP::Method::Writer';
+
+sub _generate_method {
my $attr_name = (shift)->associated_attribute->name;
eval qq{sub {
unless (ref \$_[0]->meta->get_attribute('$attr_name')->_history()->\{\$_[0]\}) \{