+# check if we are called directly
+if ($0 =~ m#(?:^|/)perl.prov$#) {
+ my $prov = new RPM::PerlReq;
+ # process @ARGV or STDIN
+ foreach ( @ARGV ? @ARGV : <> ) {
+ chomp;
+ next if -l || !-f _; # skip non-files and symlinks
+ next if m#/usr/(?:share/doc|src)/#; # lot of false alarms; warning: we omit ^ here
+ next if !m#\.p[ml]$#; # we only care about *.pm and *.pl files
+ $prov->process_file($_);
+ }
+ $prov->print_result;
+}
+
+
+package RPM::PerlReq;
+use Safe;