This file is indexed.

/usr/share/perl5/Autodia/Handler.pm is in autodia 2.14-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
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
################################################################
# AutoDIA - Automatic Dia XML.   (C)Copyright 2001 A Trevena   #
#                                                              #
# AutoDIA comes with ABSOLUTELY NO WARRANTY; see COPYING file  #
# This is free software, and you are welcome to redistribute   #
# it under certain conditions; see COPYING file for details    #
################################################################
package Autodia::Handler;

use strict;

require Exporter;
use vars qw($VERSION @ISA @EXPORT);

@ISA = qw(Exporter);

use Autodia::Diagram;

#---------------------------------------------------------------

#####################
# Constructor Methods

sub new
{
  my $class  = shift();
  my $self   = {};
  my $config = shift;

  bless ($self, ref($class) || $class);
  $self->_initialise($config);

  return $self;
}

#------------------------------------------------------------------------
# Access Methods

=head2 process

parse file(s), takes hashref of configuration, returns no of files processed

=cut 

sub process {
  my $self = shift;
  my %config = %{$self->{Config}};

  my $processed_files = 0;
  my ($ignore_path) = grep { warn "$_" && $config{inputpath} eq $_.'/' } @{$config{directory}};
  foreach my $filename (@{$config{filenames}}) {
    my $current_file = ($ignore_path) ? $filename : $config{inputpath} . $filename ;
    $current_file =~ s|\/+|/|g;
    print "opening $current_file\n" unless ( $config{silent} );
    $self->_reset() if ($config{singlefile});
    $self->_parse_file($current_file)
      or warn "no such file / database - $current_file \n";
    $self->output($current_file) if ($config{singlefile});
    $processed_files++;
  }
  return $processed_files;
}

sub skip {
  my ($self,$object_name) = @_;
  my $skip = 0;
  my $skip_list = $self->{Config}{skip_patterns};
  if (ref $skip_list) {
    foreach my $pattern (@$skip_list) {
      chomp($pattern);
      if ($object_name =~ m/$pattern/) {
	warn "skipping $object_name : matches $pattern\n" unless ($self->{_config}{silent});
	$skip = 1;
	last;
      }
    }
  }
  return $skip;
}


sub output
  {
    my $self    = shift;
    my $alternative_filename = shift;
    my $Diagram = $self->{Diagram};
    my %config = %{$self->{Config}};

    if (defined $alternative_filename ) { 
	foreach my $dir (@{$config{'directory'}}) {
	    $alternative_filename =~ s|^$dir||g;
	}
	$alternative_filename =~ s|\/|-|g;
	$alternative_filename =~ s|^-||;
    }
    

    $Diagram->remove_duplicates;

    # export output
    my $success = 0;
    OUTPUT_TYPE: {
	    if ($config{graphviz}) {
		$self->{Config}{outputfile} = "$alternative_filename.png" if ($config{singlefile});
		$success = $Diagram->export_graphviz(\%config);
		last;
	    }

	    if ($config{springgraph}) {
		$self->{Config}{outputfile} = "$alternative_filename.png" if ($config{singlefile});
		$success = $Diagram->export_springgraph(\%config);
		last;
	    }

	    if ($config{vcg}) {
		$self->{Config}{outputfile} = "$alternative_filename.ps" if ($config{singlefile});
		$success = $Diagram->export_vcg(\%config);
		last;
	    }

	    # default to XML output
	    $self->{Config}{outputfile} = "$alternative_filename.xml" if ($config{singlefile});
	    $success = $Diagram->export_xml(\%config);
	} # end of OUTPUT_TYPE;
    if ($success) {
	warn "written outfile : $config{outputfile} successfully \n";
    } else {
	warn "nothing to output using $config{language} handler - are you sure you set the language correctly ?\n";
    }
    return 1;
  }

#-----------------------------------------------------------------------------
# Internal Methods

sub _initialise
{
  my $self    = shift;
  my $config_ref = shift;
  my $Diagram = Autodia::Diagram->new($config_ref);

  $self->{Config}  = $config_ref || ();
  $self->{Diagram} = $Diagram;

  return 1;
}

sub _reset {
  my $self = shift;
  my $config_ref = $self->{Config};
  my $Diagram = Autodia::Diagram->new($config_ref);
  $self->{Diagram} = $Diagram;
  return 1;
}

sub _error_file
  {
    my $self          = shift;

    $self->{file_open_error} = 1;

    print "Handler.pm : _error_file : error opening file $! \n";
    #$error_message\n";

    return 1;
  }

sub _parse
  {
    print "parsing file \n";
    return;
  }

sub _parse_file {
  my $self     = shift();
  my $filename = shift();
  my %config   = %{$self->{Config}};
  my $infile   = (defined $config{inputpath}) ?
    $config{inputpath} . $filename : $filename ;

  $self->{file_open_error} = 0;

  open (INFILE, "<$infile") or $self->_error_file();

  if ($self->{file_open_error} == 1) {
    warn " couldn't open file $infile \n";
    print "skipping $infile..\n";
    return 0;
  }

  $self->_parse (\*INFILE,$filename);

  close INFILE;

  return 1;
}

1;

###############################################################################

=head1 NAME

Handler.pm - generic language handler superclass

=head1 CONSTRUCTION METHOD

Not actually used but subclassed ie HandlerPerl or HandlerC as below:

my $handler = HandlerPerl->New(\%Config);

=cut