diff --git a/lib/App/Perlbrew/Sys.pm b/lib/App/Perlbrew/Sys.pm new file mode 100644 index 00000000..3bdb33aa --- /dev/null +++ b/lib/App/Perlbrew/Sys.pm @@ -0,0 +1,22 @@ +package App::Perlbrew::Sys; +use strict; +use warnings; +use Config; + +sub osname { + $Config{osname} +} + +sub archname { + $Config{archname} +} + +sub os { + $Config{osname} +} + +sub arch { + (split(/-/, $Config{archname}, 2))[0] +} + +1; diff --git a/lib/App/perlbrew.pm b/lib/App/perlbrew.pm index f9ffa4bd..f546af0b 100644 --- a/lib/App/perlbrew.pm +++ b/lib/App/perlbrew.pm @@ -28,6 +28,7 @@ use App::Perlbrew::Util qw( files_are_the_same uniq find_similar_tokens looks_li use App::Perlbrew::Path (); use App::Perlbrew::Path::Root (); use App::Perlbrew::HTTP qw( http_download http_get ); +use App::Perlbrew::Sys; ### global variables @@ -225,6 +226,8 @@ sub parse_cmdline { ); } +sub sys { App::Perlbrew::Sys:: } + sub root { my ( $self, $new_root ) = @_; diff --git a/t/sys.t b/t/sys.t new file mode 100644 index 00000000..a1ad597d --- /dev/null +++ b/t/sys.t @@ -0,0 +1,14 @@ +use Test2::V0; + +use App::perlbrew; + +subtest 'sys', sub { + my $o = App::perlbrew->new(); + is $o->can("sys"), T(); + is $o->sys->os(), D(); + is $o->sys->arch(), D(); + is $o->sys->osname(), D(); + is $o->sys->archname(), D(); +}; + +done_testing;