CPAN-Reporter-Smoker-OpenBSD
view release on metacpan or search on metacpan
lib/CPAN/Reporter/Smoker/OpenBSD/PerlConfig.pm view on Meta::CPAN
package CPAN::Reporter::Smoker::OpenBSD::PerlConfig;
use strict;
use warnings;
use Config;
use Hash::Util qw(lock_hash);
our $VERSION = '0.021'; # VERSION
=pod
=head1 NAME
CPAN::Reporter::Smoker::OpenBSD::PerlConfig - class representing perl configuration
=head1 SYNOPSIS
use CPAN::Reporter::Smoker::OpenBSD::PerlConfig;
my $cfg = CPAN::Reporter::Smoker::OpenBSD::PerlConfig->new;
=head1 DESCRIPTION
This class represents a C<perl> configuration in a way that can be used by the
C<dblock> CLI.
It was created to handle the details of a distroprefs implementation, specially
regarding dealing with C<undef> values.
=head1 METHODS
=head2 new
Creates a new instance of this class.
Expects nothing, returns a new instance.
=cut
sub new {
my $class = shift;
my $self = {
osname => $Config{osname},
archname => $Config{archname}
};
my $attrib_name = 'useithreads';
if ( defined( $Config{$attrib_name} ) ) {
$self->{$attrib_name} = 1;
}
else {
$self->{$attrib_name} = 0;
}
bless $self, $class;
lock_hash( %{$self} );
return $self;
}
=head2 dump
This methods returns a instance attributes as a hash reference.
This is particulary useful to use with YAML modules C<DumpFile> function.
=cut
sub dump {
my $self = shift;
my %attribs = %{$self};
my $attrib_name = 'useithreads';
if ( $self->{$attrib_name} ) {
$attribs{$attrib_name} = 'define';
}
else {
$attribs{$attrib_name} = '^$';
}
return \%attribs;
}
=head1 SEE ALSO
=over
=item *
( run in 3.684 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )