|
Just a quickie: Class::Accessor::Fast creates functions for accessing properties - for a property "id" it will create a _id_accessor() and id() function. This patch populates the properties for the class & removes the accessor functions from the functions list.
--- /usr/lib/perl5/site_perl/5.8.5/UML/Class/Simple.pm 2008-07-29 09:21:03.000000000 +0000
+++ Simple_new.pm 2008-07-29 09:20:37.000000000 +0000
@@ -273,6 +273,22 @@
};
my $func = Class::Inspector->functions($pkg);
if ($func and @$func) {
+
+ my %functions = map { $_ => 1 } @$func; # create hash from array
+ my @accessors = grep { /^_.*_accessor$/ } @$func;
+ foreach my $accessor (@accessors) {
+ if ($accessor =~ /^_(.*)_accessor$/ ) {
+ my $property = $1;
+ if (exists $functions{$property}) {
+ delete $functions{$property};
+ delete $functions{"_${property}_accessor"};
+ push @{ $classes[-1]->{properties} }, $property;
+ }
+ }
+ }
+ @{ $classes[-1]->{properties} } = sort @{ $classes[-1]->{properties} };
+ @$func = sort keys(%functions);
+
if ($public_only) {
@$func = grep { /^[^_]/ } @$func;
}
|