| 1 | # | ||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||
| 3 | # | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Rex::Commands::Inventory - Get an inventory of your systems | ||
| 8 | |||
| 9 | =head1 DESCRIPTION | ||
| 10 | |||
| 11 | With this module you can get an inventory of your system. | ||
| 12 | |||
| 13 | All these functions will not be reported. These functions don't modify anything. | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use Data::Dumper; | ||
| 18 | task "inventory", "remoteserver", sub { | ||
| 19 | my $inventory = inventory(); | ||
| 20 | print Dumper($inventory); | ||
| 21 | }; | ||
| 22 | |||
| 23 | =head1 EXPORTED FUNCTIONS | ||
| 24 | |||
| 25 | =cut | ||
| 26 | |||
| 27 | package Rex::Commands::Inventory; | ||
| 28 | |||
| 29 | 1 | ▶ | use v5.14.4; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | |||
| 32 | 1 | our $VERSION = '1.16.1'; # VERSION | |
| 33 | |||
| 34 | 1 | ▶ | use Rex::Inventory; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | 1 | require Rex::Exporter; | |
| 37 | |||
| 38 | 1 | ▶ | use vars qw(@EXPORT); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | 1 | ▶ | use base qw(Rex::Exporter); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | |||
| 41 | 1 | @EXPORT = qw(inventor inventory); | |
| 42 | |||
| 43 | =head2 inventory | ||
| 44 | |||
| 45 | This function returns a hashRef of all gathered hardware. Use the Data::Dumper module to see its structure. | ||
| 46 | |||
| 47 | task "get_inventory", sub { | ||
| 48 | my $inventory = inventory(); | ||
| 49 | print Dumper($inventory); | ||
| 50 | }; | ||
| 51 | |||
| 52 | =cut | ||
| 53 | |||
| 54 | 0 | ▶ | sub inventory { |
|
Subroutine
inventory: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 55 | 0 | my $inv = Rex::Inventory->new; | |
| 56 | |||
| 57 | 0 | return $inv->get; | |
| 58 | } | ||
| 59 | |||
| 60 | 0 | ▶ | sub inventor { |
|
Subroutine
inventor: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 61 | 0 | return inventory(); | |
| 62 | } | ||
| 63 | |||
| 64 | 1 | 1; | |