diff options
Diffstat (limited to 'perl-install/printer')
-rw-r--r-- | perl-install/printer/STATUS | 9 | ||||
-rw-r--r-- | perl-install/printer/data.pm | 7 | ||||
-rw-r--r-- | perl-install/printer/gimp.pm | 4 | ||||
-rw-r--r-- | perl-install/printer/main.pm | 25 | ||||
-rw-r--r-- | perl-install/printer/office.pm | 7 |
5 files changed, 28 insertions, 24 deletions
diff --git a/perl-install/printer/STATUS b/perl-install/printer/STATUS index c43231a5b..c1d79af31 100644 --- a/perl-install/printer/STATUS +++ b/perl-install/printer/STATUS @@ -1,10 +1,7 @@ printerdrake status -- %thedb usage/declaartion/initialization +- %thedb usage/declaration/initialization -- printer::printerdrake should probably be renamed printer::gui +- printer::printerdrake still needs to be splited/cleaned -- printerdrake still needs to be splited/cleaned - -- in printer::gimp, $lprcommand is neither declared nor setted - nowhere +- printer::printerdrake should probably be renamed printer::gui
\ No newline at end of file diff --git a/perl-install/printer/data.pm b/perl-install/printer/data.pm index 61ae3bff5..2e20db2b5 100644 --- a/perl-install/printer/data.pm +++ b/perl-install/printer/data.pm @@ -2,13 +2,16 @@ package printer::data; use strict; use common; +use vars qw(@ISA @EXPORT); + +@ISA = qw(Exporter); +@EXPORT = qw(%lprcommand %spoolers %spooler_inv %shortspooler_inv); + # BUG, FIXME : this was neither declered nor setted anywhere before : # maybe this should be swtiched : # $lprcommand{stuff} => $spoolers{stuff}{print_command} -our %lprcommand; - our %spoolers = ('ppq' => { 'help' => "/usr/bin/lphelp %s |", 'print_command' => 'lpr-pdq', diff --git a/perl-install/printer/gimp.pm b/perl-install/printer/gimp.pm index 5bf600e3d..d9264fd81 100644 --- a/perl-install/printer/gimp.pm +++ b/perl-install/printer/gimp.pm @@ -199,7 +199,7 @@ sub makeprinterentry { $configfile = addentry($queue, "Driver: $gimpprintdriver", $configfile); $configfile = removeentry($queue, "Destination:", $configfile); $configfile = addentry($queue, - "Destination: /usr/bin/$printer::data::lprcommand{$printer->{SPOOLER}{print_command}} -P $queue -o raw", $configfile); + "Destination: /usr/bin/$spoolers{$printer->{SPOOLER}{print_command}} -P $queue -o raw", $configfile); } else { $configfile = removeentry($queue, "PPD-File:", $configfile); $configfile = addentry($queue, "PPD-File: /etc/foomatic/$queue.ppd", $configfile); @@ -207,7 +207,7 @@ sub makeprinterentry { $configfile = addentry($queue, "Driver: ps2", $configfile); $configfile = removeentry($queue, "Destination:", $configfile); $configfile = addentry($queue, - "Destination: /usr/bin/$printer::data::lprcommand{$printer->{SPOOLER}{print_command}} -P $queue", $configfile); + "Destination: /usr/bin/$spoolers{$printer->{SPOOLER}{print_command}} -P $queue", $configfile); } return $configfile; } diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 344b7f3bb..a6aa3e035 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -6,13 +6,13 @@ use strict; use common; use run_program; +use printer::data; use printer::services; use printer::default; use printer::gimp; use printer::cups; use printer::office; use printer::detect; -use printer::data; use services; @@ -22,7 +22,7 @@ my $PRINTER_DB_FILE = "/usr/share/foomatic/db/compiled/overview.xml"; #-Did we already read the subroutines of /usr/sbin/ptal-init? my $ptalinitread = 0; -%printer_type = ( +our %printer_type = ( N("Local printer") => "LOCAL", N("Remote printer") => "REMOTE", N("Printer on remote CUPS server") => "CUPS", @@ -33,8 +33,11 @@ my $ptalinitread = 0; N("Enter a printer device URI") => "URI", N("Pipe job into a command") => "POSTPIPE" ); + our %printer_type_inv = reverse %printer_type; +our %thedb; + #------------------------------------------------------------------------------ sub spooler { @@ -116,7 +119,7 @@ sub assure_device_is_available_for_cups { # file:/dev/null instead. Restart CUPS if necessary to assure that # CUPS knows the device. my ($device) = @_; - my $result; + my ($result, $i); for ($i = 0; $i < 3; $i++) { local *F; open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . @@ -141,7 +144,7 @@ sub spooler_in_security_level { my ($spooler, $level) = @_; my $sp; $sp = (($spooler eq "lpr") || ($spooler eq "lprng")) ? "lpd" : $spooler; - $file = "$::prefix/etc/security/msec/server.$level"; + my $file = "$::prefix/etc/security/msec/server.$level"; if (-f $file) { local *F; open F, "< $file" or return 0; @@ -160,7 +163,7 @@ sub add_spooler_to_security_level { my ($spooler, $level) = @_; my $sp; $sp = (($spooler eq "lpr") || ($spooler eq "lprng")) ? "lpd" : $spooler; - $file = "$::prefix/etc/security/msec/server.$level"; + my $file = "$::prefix/etc/security/msec/server.$level"; if (-f $file) { local *F; open F, ">> $file" or return 0; @@ -185,11 +188,11 @@ sub copy_printer_params($$) { } sub getinfo($) { - my ($::prefix) = @_; + my ($prefix) = @_; my $printer = {}; my @QUEUES; - $::prefix = $::prefix; + $::prefix = $prefix; # Initialize $printer data structure resetinfo($printer); @@ -498,7 +501,7 @@ sub read_printer_db(;$) { poll_ppd_base(); } - @entries_db_short = sort keys %printer::thedb; + my @entries_db_short = sort keys %printer::thedb; #%descr_to_db = map { $printer::thedb{$_}{DESCR}, $_ } @entries_db_short; #%descr_to_help = map { $printer::thedb{$_}{DESCR}, $printer::thedb{$_}{ABOUT} } @entries_db_short; #@entry_db_description = keys %descr_to_db; @@ -697,7 +700,7 @@ sub set_cups_autoconf { # Read config file my $file = "$::prefix/etc/sysconfig/printing"; - @file_content = cat_($file); + my @file_content = cat_($file); # Remove all valid "CUPS_CONFIG" lines (/^\s*CUPS_CONFIG/ and $_ = "") foreach @file_content; @@ -732,7 +735,7 @@ sub get_cups_autoconf { sub set_usermode { my $usermode = $_[0]; $::expert = $usermode; - $str = $usermode ? "expert" : "recommended"; + my $str = $usermode ? "expert" : "recommended"; substInFile { s/^(USER_MODE=).*/$1$str/; $_ .= "USER_MODE=$str" if eof } "$::prefix/etc/sysconfig/printing"; } @@ -1116,7 +1119,7 @@ sub help_output { local *F; open F, ($::testing ? $::prefix : "chroot $::prefix/ ") . sprintf($spoolers{$spooler}{help}, $queue); - $helptext = join("", <F>); + my $helptext = join("", <F>); close F; $helptext = "Option list not available!\n" if $spooler eq 'lpq' && (!$helptext || ($helptext eq "")); return $helptext; diff --git a/perl-install/printer/office.pm b/perl-install/printer/office.pm index 4ab60bcca..f870c4dac 100644 --- a/perl-install/printer/office.pm +++ b/perl-install/printer/office.pm @@ -3,6 +3,7 @@ package printer::office; use strict; use common; use run_program; +use printer::data; use printer::common; use printer::cups; @@ -97,7 +98,7 @@ sub configureoffice { # the "Generic Printer" my @parameters = $suites{$suite}{param}; $configfilecontent = removeentry(@parameters, $configfilecontent); - $configfilecontent = addentry($parameters[0], $parameters[1] . $suites{$suite}{perl} . $printer::data::lprcommand{$printer->{SPOOLER}{print_command}}, $configfilecontent); + $configfilecontent = addentry($parameters[0], $parameters[1] . $suites{$suite}{perl} . $spoolers{$printer->{SPOOLER}{print_command}}, $configfilecontent); # Write back Star Office configuration file return writesofficeconfigfile($configfilename, $configfilecontent); } @@ -207,7 +208,7 @@ sub makestarofficeprinterentry { # symbol correctly. $configfile = removeentry("ports", "$queue=", $configfile); $configfile = addentry("ports", - "$queue=/usr/bin/perl -p -e \"s=16#80 /euro=16#80 /Euro=\" | /usr/bin/$printer::data::lprcommand{$printer->{SPOOLER}{print_command}} -P $queue", + "$queue=/usr/bin/perl -p -e \"s=16#80 /euro=16#80 /Euro=\" | /usr/bin/$spoolers{$printer->{SPOOLER}{print_command}} -P $queue", $configfile); # Make printer's section $configfile = addsection("$queue,PostScript,$queue", $configfile); @@ -261,7 +262,7 @@ sub makeopenofficeprinterentry { # symbol correctly. $configfile = removeentry($queue, "Command=", $configfile); $configfile = addentry($queue, - "Command=/usr/bin/perl -p -e \"s=/euro /unused=/Euro /unused=\" | /usr/bin/$printer::data::lprcommand{$printer->{SPOOLER}{print_command}} -P $queue", + "Command=/usr/bin/perl -p -e \"s=/euro /unused=/Euro /unused=\" | /usr/bin/$spoolers{$printer->{SPOOLER}{print_command}} -P $queue", $configfile); # "Comment" line $configfile = removeentry($queue, "Comment=", $configfile); |