/[Frey]/trunk/lib/Frey/PPI.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/PPI.pm

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

revision 361 by dpavlin, Sat Nov 8 16:12:39 2008 UTC revision 362 by dpavlin, Sun Nov 16 17:39:39 2008 UTC
# Line 13  has 'class' => ( Line 13  has 'class' => (
13          documentation => 'Name of class to parse',          documentation => 'Name of class to parse',
14  );  );
15    
16  sub attribute_order {  my $ppi_doc;
17    
18    sub doc {
19          my ( $self ) = @_;          my ( $self ) = @_;
20    
21          my $doc = PPI::Document->new( $self->class_path( $self->class ) ) || die $!;          if ( ! $ppi_doc ) {
22                    warn "# parse ", $self->class;
23                    my $doc = PPI::Document->new( $self->class_path( $self->class ) ) || die $!;
24                    $doc->prune('PPI::Token::Whitespace');
25                    $ppi_doc = $doc;
26            }
27            return $ppi_doc;
28    }
29    
30    sub attribute_order {
31            my ( $self ) = @_;
32    
33          $doc->prune('PPI::Token::Whitespace');          my $doc = $self->doc;
34    
35          my @attribute_order;          my @attribute_order;
36    
# Line 38  sub attribute_order { Line 50  sub attribute_order {
50    
51  sub data {  sub data {
52          my $self = shift;          my $self = shift;
53          [ $self->attribute_order ];          my $doc = $self->doc;
54            my $include;
55            $doc->find( sub {
56                    my ($doc,$el) = @_;
57                    if ( $el->isa('PPI::Statement::Include') ) {
58                            warn dump( $el->module, $el->type, $el->pragma );
59                            push @{ $include->{ $el->type } }, $el->module
60                    }
61                    return 1;
62            });
63            warn "# ", $self->class, " ", dump( $include ) if $self->debug;
64    
65            return {
66                    include => $include,
67                    doc => $doc,
68            };
69  }  }
70    
71  1;  1;

Legend:
Removed from v.361  
changed lines
  Added in v.362

  ViewVC Help
Powered by ViewVC 1.1.26