/usr/share/perl5/Net/Google/Code/Wiki.pm is in libnet-google-code-perl 0.19-2.
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | package Net::Google::Code::Wiki;
use Any::Moose;
use Params::Validate qw(:all);
with 'Net::Google::Code::TypicalRoles';
has 'project' => (
isa => 'Str',
is => 'rw',
);
has 'name' => (
isa => 'Str',
is => 'rw',
);
has 'source' => (
isa => 'Str',
is => 'rw',
);
has 'content' => (
isa => 'Str',
is => 'rw',
);
has 'updated' => (
isa => 'Str',
is => 'rw',
);
has 'updated_by' => (
isa => 'Str',
is => 'rw',
);
has 'labels' => (
isa => 'ArrayRef[Str]',
is => 'rw',
);
has 'summary' => (
isa => 'Str',
is => 'rw',
);
has 'comments' => (
isa => 'ArrayRef[Net::Google::Code::Wiki::Comment]',
is => 'rw',
);
sub load_source {
my $self = shift;
die "current object doesn't have name" unless $self->name;
my $source =
$self->fetch( $self->base_svn_url . 'wiki/' . $self->name . '.wiki' );
$self->source($source);
return $self->parse_source;
}
sub parse_source {
my $self = shift;
my @meta = grep { /^#/ } split /\n/, $self->source;
for my $meta (@meta) {
chomp $meta;
if ( $meta =~ /summary\s+(.*)/ ) {
$self->summary($1);
}
elsif ( $meta =~ /labels\s+(.*)/ ) {
my @labels = split /,\s*/, $1;
$self->labels( \@labels );
}
}
}
sub load {
my $self = shift;
my $name = shift || $self->name;
die "current object doesn't have name and load() is not passed a name either"
unless $name;
# http://code.google.com/p/net-google-code/wiki/TestPage
my $content = $self->fetch( $self->base_url . 'wiki/' . $name );
$self->name($name) unless $self->name && $self->name eq $name;
$self->load_source;
return $self->parse($content);
}
sub parse {
my $self = shift;
my $tree = shift;
$tree = $self->html_tree( html => $tree ) unless blessed $tree;
my $wiki = $tree->look_down( id => 'wikimaincol' );
my $updated =
$wiki->find_by_tag_name('td')->find_by_tag_name('span')->attr('title');
my $updated_by =
$wiki->find_by_tag_name('td')->find_by_tag_name('a')->as_text;
$self->updated($updated) if $updated;
$self->updated_by($updated_by) if $updated_by;
$self->content( $tree->content_array_ref->[-1]->as_HTML );
my @comments = ();
my @comments_element = $tree->look_down( class => 'artifactcomment' );
for my $element (@comments_element) {
next unless $element->look_down( class => 'commentcontent' );
require Net::Google::Code::Wiki::Comment;
my $comment = Net::Google::Code::Wiki::Comment->new;
$comment->parse($element);
push @comments, $comment;
}
$self->comments( \@comments );
$tree->delete;
return 1;
}
no Any::Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=head1 NAME
Net::Google::Code::Wiki - Google Code Wiki
=head1 SYNOPSIS
use Net::Google::Code::Wiki;
my $wiki = Net::Google::Code::Wiki->new(
project => 'net-google-code',
name => 'TestPage',
);
$wiki->load;
$wiki_entry->source;
=head1 INTERFACE
=over 4
=item load
=item parse
=item load_source
=item parse_source
=item project
=item name
=item source
=item summary
=item labels
=item content
=item updated_by
=item updated
=item comments
=back
=head1 AUTHOR
sunnavy C<< <sunnavy@bestpractical.com> >>
=head1 LICENCE AND COPYRIGHT
Copyright 2008-2010 Best Practical Solutions.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
|