This file is indexed.

/usr/lib/perl5/SDLx/Music.pm is in libsdl-perl 2.540-5.

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
package SDLx::Music;
use strict;
use warnings;
use Carp ();
use SDL;
use SDL::Audio;
use SDL::Mixer;
use SDL::Mixer::Music;
use SDL::Mixer::Channels;
use SDL::Mixer::Samples;
use SDL::Mixer::MixChunk;

use Data::Dumper;
use SDLx::Music::Default;
use SDLx::Music::Data;

our $def = bless( {}, "SDLx::Music::Default" );

sub new {
    my $class  = shift;
    my %params = @_;

    my $self = bless {%params}, $class;

    # Initialize Audio
    $self->{freq}      = $self->{freq}      || 44100;
    $self->{format}    = $self->{format}    || SDL::Audio::AUDIO_S16SYS;
    $self->{channels}  = $self->{channels}  || 2;
    $self->{chunksize} = $self->{chunksize} || 4096;

    Carp::croak SDL::get_error()
      if (
        SDL::Mixer::open_audio(
            $self->{freq},     $self->{format},
            $self->{channels}, $self->{chunksize}
        )
      ) != 0;

    #Set up the default

    $self->{default} = bless {}, "SDLx::Music::Default";

    return $self;
}

sub data {
    my $self = shift;
    return if $#_ < 0;
    return $self->{data}->{ $_[0] } if $#_ == 0;

    my %data = @_;

    # loop through keys
    foreach ( keys %data ) {
        my $datum = $data{$_};

        #If SCALAR is Simple
        if ( defined $datum ) {
            my $d = {};
            if ( ref $datum eq 'HASH' ) {
                $d = $datum;
            }
            else {
                $d->{file} = $datum;
            }

            my $play_data = bless( $d, "SDLx::Music::Data" );
            $play_data->{to_load} = 1;
            $self->{data}->{$_} = $play_data;
        }

    }

    return 1;
}

sub clear {
    delete $_[0]->{data};

}

sub default : lvalue {
    my $self = shift;
    if   ( defined $self && ref($self) ) { return $self->{default} }
    else                                 { return $SDLx::Music::def; }

}

sub play {
    my $self      = shift;
    my $play_data = shift;
    my %override  = @_;

    return unless defined $play_data;

    my $volume  = $play_data->{volume}  || $override{volume}  || 50;
    my $fade_in = $play_data->{fade_in} || $override{fade_in} || 0;
    my $loops   = $play_data->{loops}   || $override{loops}   || 1;

    if ( $play_data->{to_load} ) {

        $play_data->{_content} =
          SDL::Mixer::Music::load_MUS( $play_data->{file} );
        $play_data->{to_load} = 0;
    }

    SDL::Mixer::Music::volume_music($volume);

    unless ( SDL::Mixer::Music::playing_music() || $fade_in  ) {
        my $played =
          SDL::Mixer::Music::play_music( $play_data->{_content}, $loops );
        if ( defined $played && $played == -1 ) {
            Carp::carp "Cannot play: " . SDL::get_error() . "\n";
        }
    }
    else {
		my $played =  SDL::Mixer::Music::fade_in_music( $play_data->{_content}, $loops, $fade_in );
		 if ( defined $played && $played == -1 ) {
            Carp::carp "Cannot play: " . SDL::get_error() . "\n";
        }	
    }
    return SDL::Mixer::Music::playing_music();
}

sub load {
    my $self = shift;

    foreach ( keys( %{ $self->{data} } ) ) {
        my $data = $self->{data}->{$_};

        if ( $data->{to_load} ) {
            $data->{_content} = SDL::Mixer::Music::load_MUS( $data->{file} );
            $data->{to_load}  = 0;
        }

    }

}

sub playing {
    return SDL::Mixer::Music::playing_music();
}

1;