...
#!/usr/bin/perl
use strict;
use Asterisk::AGI;
###########################################
# 2010 Communication Business Avenue, Inc.
# Caller ID Check Script
###########################################
$|=1;
# Setup some variables
my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
my $astagi = new Asterisk::AGI;
while(<stdin>) {
	chomp;
	last unless length($_);
	if (/^agi_(\w+)\:\s+(.*)$/) {
		$AGI{$1} = $2;
	}
}
sub checkresult {
	my ($res) = @_;
	my $retval;
	$tests++;
	chomp $res;
	if ($res =~ /^200/) {
		$res =~ /result=(-?\d+)/;
		if (!length($1)) {
			print STDERR "FAIL ($res)\n";
			$fail++;
		} else {
			print STDERR "PASS ($1)\n";
			$pass++;
		}
	} else {
		print STDERR "FAIL (unexpected result '$res')\n";
		$fail++;
	}
}
$astagi->say_alpha($AGI{'callerid'});
...
#!/usr/bin/perl
use strict;
use Asterisk::AGI;
###########################################
# 2010 Communication Business Avenue, Inc.
# Caller ID Check Script
###########################################
$|=1;
# Setup some variables
my %AGI; my $tests = 0; my $fail = 0; my $pass = 0;
my $astagi = new Asterisk::AGI;
while(<stdin>) {
	chomp;
	last unless length($_);
	if (/^agi_(\w+)\:\s+(.*)$/) {
		$AGI{$1} = $2;
	}
}
sub checkresult {
	my ($res) = @_;
	my $retval;
	$tests++;
	chomp $res;
	if ($res =~ /^200/) {
		$res =~ /result=(-?\d+)/;
		if (!length($1)) {
			print STDERR "FAIL ($res)\n";
			$fail++;
		} else {
			print STDERR "PASS ($1)\n";
			$pass++;
		}
	} else {
		print STDERR "FAIL (unexpected result '$res')\n";
		$fail++;
	}
}
$astagi->say_alpha($AGI{'callerid'});
...