App-Info
view release on metacpan or search on metacpan
lib/App/Info/Lib/OSSPUUID.pm view on Meta::CPAN
=over 4
=item info
Looking for uuid executable
=item confirm
Path to uuid executable?
=item unknown
Path to uuid executable?
=back
=cut
sub executable {
my $self = shift;
my $key = 'uuid';
# Find executable.
$self->info("Looking for $key");
unless ($self->{$key}) {
my $bin = $self->bin_dir or return;
if (my $exe = $u->first_cat_exe([$self->search_uuid_names], $bin)) {
# We found it. Confirm.
$self->{$key} = $self->confirm(
key => "path to $key",
prompt => "Path to $key executable?",
value => $exe,
callback => sub { -x },
error => 'Not an executable'
);
} else {
# Handle an unknown value.
$self->{$key} = $self->unknown(
key => "path to $key",
prompt => "Path to $key executable?",
callback => sub { -x },
error => 'Not an executable'
);
}
}
return $self->{$key};
};
*uuid = \&executable;
##############################################################################
=head3 bin_dir
my $bin_dir = $uuid->bin_dir;
Returns the OSSP UUID binary directory path. App::Info::Lib::OSSPUUID gathers
the path from the system call C<`uuid-config --bindir`>.
B<Events:>
=over 4
=item info
Executing `uuid-config --bindir`
=item error
Cannot find bin directory
=item unknown
Enter a valid OSSP UUID bin directory
=back
=cut
# This code reference is used by bin_dir(), lib_dir(), and so_lib_dir() to
# validate a directory entered by the user.
my $is_dir = sub { -d };
sub bin_dir {
my $self = shift;
return unless $self->{uuid_config};
unless (exists $self->{bin_dir} ) {
if (my $dir = $get_data->($self, '--bindir')) {
$self->{bin_dir} = $dir;
} else {
# Handle an unknown value.
$self->error("Cannot find bin directory");
$self->{bin_dir} = $self->unknown(
key => 'OSSP UUID bin dir',
callback => $is_dir
);
}
}
return $self->{bin_dir};
}
##############################################################################
=head3 inc_dir
my $inc_dir = $uuid->inc_dir;
Returns the OSSP UUID include directory path. App::Info::Lib::OSSPUUID gathers
the path from the system call C<`uuid-config --includedir`>.
B<Events:>
=over 4
=item info
Executing `uuid-config --includedir`
=item error
Cannot find include directory
=item unknown
Enter a valid OSSP UUID include directory
=back
=cut
sub inc_dir {
my $self = shift;
return unless $self->{uuid_config};
unless (exists $self->{inc_dir} ) {
if (my $dir = $get_data->($self, '--includedir')) {
$self->{inc_dir} = $dir;
} else {
# Handle an unknown value.
$self->error("Cannot find include directory");
$self->{inc_dir} = $self->unknown(
key => 'OSSP UUID include dir',
callback => $is_dir
);
}
}
return $self->{inc_dir};
( run in 1.204 second using v1.01-cache-2.11-cpan-2398b32b56e )