| 1 | package Frontier::Client::Easy; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 0 | ▶ | use Frontier::Client; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | our $VERSION = 1.03; | ||
| 8 | our $AUTOLOAD; | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my $that = shift; | ||
| 12 | my $class = ref($that) || $that; | ||
| 13 | my $self = {}; | ||
| 14 | bless $self, $class; | ||
| 15 | #Process instantuation arguments | ||
| 16 | my %args = @_; | ||
| 17 | my $url = $args{'url'} || die "Must provide URL to Frontier server"; | ||
| 18 | $self->{'server'} = Frontier::Client->new( 'url' => $url, debug=>0 ); | ||
| 19 | return $self; | ||
| 20 | } | ||
| 21 | |||
| 22 | sub AUTOLOAD { #This sub overloads all methods called by storing the method name in $AUTOLOAD for us | ||
| 23 | |||
| 24 | my $self = shift; | ||
| 25 | my $type = ref($self); | ||
| 26 | my $name = $AUTOLOAD; | ||
| 27 | $name =~ s/.*://; #Trim down the fully qualified name, just the method | ||
| 28 | return unless($name); #Don't proceed unless we were actually asked to call something | ||
| 29 | return $self->{'server'}->call($name,@_); #Wrap it into a Frontier::Client->call method | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | sub DESTROY { #Don't allow overload of the destructor | ||
| 34 | return; | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | __END__ | ||