Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

Commit

Permalink
add a version method
Browse files Browse the repository at this point in the history
  • Loading branch information
plicease committed Jan 19, 2017
1 parent 01b291e commit 836b03f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
16 changes: 16 additions & 0 deletions lib/Alien/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,22 @@ sub libs {
return $self->_keyword('Libs', @_);
}

=head2 version

my $version = Alien::MyLibrary->version;

Returns the version of the Alienized library or tool that was
determined at install time.

=cut

sub version {
my $self = shift;
my $version = $self->config('version');
chomp $version;
return $version;
}

=head2 install_type

my $install_type = Alien::MyLibrary->install_type;
Expand Down
16 changes: 10 additions & 6 deletions t/alien_base.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ subtest 'AB::MB sys install' => sub {

require_ok 'Alien::Foo1';

my $cflags = Alien::Foo1->cflags;
my $libs = Alien::Foo1->libs;
my $cflags = Alien::Foo1->cflags;
my $libs = Alien::Foo1->libs;
my $version = Alien::Foo1->version;

$libs =~ s{^\s+}{};

is $cflags, '-DFOO=stuff', "cflags: $cflags";
is $libs, '-lfoo1', "libs: $libs";
is $version, '3.99999', "version: $version";
};

subtest 'AB::MB share install' => sub {

require_ok 'Alien::Foo2';

my $cflags = Alien::Foo2->cflags;
my $libs = Alien::Foo2->libs;
my $cflags = Alien::Foo2->cflags;
my $libs = Alien::Foo2->libs;
my $version = Alien::Foo2->version;

ok $cflags, "cflags: $cflags";
ok $libs, "libs: $libs";
ok $cflags, "cflags: $cflags";
ok $libs, "libs: $libs";
is $version, '3.2.1', "version: $version";

if($cflags =~ /-I(.*)$/)
{
Expand Down

0 comments on commit 836b03f

Please sign in to comment.