This file is indexed.

/usr/share/perl5/Spoon/Installer.pm is in libspoon-perl 0.24-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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
package Spoon::Installer;
use Spiffy -Base; 
use IO::All;
use Spoon::Base -mixin => qw(hub);

const extract_to => '.';
field quiet => 0;

sub compress_from {
    $self->extract_to;
}

sub extract_files {
    my @files = $self->get_packed_files;
    while (@files) {
        my ($file_name, $file_contents) = splice(@files, 0, 2);
        my $locked = $file_name =~ s/^!//;
        my $file_path = join '/', $self->extract_to, $file_name;
        my $file = io->file($file_path)->assert;
        if ($locked and -f $file_path) {
            warn "  Skipping $file (already exists)\n" unless $self->quiet;
            next;
        }
        my $content = $self->set_file_content($file_path, $file_contents);
        if ($file->exists and $file->all eq $content) {
            warn "  Skipping $file (unchanged)\n" unless $self->quiet;
            next;
        }
        warn "  - $file\n" unless $self->quiet;
        $file->binary if $self->file_is_binary($file_path);
        $file->assert->print($content);
    }
}

sub set_file_content {
    my $path = shift;
    my $content = shift;
    $content = $self->base64_decode($content)
      if $self->file_is_binary($path);
    $content = $self->fix_hashbang($content)
      if $self->file_is_executable($path);
    $content = $self->wrap_html($content, $path)
      if $self->file_is_html($path);
    return $content;
}

sub file_is_binary {
    my $path = shift;
    $path =~ /\.(gif|jpg|png)$/;
}

sub file_is_executable {
    my $path = shift;
    $path =~ /\.(pl|cgi)$/;
}

sub file_is_html {
    my $path = shift;
    $path =~ /\.html$/;
}

sub fix_hashbang {
    require Config;
    my $content = shift;
    $content =~ s/^#!.*\n/$Config::Config{startperl} -w\n/;
    return $content;
}

sub wrap_html {
    my ($content, $path) = @_;
    $path =~ s/^.*\/(.*)$/$1/;
    $path =~ s/\.html$//;
    $content = $self->strip_html($content);
    $content = "<!-- BEGIN $path -->\n$content"
      unless $content =~ /^\s/;
    $content = "$content<!-- END $path -->\n"
      unless $content =~ /\s\n\z/;
    return $content;
}

sub get_packed_files {
    my %seen;
    my @return;
    for my $class (@{Spiffy::all_my_bases(ref $self)}) {
        next if $class =~ /-/;
        last if $class =~ /^Spoon/;
        my $data = $self->data($class)
          or next;
        my @files = split /^__(.+)__\n/m, $data;
        shift @files;
        while (@files) {
            my ($name, $content) = splice(@files, 0, 2);
            $name = $self->resolve_install_path($name)
              if $self->can('resolve_install_path');
            my $name2 = $name;
            $name2 =~ s/^\!//;
            next if $seen{$name2}++;
            $content ||= '';
            push @return, $name, $content
              if length $content;
        }
    }
    return @return;
}

sub get_local_packed_files {
    my @return;
    my $class = ref $self;
    my $data = $self->data($class)
      or return;
    my @files = split /^__(.+)__\n/m, $data;
    shift @files;
    while (@files) {
        my ($name, $content) = splice(@files, 0, 2);
        $name = $self->resolve_install_path($name)
          if $self->can('resolve_install_path');
        push @return, $name, $content;
    }
    return @return;
}

sub data {
    my $package = shift || ref($self);
    local $SIG{__WARN__} = sub {};
    local $/;
    eval "package $package; <DATA>";
}

sub compress_files {
    require File::Spec;
    my $source_dir = shift;
    my $new_pack = '';
    my @files = $self->get_local_packed_files;
    my $first_file = $files[0]
      or return;
    my $directory = $self->compress_from;
    while (@files) {
        my ($file_name, $file_contents) = splice(@files, 0, 2);
        my $locked = $file_name =~ s/^!// ? '!' : '';
        my $source_path = 
          File::Spec->canonpath("$source_dir/$directory/$file_name");
        die "$file_name does not exist as $source_path" 
          unless -f $source_path;
        my $content = $locked 
        ? $file_contents
        : $self->get_file_content($source_path);
        $content =~ s/\r\n/\n/g;
        $content =~ s/\r/\n/g;
        $new_pack .= "__$locked${file_name}__\n$content";
    }
    my $module = ref($self) . '.pm';
    $module =~ s/::/\//g;
    my $module_path = $INC{$module} or die;
    my $module_text = io($module_path)->all;
    my ($module_code) = split /^__\Q$first_file\E__\n/m, $module_text;
    ($module_code . $new_pack) > io($module_path);
}

sub get_file_content {
    my $path = shift;
    my $content = io($path)->all;
    $content = $self->base64_encode($content)
      if $self->file_is_binary($path);
    $content = $self->unfix_hashbang($content)
      if $self->file_is_executable($path);
    $content = $self->strip_html($content)
      if $self->file_is_html($path);
    $content .= "\n"
      unless $content =~ /\n\z/;
    return $content;
}

sub unfix_hashbang {
    my $content = shift;
    $content =~ s/^#!.*\n/#!\/usr\/bin\/perl\n/;
    return $content;
}

sub strip_html {
    my $content = shift;
    $content =~ s/^<!-- BEGIN .* -->\n//;
    $content =~ s/(?<=\n)<!-- END .* -->\n\z//;
    return $content;
}

sub compress_lib {
    die "Must be run from the module source code directory\n"
      unless -d 'lib' and -f 'Makefile.PL';
    unshift @INC,'lib';
    my $source_dir = shift
      or die "No source directory specified\n";
    die "Invalid source directory '$source_dir'\n"
      unless -d $source_dir;
    map {
        my $class_name = $_;
        my $class_id = $class_name->class_id;
        $self->hub->config->add_config(
            +{ "${class_id}_class" => $class_name }
        );
        warn "Compressing $class_name\n" unless $self->quiet;
        $self->hub->$class_id->compress_files($source_dir);
    }
    grep {
        my $name = $_;
        eval "require $name";
        die $@ if $@;
        UNIVERSAL::can($name, 'compress_files')
          and $name !~ /::(Installer)$/;
    } map {
        my $name = $_->name;
        ($name =~ s/^lib\/(.*)\.pm$/$1/) ? do {
            $name =~ s/\//::/g;
            $name;
        } : ();
    } io('lib')->All_Files;
}

__END__

=head1 NAME 

Spoon::Installer - Spoon Installer Class

=head1 SYNOPSIS

=head1 DESCRIPTION

=head1 AUTHOR

Brian Ingerson <INGY@cpan.org>

=head1 COPYRIGHT

Copyright (c) 2004. Brian Ingerson. All rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See http://www.perl.com/perl/misc/Artistic.html

=cut