Changeset d1c88304cad0718a35367b4e5068e687459d1665

Show
Ignore:
Timestamp:
03/22/07 03:58:32 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1174535912 +0000
git-parent:

[c203f3d61063c12a4ce36e097772325e4ca8f26f]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1174535912 +0000
Message:

auto adapt external referenced modules into the Resmon::Module name space for execution

git-svn-id: https://labs.omniti.com/resmon/trunk@25 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lib/Resmon/Module.pm

    r3596d9c rd1c8830  
    33use strict; 
    44use Data::Dumper; 
    5  
     5use UNIVERSAL qw/isa/; 
    66my %coderefs; 
    77 
     
    1212  my $coderef = $coderefs{$type}; 
    1313  return $coderef if ($coderef); 
     14 
     15  # First if the monitor name is raw and looks right: 
     16  #   is a subclass of Resmon::Module and can 'handler' 
     17  # then we will promote it into the Resmon::Module namespace 
     18  # and use this one. 
    1419  eval "use $type;"; 
     20  if($type->isa(__PACKAGE__) && $type->can('handler')) { 
     21    eval "  
     22      package Resmon::Module::$type; 
     23      use vars qw/\@ISA/; 
     24      \@ISA = qw($type); 
     25      1; 
     26    "; 
     27    if($@) { 
     28      die "Could not repackage $type as Resmon::Module::$type\n"; 
     29    } 
     30    return undef; 
     31  } 
    1532  eval "use Resmon::Module::$type;"; 
    1633  return undef; 
     
    3855  $arg->{lastmessage} = shift; 
    3956  $arg->{lastupdate} = time; 
    40   if($arg->{laststatus} =~ /^([A-Z]+)\(([^\)]+)\)$/s) { 
     57  if($arg->{laststatus} =~ /^([A-Z]+)\((.*)\)$/s) { 
    4158    # This handles old-style modules that return just set status as 
    4259    #     STATE(message)