/usr/share/perl5/Gscan2pdf.pm is in gscan2pdf 0.9.32-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 | package Gscan2pdf;
use strict;
use warnings;
use Carp;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
# $VERSION = 0.01;
@ISA = qw(Exporter);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw();
}
our @EXPORT_OK;
# return a hash of the passed options
sub options2hash {
my ($output) = @_;
my %hash;
while ($output =~ /-+([\w\-]+) ?(.*) \[(.*)\] *\n([\S\s]*)/) {
my $option = $1;
my $values = $2;
my $default = $3;
# Remove everything on the option line and above.
$output = $4;
# Strip out the extra characters by e.g. [=(yes|no)]
$values = $1 if ($values =~ /\[=\((.*)\)\]/);
if ($values =~ /(-?\d*\.?\d*)\.\.(\d*\.?\d*)(pel|bit|mm|dpi|%|us)?/) {
$hash{$option}{min} = $1;
$hash{$option}{max} = $2;
$hash{$option}{unit} = $3 if (defined $3);
$hash{$option}{step} = $1
if ($values =~ /\(in steps of (\d*\.?\d+)\)/);
}
else {
my @array;
while (defined $values) {
my $i = index($values, '|');
my $value;
if ($i > -1) {
$value = substr($values, 0, $i);
$values = substr($values, $i+1, length($values));
}
else {
if ($values =~ /(pel|bit|mm|dpi|%|us)$/) {
$hash{$option}{unit} = $1;
$values = substr($values, 0, index($values, $hash{$option}{unit}));
}
$value = $values;
undef $values;
}
push @array, $value if ($value ne '');
}
$hash{$option}{values} = [ @array ] if (@array);
}
# Parse tooltips from option description based on an 8-character indent.
my $tip = '';
while ($output =~ /^ {8,}(.*)\n([\S\s]*)/) {
if ($tip eq '') {
$tip = $1;
}
else {
$tip = "$tip $1";
}
# Remove everything on the description line and above.
$output = $2;
}
$hash{$option}{default} = $default;
$hash{$option}{tip} = $tip;
}
return %hash;
}
1;
__END__
|