File Coverage

blib/lib/Sys/OsPackage/Driver.pm
Criterion Covered Total %
statement 12 13 92.3
branch 1 2 50.0
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 17 20 85.0


line stmt bran cond sub pod time code
1             # Sys::OsPackage::Driver
2             # ABSTRACT: parent class for packaging handler drivers for Sys::OsPackage
3             # Copyright (c) 2022 by Ian Kluft
4             # Open Source license Perl's Artistic License 2.0:
5             # SPDX-License-Identifier: Artistic-2.0
6              
7             # This module is maintained for minimal dependencies so it can build systems/containers from scratch.
8              
9             ## no critic (Modules::RequireExplicitPackage)
10             # This resolves conflicting Perl::Critic rules which want package and strictures each before the other
11 2     2   1144 use strict;
  2         5  
  2         61  
12 2     2   9 use warnings;
  2         17  
  2         63  
13 2     2   12 use utf8;
  2         4  
  2         10  
14             ## use critic (Modules::RequireExplicitPackage)
15              
16             package Sys::OsPackage::Driver;
17             $Sys::OsPackage::Driver::VERSION = '0.1.7';
18             # demonstrate module is accessible without launching packaging commands
19             # all drivers inherit this to respond to ping for testing
20             sub ping
21             {
22 5     5 0 9 my $class = shift;
23              
24             # enforce class lineage
25 5 50       27 if (not $class->isa(__PACKAGE__)) {
26 0         0 return __PACKAGE__;
27             }
28              
29 5         22 return $class;
30             }
31              
32             1;
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Sys::OsPackage::Driver - parent class for packaging handler drivers for Sys::OsPackage
41              
42             =head1 VERSION
43              
44             version 0.1.7
45              
46             =head1 SYNOPSIS
47              
48             my $ospkg = Sys::OsPackage->instance();
49              
50             # check if packaging commands exist for this system
51             if (not $ospkg->call_pkg_driver(op => "implemented")) {
52             return 0;
53             }
54              
55             # find OS package name for Perl module
56             my $pkgname = $ospkg->call_pkg_driver(op => "find", module => $module);
57              
58             # install a Perl module as an OS package
59             my $result1 = $ospkg->call_pkg_driver(op => "modpkg", module => $module);
60              
61             # install an OS package
62             my $result2 = $ospkg->call_pkg_driver(op => "install", pkg => $pkgname);
63              
64             =head1 DESCRIPTION
65              
66             ⛔ This is for Sys::OsPackage internal use only.
67              
68             The Sys::OsPackage method call_pkg_driver() will call the correct driver for the running platform.
69              
70             All the platforms' packaging drivers must use this class as their parent class.
71              
72             =head1 SEE ALSO
73              
74             "pacman/Rosetta" at Arch Linux Wiki compares commands of 5 Linux packaging systems L
75              
76             GitHub repository for Sys::OsPackage: L
77              
78             =head1 BUGS AND LIMITATIONS
79              
80             Please report bugs via GitHub at L
81              
82             Patches and enhancements may be submitted via a pull request at L
83              
84             =head1 LICENSE INFORMATION
85              
86             Copyright (c) 2022 by Ian Kluft
87              
88             This module is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE or at L.
89              
90             =head1 AUTHOR
91              
92             Ian Kluft
93              
94             =head1 COPYRIGHT AND LICENSE
95              
96             This software is Copyright (c) 2022 by Ian Kluft.
97              
98             This is free software, licensed under:
99              
100             The Artistic License 2.0 (GPL Compatible)
101              
102             =cut
103              
104             __END__