Allow deferred setting of the module loader object.
This commit is contained in:
parent
69ec3668d5
commit
1dd9844a22
27
Message.pm
27
Message.pm
@ -40,12 +40,32 @@ sub new {
|
|||||||
my $self = $class -> SUPER::new(@_)
|
my $self = $class -> SUPER::new(@_)
|
||||||
or return undef;
|
or return undef;
|
||||||
|
|
||||||
return SystemModule::set_error("No module object available.") if(!$self -> {"module"});
|
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## @method void DESTROY()
|
||||||
|
# Destructor method to prevent a circular list formed from a reference to the modules
|
||||||
|
# object from derailing normal destruction.
|
||||||
|
sub DESTROY {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self -> {"module"} = undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
## @method void set_module_obj($module)
|
||||||
|
# Set the reference to the system module loader. This allows deferred initialisation
|
||||||
|
# of the module loader.
|
||||||
|
#
|
||||||
|
# @param module A reference to the system module handler object.
|
||||||
|
sub set_module_obj {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
$self -> {"module"} = shift;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Transport handling
|
# Transport handling
|
||||||
|
|
||||||
@ -81,6 +101,9 @@ sub load_transport_module {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $args = hash_or_hashref(@_);
|
my $args = hash_or_hashref(@_);
|
||||||
|
|
||||||
|
return $self -> self_error("Module loader not available at this time")
|
||||||
|
unless($self -> {"module"});
|
||||||
|
|
||||||
# Work out which field is being searched on
|
# Work out which field is being searched on
|
||||||
my $field;
|
my $field;
|
||||||
if($args -> {"id"}) {
|
if($args -> {"id"}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user