/[Frey]/trunk/lib/Frey/ClassLoader.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/ClassLoader.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 382 by dpavlin, Mon Nov 17 19:21:06 2008 UTC revision 411 by dpavlin, Tue Nov 18 14:01:20 2008 UTC
# Line 57  sub class_path { Line 57  sub class_path {
57                  $path .= '.pm';                  $path .= '.pm';
58                  $path = $INC{$path};                  $path = $INC{$path};
59                  warn "# $class from INC $path";                  warn "# $class from INC $path";
60                  $class_path->{$class} = $path;                  $class_path->{$class} = $path || confess "can't find path for $class";
61          }          }
62          return $class_path->{$class};          return $class_path->{$class};
63  }  }
# Line 124  sub load_all_classes { Line 124  sub load_all_classes {
124          $loaded_class;          $loaded_class;
125  }  }
126    
127    =head2 class_methods
128    
129      my @all_methods = $o->class_methods( $class );
130    
131      my $class_method = $o->class_methods( $class );
132      if ( $class_method->{ $method } ) {
133            # $class has $method
134      }
135    
136    =cut
137    
138    sub class_methods {
139            my ( $self, $class ) = @_;
140    
141            confess "need class" unless $class;
142            if ( ! $class->can('meta') ) {
143                    warn "$class doesn't have meta (isn't Moose class)" if $self->debug;
144                    return;
145            }
146            my $meta = $class->meta;
147    
148            my $attr;
149            my $methods;
150            $attr->{$_}++ foreach $meta->get_attribute_list;
151            my @methods = map { $methods->{$_}++; $_ } grep { ! defined($attr->{$_}) && $_ ne 'meta' } $meta->get_method_list;
152            warn "# methods = ",dump( @methods ) if $self->debug;
153    
154            return @methods if wantarray;
155            return $methods;
156    }
157    
158  1;  1;

Legend:
Removed from v.382  
changed lines
  Added in v.411

  ViewVC Help
Powered by ViewVC 1.1.26