Subject: | Document Formats |
The included patch uses the much more portable Sys::Hostname instead of
`hostname`.
It also includes a new option to docfiles: format:pdf (or tiff, or...)
which sends a FORM request to the server, which means the server will
treat following documents as that format, rather then autodetecting the
format.
Incudes documentation patch, but no unit test
Subject: | hylafax-format-PG.02.patch |
Only in Fax-Hylafax-Client-1.02: blib
diff -rub Fax-Hylafax-Client-1.02-ORIG/Client.pm Fax-Hylafax-Client-1.02/Client.pm
--- Fax-Hylafax-Client-1.02-ORIG/Client.pm 2006-06-25 01:48:01.000000000 -0400
+++ Fax-Hylafax-Client-1.02/Client.pm 2011-07-11 15:00:32.606579044 -0400
@@ -14,12 +14,13 @@
use Carp;
use Net::FTP;
+use Sys::Hostname;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(faxinfo faxrm faxstat sendfax sendpage);
-our $VERSION = "1.02";
+our $VERSION = "1.02-PG2";
our $Host;
our $Port;
@@ -226,7 +227,7 @@
{
shift if $_[0] eq __PACKAGE__;
my %param = @_;
- my $hostname = `hostname`; chomp $hostname;
+ my $hostname = hostname;
my $self = {
JOB_ID => '',
TRACE => '',
@@ -274,7 +275,8 @@
foreach my $docfile (@{$param{docfiles}})
{
- croak __PACKAGE__ . ": $docfile does not exist" if (! -e $docfile);
+ croak __PACKAGE__ . ": $docfile does not exist"
+ unless $docfile =~ /^format:(\w+)$/ or -e $docfile;
}
delete $param{docfile};
@@ -302,12 +304,15 @@
foreach my $docfile (@{$param{docfiles}})
{
+ if( $docfile =~ m/^format:(\w+)$/i ) {
+ $client->quot( "FORM $1" ) || _com_error( $client );
+ next;
+ }
my $unique = time . sprintf('%05d', $$) . sprintf('%04d', int(rand 10000));
my $remote = '/tmp/doc.' . $hostname . '.' . $unique;
$client->put($docfile, $remote) || _com_error($client);
$self->{TRACE} .= $client->message;
-
push (@tempfiles, $remote);
}
@@ -634,6 +639,24 @@
native HylaFAX formats, i.e. Plain Text, PostScript, TIFF Class F, or PDF.
[REQUIRED unless you use "poll" option]
+Normaly Hylafax autodetects the document format. You may force the format
+used with a filename that looks like C<format:FORMAT>, where C<FORMAT> is a format
+recognised by Hylafax, like C<pdf> or C<tiff>. This format is then used by Hylafax
+for all subsequent files.
+
+Example:
+
+ sendfax( ...
+ docfile => [ $file1, 'format:pdf', $file2, $file3 ]
+ ...
+ );
+ # C<$file1> will be autodetected
+ # C<$file2> and C<$file3> will be treated as PDF files
+
+=item docfiles
+
+Synonym for L</docfile>.
+
=item coverfile
Full pathname of the cover page file. All notes about "docfile" apply, except