| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::Packages::Base; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 3 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 4 | 1 |  |  | 1 |  | 3 | use warnings; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 5 | 1 |  |  | 1 |  | 3 | use vars qw($VERSION); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 46 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Alien::Packages::Base - base class for package backends | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =cut | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | $VERSION = "0.001"; | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 |  | 4 | use Carp qw(croak); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 272 |  | 
| 16 |  |  |  |  |  |  | require IPC::Cmd; | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | =head1 SUBROUTINES/METHODS | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | =head2 new | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | Instantiates new object, no attributes evaluated. | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | =cut | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | sub _run_ipc_cmd | 
| 27 |  |  |  |  |  |  | { | 
| 28 | 3 | 50 |  | 3 |  | 24 | $_[0]->isa('Alien::Packages::Base') and shift; | 
| 29 | 3 |  |  |  |  | 12 | my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = IPC::Cmd::run(@_); | 
| 30 | 3 |  |  |  |  | 778327 | $stdout_buf = [ join( "", @$stdout_buf ) ]; | 
| 31 | 3 |  |  |  |  | 11 | $stderr_buf = [ join( "", @$stderr_buf ) ]; | 
| 32 | 3 |  |  |  |  | 36 | return ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ); | 
| 33 |  |  |  |  |  |  | } | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | sub new | 
| 36 |  |  |  |  |  |  | { | 
| 37 | 1 |  |  | 1 | 1 | 1 | my $class = $_[0]; | 
| 38 | 1 |  |  |  |  | 3 | my $self = bless( {}, $class ); | 
| 39 | 1 |  |  |  |  | 4 | return $self; | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =head2 pkgtype | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | Returns the pkgtype | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | =cut | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub pkgtype | 
| 49 |  |  |  |  |  |  | { | 
| 50 | 2 |  |  | 2 | 1 | 3 | my $self = $_[0]; | 
| 51 | 2 | 50 |  |  |  | 8 | my $name = ref($self) ? ref($self) : $self; | 
| 52 | 2 |  |  |  |  | 19 | $name =~ s/.*::(\w+)/$1/; | 
| 53 | 2 |  |  |  |  | 8 | return lc $name; | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =head2 list_packages | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | Returns a list of hashes containing installed packages. | 
| 59 |  |  |  |  |  |  | Each item must contain: | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | { Package => $pkg_name, Version => $version, Summary => $summary ] | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =head2 list_fileowners | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | Returns a hash of lists containing the packages which are registered | 
| 66 |  |  |  |  |  |  | file owners for the specified files. Each list must contain at least | 
| 67 |  |  |  |  |  |  | one item: | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | '/absolute/path/to/file' => | 
| 70 |  |  |  |  |  |  | [ | 
| 71 |  |  |  |  |  |  | { | 
| 72 |  |  |  |  |  |  | Package => $pkg_name, | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  | ], | 
| 75 |  |  |  |  |  |  | ... | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | =cut | 
| 78 |  |  |  |  |  |  |  | 
| 79 | 0 |  |  | 0 | 1 |  | sub list_packages   { croak "Abstract function " . __PACKAGE__ . "::list_packages called" } | 
| 80 | 0 |  |  | 0 | 1 |  | sub list_fileowners { croak "Abstract function " . __PACKAGE__ . "::list_fileowners called" } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 AUTHOR | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Jens Rehsack, C<<  >> | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =head1 LICENSE AND COPYRIGHT | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | Copyright 2010 Jens Rehsack. | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it | 
| 91 |  |  |  |  |  |  | under the terms of either: the GNU General Public License as published | 
| 92 |  |  |  |  |  |  | by the Free Software Foundation; or the Artistic License. | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | See http://dev.perl.org/licenses/ for more information. | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | =cut | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | 1; |