Changeset 22704

Show
Ignore:
Timestamp:
21.08.2010 23:27:41 (9 years ago)
Author:
davidb
Message:

Tidied up printing of command run to conditionally displayed based on verbosity level

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/open-office-src/trunk/perllib/plugins/OpenOfficeConverter.pm

    r22701 r22704  
    8484} 
    8585 
    86 #my $arguments = [ 
    87 #    { 'name' => "openoffice_port", 
    88 #      'desc' => "{OpenOfficeConverter.openoffice_port}", 
    89 #      'type' => "int", 
    90 #      'deft' => "8100", 
    91 #      'range' => "81,", 
    92 #      'reqd' => "no" }, 
    93 #    ]; 
    94  
    95 my $arguments = [ ]; 
     86my $arguments = [ 
     87    { 'name' => "openoffice_port", 
     88      'desc' => "{OpenOfficeConverter.openoffice_port}", 
     89      'type' => "int", 
     90      'deft' => "8100", 
     91      'range' => "81,", 
     92      'reqd' => "no" }, 
     93    ]; 
    9694 
    9795 
     
    117115    return bless $self, $class; 
    118116    } 
     117    if (!$openoffice_conversion_available) { 
     118    $self->{'no_openoffice_conversion_reason'} = $no_openoffice_conversion_reason; 
     119 
     120    my $outhandle = $self->{'outhandle'}; 
     121    &gsprintf($outhandle, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$no_openoffice_conversion_reason})\n"); 
     122    }   
     123 
     124    $self->{'openoffice_conversion_available'} = $openoffice_conversion_available; 
     125     
     126    return bless $self, $class; 
     127 
     128} 
     129 
     130sub init { 
     131    my $self = shift(@_); 
     132    my ($verbosity, $outhandle, $failhandle) = @_; 
     133 
    119134    if ($openoffice_conversion_available) { 
    120     # my $oo_port = $self->{'openoffice_port'}; 
    121     my $oo_port = 8100; 
     135    my $oo_port = $self->{'openoffice_port'}; 
    122136 
    123137    my $launch_cmd = "soffice"; 
    124138    $launch_cmd .= " \"-accept=socket,host=localhost,port=$oo_port;urp;StarOffice.ServiceManager\""; 
    125139    $launch_cmd .= " -headless"; 
    126      
    127140    $self->{'openoffice_launch_cmd'} = $launch_cmd; 
    128141    } 
    129     else {        
    130     $self->{'no_openoffice_conversion_reason'} = $no_openoffice_conversion_reason; 
    131  
    132     my $outhandle = $self->{'outhandle'}; 
    133     &gsprintf($outhandle, "OpenOfficeConverter: {OpenOfficeConverter.noconversionavailable} ({OpenOfficeConverter.$no_openoffice_conversion_reason})\n"); 
    134     }   
    135  
    136     $self->{'openoffice_conversion_available'} = $openoffice_conversion_available; 
    137      
    138     return bless $self, $class; 
    139  
    140 } 
    141  
    142 sub init { 
    143     my $self = shift(@_); 
    144     my ($verbosity, $outhandle, $failhandle) = @_; 
    145142 
    146143    $self->{'ootmp_file_paths'} = (); 
     
    161158    # check the filename 
    162159    return 0 if ( !-f $source_file_full_path); 
     160 
     161    my $outhandle = $self->{'outhandle'}; 
     162    my $verbosity = $self->{'verbosity'}; 
    163163 
    164164    my $source_file_no_path = &File::Basename::basename($source_file_full_path); 
     
    181181    # Generate and run the convert command 
    182182    my $convert_command = "oo2html \"$source_file_full_path\" \"$target_file_path\""; 
    183     print STDERR "convert_command = $convert_command\n"; 
     183    if ($verbosity>2) { 
     184    print $outhandle "Convert command: $convert_command\n"; 
     185    } 
     186 
    184187    my $print_info = { 'message_prefix' => "OpenOffice Conversion", 
    185188               'message' => "Converting $source_file_no_path to: $target_file_type" };