File: test.pl

package info (click to toggle)
libfax-hylafax-client-perl 1.02-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 152 kB
  • sloc: perl: 886; makefile: 3
file content (59 lines) | stat: -rw-r--r-- 1,421 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use Test::Simple tests => 1;
use Fax::Hylafax::Client;

print q(
To test this module you will need access to a properly configured
HylaFAX server. Do you want to continue? [Y/N]: (Y) );

my $ok = <STDIN>;
chomp $ok;
$ok ||= 'Y';
if ($ok =~ /^Y/i){
	print "\nPlease enter the hostname of the server: (localhost) ";
	my $hostname = <STDIN>;
	chomp $hostname;
	$hostname ||= 'localhost';

	print "Please enter the username to connect as: (anonymous) ";
	my $user = <STDIN>;
	chomp $user;
	$user ||= 'anonymous';

	print "Please enter the password: (anonymous) ";
	my $password = <STDIN>;
	chomp $password;
	$password ||= 'anonymous';

	print "Please enter your e-mail address (the server will send notifications here): ";
	my $notifyaddr = <STDIN>;
	chomp $notifyaddr;

	print "Please enter the fax number to dial: ";
	my $dialstring = <STDIN>;
	chomp $dialstring;

	my $local_dir = `pwd`;
	chomp $local_dir;

	my $docfile = "${local_dir}/test.ps";

	print "We're now ready to connect to the server. Press ENTER to continue.";
	<STDIN>;
	print "\n";

	my $fax = Fax::Hylafax::Client->sendfax(
		host		=> $hostname || '',
		user		=> $user || '',
		password	=> $password || '',
		dialstring	=> $dialstring || '',
		docfile		=> $docfile || '',
		notifyaddr	=> $notifyaddr || '',
		notify		=> 'done',
	);

	ok( $fax->success ? 1 : 0, "Session transcript follows:\n" . $fax->trace);

} else {
	ok( 0, 'Test aborted by user');
}