File Coverage

lib/Rex/Commands/Notify.pm
Criterion Covered Total %
statement 11 14 78.5
branch n/a
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 16 20 80.0


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             =head1 NAME
6              
7             Rex::Commands::Notify - Notify a resource to execute.
8              
9             =head1 DESCRIPTION
10              
11             This module exports the notify() function.
12              
13             =head1 SYNOPSIS
14              
15             notify "run", "extract-archive";
16             notify $type, $resource_name;
17              
18             =head1 EXPORTED FUNCTIONS
19              
20             =cut
21              
22             package Rex::Commands::Notify;
23              
24 32     32   576 use v5.12.5;
  32         158  
25 32     32   219 use warnings;
  32         104  
  32         1629  
26              
27             our $VERSION = '1.14.2.2'; # TRIAL VERSION
28              
29             require Rex::Exporter;
30              
31 32     32   213 use vars qw(@EXPORT);
  32         72  
  32         1350  
32 32     32   242 use base qw(Rex::Exporter);
  32         77  
  32         5160  
33              
34             @EXPORT = qw(notify);
35              
36             =head2 notify($resource_type, $resource_name)
37              
38             This function will notify the given $resource_name of the given $resource_type to execute.
39              
40             =cut
41              
42             sub notify {
43 0     0 1   my ( $resource_type, $resource_name ) = @_;
44 0           my $notify = Rex::get_current_connection()->{notify};
45 0           $notify->run(
46             type => $resource_type,
47             name => $resource_name,
48             );
49             }
50              
51             1;