| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Slaughter - Perl Automation Tool Helper | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =cut | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | This module is the platform-independant library which is used to abstract | 
| 12 |  |  |  |  |  |  | the implementations of the Slaughter primitives. | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | It is loaded via: | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | =for example begin | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | use Slaughter; | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =for example end | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | This usage actually dynamically loads the appropriate module from beneath the | 
| 23 |  |  |  |  |  |  | Slaughter::API namespace - which will contain the primitive implementation. | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | Initially we load the L<Slaughter::API::generic> module which contains pure-perl | 
| 26 |  |  |  |  |  |  | implemenation, and then we load the OS-specific module from the supported set: | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =over 8 | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | =item L<Slaughter::API::linux> | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | The implemetnation of our primitive API for GNU/Linux. | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | =item L<Slaughter::API::freebsd> | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | The implemetnation of our primitive API for FreeBSD. | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =back | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Assuming that the OS-specific module is successfully loaded we we will also | 
| 41 |  |  |  |  |  |  | load any I<local> OS-specific module.  (e.g. C<Slaughter::API::Local::linux>.) | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | Fallback implementations in our generic module merely output a suitable | 
| 44 |  |  |  |  |  |  | error message: | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =for example begin | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | This module is not implemented for $^O | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | =for example end | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | This allows compiled policies to execute, without throwing errors, and also | 
| 53 |  |  |  |  |  |  | report upon the primitives which need to be implemented or adapted. | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =cut | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =head1 EXTENSIONS | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | At the same time as loading the appropriate module from beneath the | 
| 60 |  |  |  |  |  |  | C<Slaughter::API> name-space this module will attempt to load an identically | 
| 61 |  |  |  |  |  |  | named module from beneath the Slaughter::API::Local namespace. | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | This allows you to keep develop your own custom-primitives. | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | =cut | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | =head1 METHODS | 
| 69 |  |  |  |  |  |  |  | 
| 70 |  |  |  |  |  |  | Now follows documentation on the available methods. | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =cut | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 8 |  |  | 8 |  | 149422 | use strict; | 
|  | 8 |  |  |  |  | 12 |  | 
|  | 8 |  |  |  |  | 207 |  | 
| 76 | 8 |  |  | 8 |  | 24 | use warnings; | 
|  | 8 |  |  |  |  | 6 |  | 
|  | 8 |  |  |  |  | 553 |  | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | our $VERSION = "3.0.5"; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | BEGIN | 
| 85 |  |  |  |  |  |  | { | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  |  | 
| 90 | 8 |  |  | 8 |  | 11 | my $generic = "use Slaughter::API::generic"; | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  |  | 
| 95 | 8 |  |  |  |  | 18 | my $specific = "use Slaughter::API::$^O;"; | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  |  | 
| 98 | 8 |  |  | 8 |  | 280 | eval($generic); | 
|  | 8 |  |  |  |  | 2307 |  | 
|  | 8 |  |  |  |  | 14 |  | 
|  | 8 |  |  |  |  | 38 |  | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  |  | 
| 102 | 8 |  |  | 8 |  | 298 | eval($specific); | 
|  | 8 |  |  |  |  | 2000 |  | 
|  | 8 |  |  |  |  | 13 |  | 
|  | 8 |  |  |  |  | 35 |  | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  |  | 
| 109 | 8 | 50 |  |  |  | 26 | if ( !$@ ) | 
| 110 |  |  |  |  |  |  | { | 
| 111 | 8 |  |  |  |  | 24 | my $ext = "use Slaughter::API::Local::$^O;"; | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  |  | 
| 114 | 8 |  |  | 8 |  | 259 | eval($ext); | 
|  | 8 |  |  |  |  | 1443 |  | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | } | 
| 122 |  |  |  |  |  |  | } | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | 1; | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =head1 AUTHOR | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | Steve Kemp <steve@steve.org.uk> | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =cut | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =head1 LICENSE | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | Copyright (c) 2010-2015 by Steve Kemp.  All rights reserved. | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | This module is free software; | 
| 141 |  |  |  |  |  |  | you can redistribute it and/or modify it under | 
| 142 |  |  |  |  |  |  | the same terms as Perl itself. | 
| 143 |  |  |  |  |  |  | The LICENSE file contains the full text of the license. | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =cut | 
| 146 |  |  |  |  |  |  |  |