/usr/share/perl5/MDOM/Rule/Simple.pm is in libmakefile-dom-perl 0.008-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | package MDOM::Rule::Simple;
use strict;
use warnings;
#use Smart::Comments;
use base 'MDOM::Rule';
use MDOM::Util qw( trim_tokens );
sub targets {
my ($self) = @_;
$self->_parse if !$self->{colon};
my $tokens = $self->{targets};
wantarray ? @$tokens : $tokens;
}
sub normal_prereqs {
my ($self) = @_;
$self->_parse if !$self->{colon};
my $tokens = $self->{normal_prereqs};
wantarray ? @$tokens : $tokens;
}
sub order_prereqs {
my ($self) = @_;
$self->_parse if !$self->{colon};
my $tokens = $self->{order_prereqs};
wantarray ? @$tokens : $tokens;
}
sub colon {
my ($self) = @_;
$self->_parse if !$self->{colon};
$self->{colon};
}
sub command {
my ($self) = @_;
$self->_parse if !$self->{colon};
$self->{command};
}
sub _parse {
my ($self) = @_;
my @elems = $self->elements;
my (@targets, $colon, @normal_prereqs, @order_prereqs, $command);
my $prereqs = \@normal_prereqs;
## @elems
for my $elem (@elems) {
if (!$colon) {
if ($elem->class eq 'MDOM::Token::Separator') {
$colon = $elem->content;
} else {
push @targets, $elem;
}
} elsif ($elem->class eq 'MDOM::Token::Comment') {
last;
} elsif ($elem->class eq 'MDOM::Command') {
$command = $elem;
last;
} elsif ($elem->class eq 'MDOM::Token::Bare' and
$elem->content eq '|') {
$prereqs = \@order_prereqs;
} else {
push @$prereqs, $elem;
}
}
trim_tokens(\@targets);
trim_tokens(\@normal_prereqs);
trim_tokens(\@order_prereqs);
$self->{targets} = \@targets;
$self->{colon} = $colon;
$self->{normal_prereqs} = \@normal_prereqs;
$self->{order_prereqs} = \@order_prereqs;
$self->{command} = $command;
### $self
}
1;
__END__
=encoding utf-8
=head1 NAME
MDOM::Rule::Simple - DOM simple rule node for Makefiles
=head1 DESCRIPTION
A simple rule node.
=head2 Accessors
=over 4
=item colon
=item command
=item normal_prereqs
=item order_prereqs
=item targets
=back
=head1 AUTHOR
Yichun "agentzh" Zhang (章亦春) E<lt>agentzh@gmail.comE<gt>
=head1 COPYRIGHT
Copyright 2006-2014 by Yichun "agentzh" Zhang (章亦春).
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SEE ALSO
L<MDOM::Document>, L<MDOM::Document::Gmake>, L<PPI>, L<Makefile::Parser::GmakeDB>, L<makesimple>.
|