use strict;
use warnings;
+
package Perl::OSType;
# ABSTRACT: Map Perl operating system names to generic types
-our $VERSION = '1.004'; # VERSION
+our $VERSION = '1.005'; # VERSION
require Exporter;
our @ISA = qw(Exporter);
-our %EXPORT_TAGS = (
- all => [ qw( os_type is_os_type ) ]
-);
+our %EXPORT_TAGS = ( all => [qw( os_type is_os_type )] );
our @EXPORT_OK = @{ $EXPORT_TAGS{all} };
);
sub os_type {
- my ($os) = @_;
- $os = $^O unless defined $os;
- return $OSTYPES{ $os } || q{};
+ my ($os) = @_;
+ $os = $^O unless defined $os;
+ return $OSTYPES{$os} || q{};
}
sub is_os_type {
- my ($type, $os) = @_;
- return unless $type;
- $os = $^O unless defined $os;
- return os_type($os) eq $type;
+ my ( $type, $os ) = @_;
+ return unless $type;
+ $os = $^O unless defined $os;
+ return os_type($os) eq $type;
}
1;
-__END__
-
=pod
=encoding utf-8
=head1 VERSION
-version 1.004
+version 1.005
=head1 SYNOPSIS
=head2 Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker
-at L<https://github.com/dagolden/perl-ostype/issues>.
+at L<https://github.com/dagolden/Perl-OSType/issues>.
You will be notified automatically of any progress on your issue.
=head2 Source Code
This is open source software. The code repository is available for
public review and contribution under the terms of the license.
-L<https://github.com/dagolden/perl-ostype>
+L<https://github.com/dagolden/Perl-OSType>
- git clone git://github.com/dagolden/perl-ostype.git
+ git clone https://github.com/dagolden/Perl-OSType.git
=head1 AUTHOR
the same terms as the Perl 5 programming language system itself.
=cut
+
+__END__
+
+
+# vim: ts=4 sts=4 sw=4 et:
# API tests
#--------------------------------------------------------------------------#
-require_ok( 'Perl::OSType' );
+require_ok('Perl::OSType');
can_ok( 'Perl::OSType', 'os_type' );
-my @functions = qw/os_type is_os_type/ ;
-for my $sub ( @functions ) {
- ok( eval { Perl::OSType->import($sub); 1 }, "importing $sub()" );
- can_ok( 'main', $sub );
+my @functions = qw/os_type is_os_type/;
+for my $sub (@functions) {
+ ok( eval { Perl::OSType->import($sub); 1 }, "importing $sub()" );
+ can_ok( 'main', $sub );
}
my $test_pkg = "testpackage$$";
ok( eval "package $test_pkg; use Perl::OSType ':all'; 1",
- "Testing 'use Perl::OSType qw/:all/'"
-);
+ "Testing 'use Perl::OSType qw/:all/'" );
can_ok( $test_pkg, @functions );
-
#--------------------------------------------------------------------------#
# os_type
#--------------------------------------------------------------------------#
{
- my $fcn = 'os_type()';
+ my $fcn = 'os_type()';
- ok( my $current_type = os_type(), "$fcn: without arguments" );
+ ok( my $current_type = os_type(), "$fcn: without arguments" );
- is( $current_type, os_type( $^O ), "... matches os_type($^O)" );
+ is( $current_type, os_type($^O), "... matches os_type($^O)" );
- is(os_type( NON_EXISTENT_OS ), '', "$fcn: unknown OS returns empty string");
+ is( os_type(NON_EXISTENT_OS), '', "$fcn: unknown OS returns empty string" );
- is(os_type( '' ), '', "$fcn: empty string returns empty string");
+ is( os_type(''), '', "$fcn: empty string returns empty string" );
- local $^O = 'linux';
+ local $^O = 'linux';
- is(os_type( undef ), 'Unix', "$fcn: explicit undef uses $^O");
+ is( os_type(undef), 'Unix', "$fcn: explicit undef uses $^O" );
}
#--------------------------------------------------------------------------#
#--------------------------------------------------------------------------#
{
- my $fcn = 'is_os_type()';
+ my $fcn = 'is_os_type()';
- is(is_os_type(NON_EXISTENT_OS), '', "$fcn: non-existent type is false");
+ is( is_os_type(NON_EXISTENT_OS), '', "$fcn: non-existent type is false" );
- is(is_os_type(''), undef, "$fcn: empty string type is false");
+ is( is_os_type(''), undef, "$fcn: empty string type is false" );
- is(is_os_type('Unix', NON_EXISTENT_OS), '', "$fcn: non-existent OS is false");
+ is( is_os_type( 'Unix', NON_EXISTENT_OS ), '', "$fcn: non-existent OS is false" );
- local $^O = 'vos';
- ok( ! is_os_type( 'Unix' ), "$fcn: false" );
- ok( is_os_type( 'VOS' ), "$fcn: true" );
- ok( ! is_os_type(), "$fcn: false if no type provided" );
+ local $^O = 'vos';
+ ok( !is_os_type('Unix'), "$fcn: false" );
+ ok( is_os_type('VOS'), "$fcn: true" );
+ ok( !is_os_type(), "$fcn: false if no type provided" );
}
done_testing;