The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Haver::Base - Useful base class for most objects in Haver server and clients.

SYNOPSIS

BEGIN { 
package Foobar;
use base 'Haver::Base';

sub initialize {
    my ($me, @args) = @_;
    print "init args: join(', ', @args), "\n";
}

sub finalize {
   my ($me) = @_;
   # do stuff here that you would do in DESTROY.
}
} # BEGIN

my $foo = new Foobar({name => "Foobar"}, 1, 2, 3);
# or: my $foo = new Foobar(name => "Foobar", -initargs => [1, 2, 3])
# "init args: 1, 2, 3" was printed.
$foo->{name} eq "Foobar";

DESCRIPTION

This is a base class for nearly every class in the Haver server, and it is encouraged to be used for any class in the client, too.

The main advantage it brings is not having to write redundant constructors, and also it prints debugging messages on object creation and destruction.

When a new object is instantiated, initialize() is called. Don't overload DESTROY in child classes, use finalize() instead.

TODO Describe methods.

SEE ALSO

Haver::Singleton

https://savannah.nongnu.org/projects/haver/

AUTHOR

Dylan William Hardison, <dylanwh@tampabay.rr.com>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Dylan William Hardison

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this module; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA