#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use Getopt::Long; use Fax::Hylafax::Client qw( sendfax faxinfo ); my %connect = ( host => '10.0.0.41', user => (getpwuid $<) [0], # password => '', # passive => 1 ); my $NUMBER = ''; my $VERBOSE = 0; my $res = GetOptions( 'n|number=s' => \$NUMBER, 'verbose!' => \$VERBOSE, 'host=s' => \$connect{host} ); my $FILE = shift; die "Usage: $0 -n 1-123-1234567 /path/to/doc.pcl\n" unless $res and $FILE; ##################### $VERBOSE and warn "Sending $FILE\n"; my $fax = sendfax( %connect, dialstring => $NUMBER, docfile => $FILE, format => 'PCL' ); die "Fax failed:\n", $fax->trace unless $fax->success; my $ID = $fax->jobid; warn Dumper $fax; $VERBOSE and warn "OK $ID\n"; ##################### $VERBOSE and warn "Geting info\n"; my $info = faxinfo( %connect, jobid => $ID ); die "Info failed: ", $info->trace unless $info->success; print $info->trace; $VERBOSE and warn "DONE\n";