App-Basis-ConvertText2
view release on metacpan or search on metacpan
# -----------------------------------------------------------------------------
sub other_debug {
my ( $state, $debug ) = @_;
# return if ( $state ne 'DEBUG' );
my $msg = $state;
$msg .= " $debug" if ($debug);
say STDERR localtime() . " " . get_program() . " $msg";
}
# -----------------------------------------------------------------------------
sub create_defaults {
my ( $dir, $verbose ) = @_;
my $default = "$dir/templates/default";
my ( $r, $o, $e );
die "dir option required" if ( !$dir );
if ( $opt{prince} ) {
$pdfconvertor = 'prince';
}
elsif ($opt{wkhtmltopdf}) {
$pdfconvertor = 'wkhtmltopdf';
}
my $status = $format->save_to_file( $opt{output}, $pdfconvertor);
if ( $opt{verbose} && $status ) {
say "Created $opt{output}";
}
elsif ( !$status ) {
say "Failed to create $opt{output}";
}
}
else {
say STDERR "Ignoring $opt{filename}, could not determine a filename to output to, no :format option in file?" if ( $opt{verbose} );
}
# return to where we came from
chdir($current);
lib/App/Basis/ConvertText2.pm view on Meta::CPAN
}
else {
warn "Unknown PDF converter ($pdfconvertor), using pandoc";
# otherwise lets use pandoc to create the file in the other formats
$exit = _pandoc_format( $file, $outfile );
}
if ($cmd) {
my ( $out, $err );
try {
# say "$cmd" ;
( $exit, $out, $err ) = run_cmd($cmd);
}
catch {
$err = "run_cmd($cmd) died - $_";
$exit = 1;
};
debug( "ERROR", $err ) if ($err); # only debug if return code is not 0
}
}
lib/App/Basis/ConvertText2.pm view on Meta::CPAN
}
my $status = 0;
# now lets copy it to its final resting place
if ($outfile) {
try {
$status = path($outfile)->copy($filename);
}
catch {
say STDERR "$_ ";
debug( "ERROR", "failed to copy $outfile to $filename" );
};
}
return $status;
}
=back
=cut
( run in 0.952 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )