| 1 | package SAL::Base; | ||
| 2 | |||
| 3 | # This module is licensed under the FDL (Free Document License) | ||
| 4 | # The complete license text can be found at http://www.gnu.org/copyleft/fdl.html | ||
| 5 | # Contains excerpts from various man pages, tutorials and books on perl | ||
| 6 | # BOILER-PLATE FOR NEW MODULES | ||
| 7 | |||
| 8 | use strict; | ||
| 9 | use Carp; | ||
| 10 | |||
| 11 | BEGIN { | ||
| 12 | use Exporter (); | ||
| 13 | our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); | ||
| 14 | $VERSION = '3.03'; | ||
| 15 | @ISA = qw(Exporter); | ||
| 16 | @EXPORT = qw(); | ||
| 17 | %EXPORT_TAGS = (); | ||
| 18 | @EXPORT_OK = qw(); | ||
| 19 | } | ||
| 20 | our @EXPORT_OK; | ||
| 21 | |||
| 22 | END { } | ||
| 23 | |||
| 24 | our %Base = ( | ||
| 25 | ###################################### | ||
| 26 | ###################################### | ||
| 27 | ); | ||
| 28 | |||
| 29 | # Setup accessors via closure (from perltooc manpage) | ||
| 30 | sub _classobj { | ||
| 31 | my $obclass = shift || __PACKAGE__; | ||
| 32 | my $class = ref($obclass) || $obclass; | ||
| 33 | no strict "refs"; | ||
| 34 | return \%$class; | ||
| 35 | } | ||
| 36 | |||
| 37 | for my $datum (keys %{ _classobj() }) { | ||
| 38 | no strict "refs"; | ||
| 39 | *$datum = sub { | ||
| 40 | my $self = shift->_classobj(); | ||
| 41 | $self->{$datum} = shift if @_; | ||
| 42 | return $self->{$datum}; | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | |||
| 47 | ############################################################################ | ||
| 48 | # Constructors (Public) | ||
| 49 | sub new { | ||
| 50 | my $obclass = shift || __PACKAGE__; | ||
| 51 | my $class = ref($obclass) || $obclass; | ||
| 52 | my $self = {}; | ||
| 53 | |||
| 54 | bless($self, $class); | ||
| 55 | |||
| 56 | # Set default object properties | ||
| 57 | |||
| 58 | return $self; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | ############################################################################ | ||
| 63 | # Destructor (Public) | ||
| 64 | sub destruct { | ||
| 65 | my $self = shift; | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | ############################################################################ | ||
| 70 | # Public Methods | ||
| 71 | |||
| 72 | |||
| 73 | ############################################################################ | ||
| 74 | # Private Methods | ||
| 75 | |||
| 76 | |||
| 77 | 1; |