| 1 | package Data::Collector::Commands; | ||
| 2 | { | ||
| 3 | 8 | $Data::Collector::Commands::VERSION = '0.15'; | |
| 4 | } | ||
| 5 | # ABSTRACT: A role for commands to be used to collect data | ||
| 6 | |||
| 7 | 8 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 8 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | has 'commands' => ( | ||
| 11 | is => 'rw', | ||
| 12 | isa => 'HashRef[Str]', | ||
| 13 | traits => ['Hash'], | ||
| 14 | 6 | ▶ | default => sub { { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 15 | 6 | cat => '/bin/cat', | |
| 16 | test => '/usr/bin/test', | ||
| 17 | echo => '/bin/echo', | ||
| 18 | curl => '/usr/bin/curl', | ||
| 19 | ifconfig => '/sbin/ifconfig', | ||
| 20 | netstat => '/bin/netstat', | ||
| 21 | readlink => '/usr/bin/readlink', | ||
| 22 | } }, | ||
| 23 | 8 | handles => { | |
| 24 | set_command => 'set', | ||
| 25 | get_command => 'get', | ||
| 26 | }, | ||
| 27 | ); | ||
| 28 | |||
| 29 | 8 | 1; | |
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | =pod | ||
| 34 | |||
| 35 | =head1 NAME | ||
| 36 | |||
| 37 | Data::Collector::Commands - A role for commands to be used to collect data | ||
| 38 | |||
| 39 | =head1 VERSION | ||
| 40 | |||
| 41 | version 0.15 | ||
| 42 | |||
| 43 | =head1 SYNOPSIS | ||
| 44 | |||
| 45 | my $command = get_command('test'); | ||
| 46 | |||
| 47 | # new path | ||
| 48 | set_command( test => '/usr/local/test' ); | ||
| 49 | |||
| 50 | This is a role that is used to fetch the complete path of programs. The reason | ||
| 51 | to use a complete path instead of relative (I</bin/cat> instead of I<cat>) is a | ||
| 52 | security reason. When using relative paths, you might reach aliases, depending | ||
| 53 | on the configuration of the remote (or local) shell. | ||
| 54 | |||
| 55 | The idea is to make it easier for you to configure where your paths are, in case | ||
| 56 | the default one don't work (such as the difference between FreeBSD and | ||
| 57 | GNU/Linux. | ||
| 58 | |||
| 59 | =head1 NAME | ||
| 60 | |||
| 61 | =head1 ATTRIBUTES | ||
| 62 | |||
| 63 | =head2 commands(HashRef) | ||
| 64 | |||
| 65 | These are the set of commands. It comes with default locations for commands | ||
| 66 | used by core L<Data::Collector::Info> objects. | ||
| 67 | |||
| 68 | =head1 SUBROUTINES/METHODS | ||
| 69 | |||
| 70 | =head2 set_command | ||
| 71 | |||
| 72 | Sets a command's explicit path. | ||
| 73 | |||
| 74 | =head2 get_command | ||
| 75 | |||
| 76 | Gets a command's explicit path. | ||
| 77 | |||
| 78 | =head1 AUTHOR | ||
| 79 | |||
| 80 | Sawyer X <xsawyerx@cpan.org> | ||
| 81 | |||
| 82 | =head1 COPYRIGHT AND LICENSE | ||
| 83 | |||
| 84 | This software is copyright (c) 2012 by Sawyer X. | ||
| 85 | |||
| 86 | This is free software; you can redistribute it and/or modify it under | ||
| 87 | the same terms as the Perl 5 programming language system itself. | ||
| 88 | |||
| 89 | =cut | ||
| 90 | |||
| 91 | |||
| 92 | __END__ | ||