This file is indexed.

/usr/share/perl5/ExtUtils/XSpp/Driver.pm is in libextutils-xspp-perl 0.1800-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
package ExtUtils::XSpp::Driver;

use strict;
use warnings;

use File::Basename ();
use File::Path ();

use ExtUtils::XSpp::Parser;

sub new {
    my( $class, %args ) = @_;
    my $self = bless \%args, $class;

    return $self;
}

sub generate {
    my( $self ) = @_;

    foreach my $typemap ( $self->typemaps ) {
        ExtUtils::XSpp::Parser->new( file => $typemap )->parse;
    }

    my $parser = ExtUtils::XSpp::Parser->new( file   => $self->file,
                                              string => $self->string,
                                              );
    my $success = $parser->parse;
    return() if not $success;
    my $generated = $self->_emit( $parser );

    my $typemap_code = ExtUtils::XSpp::Typemap::get_xs_typemap_code_for_all_typemaps();
    if (defined $typemap_code && $typemap_code =~ /\S/) {
        if (exists $generated->{'-'} and $generated->{'-'} ne '') {
            $generated->{'-'} = $typemap_code . $generated->{'-'};
        }
        elsif (my @files = grep !/^-$/, keys %$generated) {
            $generated->{$files[0]} = $typemap_code . ($generated->{$files[0]}||'');
        }
        else {
            $generated->{'-'} = $typemap_code . ($generated->{'-'}||'');
        }
    }

    return $generated;
}

sub process {
    my( $self ) = @_;

    my $generated = $self->generate;
    return () if not $generated;
    return $self->_write( $generated );
}

sub _write {
    my( $self, $out ) = @_;

    foreach my $f ( keys %$out ) {
        if( $f eq '-' ) {
            if( $self->xsubpp ) {
                require IPC::Open2;

                my $cmd = $self->xsubpp . ' ' . ( $self->xsubpp_args || '' )
                          . ' -';
                my $pid = IPC::Open2::open2( '>&STDOUT', my $fh, $cmd );

                print $fh $$out{$f} or die "Error writing to xsubpp: $!";
                close $fh or die "Error writing to xsubpp: $!";
                waitpid( $pid, 0 );
                my $exit_code = $? >> 8;

                return 0 if $exit_code;
            } else {
                print $$out{$f} or die "Error writing output";
            }
        } else {
            File::Path::mkpath( File::Basename::dirname( $f ) );

            open my $fh, '>', $f or die "open '$f': $!";
            binmode $fh;
            print $fh $$out{$f} or die "Error writing to '$f': $!";
            close $fh or die "close '$f': $!";
        }
    }

    return 1;
}

sub _emit {
    my( $self, $parser ) = @_;
    my $data = $parser->get_data;
    my %out;
    my $out_file = '-';
    my %state = ( current_module => undef );

    foreach my $plugin ( @{$parser->post_process_plugins} ) {
        my $method = $plugin->{method};

        $plugin->{plugin}->$method( $data );
    }

    $out{'-'} = preamble();
    foreach my $e ( @$data ) {
        if( $e->isa( 'ExtUtils::XSpp::Node::Module' ) ) {
            $state{current_module} = $e;
        }
        if( $e->isa( 'ExtUtils::XSpp::Node::File' ) ) {
            $out_file = $e->file;
            $out{$out_file} ||= preamble();
        }
        $out{$out_file} .= $e->print( \%state );
    }

    return \%out;
}

sub preamble {
  return <<EOT
#include <exception>
#undef  xsp_constructor_class
#define xsp_constructor_class(c) (c)


EOT
}

sub typemaps { @{$_[0]->{typemaps} || []} }
sub file     { $_[0]->{file} }
sub string   { $_[0]->{string} }
sub output   { $_[0]->{output} }
sub xsubpp   { $_[0]->{xsubpp} }
sub xsubpp_args { $_[0]->{xsubpp_args} }

1;