[liblinux-distribution-perl] 01/34: initial import of Linux::Distribution 0.01 from CPAN
gregor herrmann
gregoa at debian.org
Thu Jun 4 21:35:35 UTC 2015
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to annotated tag v0.22
in repository liblinux-distribution-perl.
commit ad0129d4780f181f118b95ab1363a25f814996be
Author: Re Alberto <kerberus at accidia.net>
Date: Thu Mar 3 16:00:10 2005 -0800
initial import of Linux::Distribution 0.01 from CPAN
git-cpan-module: Linux::Distribution
git-cpan-version: 0.01
---
Changes | 6 ++++
MANIFEST | 7 ++++
META.yml | 10 ++++++
Makefile.PL | 12 +++++++
README | 26 ++++++++++++++
lib/Linux/Distribution.pm | 90 +++++++++++++++++++++++++++++++++++++++++++++++
t/Linux-Distribution.t | 15 ++++++++
7 files changed, 166 insertions(+)
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..6f2f8f3
--- /dev/null
+++ b/Changes
@@ -0,0 +1,6 @@
+Revision history for Perl extension Linux::Distribution.
+
+0.01 Wed Mar 2 01:00:59 2005
+ - original version; created by h2xs 1.23 with options
+ -A -X -n Linux::Distribution
+
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..7b0b2f8
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,7 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+t/Linux-Distribution.t
+lib/Linux/Distribution.pm
+META.yml Module meta-data (added by MakeMaker)
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..c817794
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Linux-Distribution
+version: 0.01
+version_from: lib/Linux/Distribution.pm
+installdirs: site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..79013de
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,12 @@
+use 5.008005;
+use ExtUtils::MakeMaker;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+WriteMakefile(
+ NAME => 'Linux::Distribution',
+ VERSION_FROM => 'lib/Linux/Distribution.pm', # finds $VERSION
+ PREREQ_PM => {}, # e.g., Module::Name => 1.1
+ ($] >= 5.005 ? ## Add these new keywords supported since 5.005
+ (ABSTRACT_FROM => 'lib/Linux/Distribution.pm', # retrieve abstract from module
+ AUTHOR => 'Re Alberto <kerberus at accidia.net>') : ()),
+);
diff --git a/README b/README
new file mode 100644
index 0000000..c232cea
--- /dev/null
+++ b/README
@@ -0,0 +1,26 @@
+Linux-Distribution version 0.01
+===============================
+
+This is a module that guess on what kind of linux distribution we are running looking for distro's specific release file into /etc.
+It currently recognize slackware, debian, suse, fedora, redhat, turbolinux, yellowdog, knoppix, mandrake and gentoo.
+
+INSTALLATION
+
+To install this module type the following:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+DEPENDENCIES
+
+This module has no dependencies.
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2005 by Re Alberto <kerberus at accidia.net>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.5 or,
+at your option, any later version of Perl 5 you may have available.
diff --git a/lib/Linux/Distribution.pm b/lib/Linux/Distribution.pm
new file mode 100644
index 0000000..da8902d
--- /dev/null
+++ b/lib/Linux/Distribution.pm
@@ -0,0 +1,90 @@
+package Linux::Distribution;
+
+use 5.008005;
+use strict;
+use warnings;
+use Carp qw(carp);
+
+require Exporter;
+
+our @ISA = qw(Exporter);
+
+our @EXPORT_OK = qw( distribution_name );
+
+our $VERSION = '0.01';
+
+our %release_files = (
+ 'gentoo-release' => 'gentoo',
+ 'fedora-release' => 'fedora',
+ 'turbolinux-release' => 'turbolinux',
+ 'mandrake-release' => 'mandrake',
+ 'mandrakelinux-release' => 'mandrakelinux',
+ 'debian_version' => 'debian',
+ 'debian_release' => 'debian',
+ 'SuSE-release' => 'suse',
+ 'knoppix-version' => 'knoppix',
+ 'yellowdog-release' => 'yellowdog',
+ 'slackware-version' => 'slackware',
+ 'slackware-release' => 'slackware',
+ 'redhat-release' => 'redhat',
+ 'redhat_version' => 'redhat'
+);
+
+carp('you are trying to use a linux specific module on a different OS')
+ if ( $^O ne 'linux' );
+
+sub distribution_name() {
+ foreach my $test ( keys %release_files ) {
+ if ( -f "/etc/$test" ) {
+ return $release_files{$test};
+ }
+ }
+ return '';
+}
+
+1;
+__END__
+
+
+=head1 NAME
+
+Linux::Distribution - Perl extension to guess on what linux distribution we are running on.
+
+=head1 SYNOPSIS
+
+ use Linux::Distribution qw(distribution_name);
+
+ if(my $distro = distribution_name) {
+ print "you are running $distro\n";
+ } else {
+ print "distribution unknown\n";
+ }
+
+=head1 DESCRIPTION
+
+This is a simple module that try to guess on what linux distribution we are running looking for release's files in /etc.
+
+It currently recognize slackware, debian, suse, fedora, redhat, turbolinux, yellowdog, knoppix, mandrake and gentoo.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 TODO
+
+Add the capability of recognize the version of the distribution.
+
+=head1 AUTHOR
+
+Re Alberto, E<lt>kerberus at accidia.netE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005 by Re Alberto
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself, either Perl version 5.8.5 or,
+at your option, any later version of Perl 5 you may have available.
+
+=cut
+
diff --git a/t/Linux-Distribution.t b/t/Linux-Distribution.t
new file mode 100644
index 0000000..264ee2a
--- /dev/null
+++ b/t/Linux-Distribution.t
@@ -0,0 +1,15 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl Linux-Distribution.t'
+
+#########################
+
+# change 'tests => 1' to 'tests => last_test_to_print';
+
+use Test::More tests => 1;
+BEGIN { use_ok('Linux::Distribution') };
+
+#########################
+
+# Insert your test code below, the Test::More module is use()ed here so read
+# its man page ( perldoc Test::More ) for help writing this test script.
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/liblinux-distribution-perl.git
More information about the Pkg-perl-cvs-commits
mailing list