Just created my 1st object in Perl (with code from the Perl Developers
Guide), and got the error:
'Clock.pm did not return a true value at clock_test.pl line 1.'

Below is the object code, Clock.pm and the program that called it,
clock_test.pl.

I installed Clock.pm in '/Library/Perl' (Mac OS X, BSD Unix) and checked its
syntax. Syntax also ok on clock_test.pl.


Can someone tell me what the error means?


Clock.pm
*********
package Clock;

sub new {
    my($type) = @_;
    my $self = {};
    $self->{time} = time();
    bless $self, $type;
}

sub get {
    my ($self) = @_;
    return ($self->{time});
}

sub set {
    my ($self, $secs) = @_;
    $self->{time} = $secs || time();
    return (1);
}

Clock_test.pl
**************

use Clock;

my $clock1 = new Clock();
my $clock2 = new Clock();

print "difference = ", $clock2->get() - $clock1->get(), "seconds\n";

    



-- 
Randy Perry
sysTame
Mac Consulting/Sales

phn                 561.589.6449
mobile email        [EMAIL PROTECTED]



Reply via email to