This file is indexed.

/usr/share/perl5/Catalyst/Controller/SRU.pm is in libsru-perl 1.01-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
122
123
124
125
126
127
128
129
130
131
132
133
package Catalyst::Controller::SRU;
{
  $Catalyst::Controller::SRU::VERSION = '1.01';
}
#ABSTRACT: Dispatch SRU methods with Catalyst

use strict;
use warnings;


use base qw( Catalyst::Controller );

use SRU::Request;
use SRU::Response;
use SRU::Response::Diagnostic;
use CQL::Parser 1.12;

sub index : Private {
    my( $self, $c ) = @_;

    my $sru_request  = SRU::Request->newFromURI( $c->req->uri );
    my $sru_response = SRU::Response->newFromRequest( $sru_request );
    my @args         = ( $sru_request, $sru_response );

    my $cql;
    my $mode = $sru_request->type;
    if ( $mode eq 'scan' ) {
        $cql = $sru_request->scanClause;
    }
    elsif ( $mode eq 'searchRetrieve' ) {
        $cql = $sru_request->query;
    }

    if( defined $cql ) {
        $cql = CQL::Parser->new->parseSafe( $cql );
        push @args, $cql;
        unless ( ref $cql ) {
            $sru_response->addDiagnostic( SRU::Response::Diagnostic->newFromCode( $cql ) );
        }
    }

    if ( my $action = $self->can( $mode ) ) {
        $action->( $self, $c, @args );
    }
    else {
        $sru_response->addDiagnostic( SRU::Response::Diagnostic->newFromCode( 4 ) );
        $c->log->debug( qq(Couldn't find sru method "$mode") ) if $c->debug;
    }

    $c->res->content_type( 'text/xml' );
    $c->res->body( $sru_response->asXML );
};


1;

__END__

=pod

=head1 NAME

Catalyst::Controller::SRU - Dispatch SRU methods with Catalyst

=head1 SYNOPSIS

    package MyApp::Controller::SRU;

    # use it as a base controller
    use base qw( Catalyst::Controller::SRU );
        
    # explain, scan and searchretrieve methods
    sub explain {
        my ( $self, $c,
            $sru_request,  # ISA SRU::Request::Explain
            $sru_response, # ISA SRU::Response::Explain 
        ) = @_;
    }
    
    sub scan {
        my ( $self, $c,
            $sru_request,  # ISA SRU::Request::Scan
            $sru_response, # ISA SRU::Response::Scan
            $cql,          # ISA CQL::Parser root node
        ) = @_;

    }
    
    sub searchRetrieve {
        my ( $self, $c,
            $sru_request,  # ISA SRU::Request::SearchRetrieve
            $sru_response, # ISA SRU::Response::SearchRetrieve
            $cql,          # ISA CQL::Parser root node
        ) = @_;
    }

=head1 DESCRIPTION

This module allows your controller class to dispatch SRU actions
(C<explain>, C<scan>, and C<searchRetrieve>) from its own class.

=head1 METHODS

=head2 index : Private

This method will create an SRU request, response and possibly a CQL object based on the
type of SRU request it finds. It will then pass the data over to your customized method.

=cut

=head1 SEE ALSO

=over 4

=item * L<Catalyst>

=item * L<SRU>

=back

=head1 AUTHORS

Brian Cassidy <bricas@cpan.org>

=cut
=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Ed Summers.

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

=cut