Config-Maker
view release on metacpan or search on metacpan
lib/Config/Maker/Encode.pm view on Meta::CPAN
use warnings;
use strict;
use Carp;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(encode decode encmode $utf8);
our @EXPORT_OK = @EXPORT;
sub encode($$;$);
sub decode($$;$);
sub encmode(*$);
our $utf8;
sub _encode_only_system($$;$) {
my ($enc, $text, $check) = @_;
unless($enc eq 'system') {
if($check == 1) {
croak "Encoding not available. Can't convert encoding $enc";
} else {
carp "Encoding not available. Can't convert encoding $enc";
}
}
return $text;
}
sub _binmode_only_system(*$) {
my ($handle, $enc) = @_;
unless($enc eq 'system') {
carp "Encoding not available. Can't set encoding to $enc";
}
}
sub _binmode_encoding(*$) {
my ($handle, $enc) = @_;
binmode $handle, ":encoding($enc)";
}
eval {
require I18N::Langinfo;
require Encode;
require Encode::Alias;
require PerlIO::encoding;
$::ENCODING = I18N::Langinfo::langinfo(&I18N::Langinfo::CODESET);
lib/Config/Maker/Metaconfig.pm view on Meta::CPAN
contexts => [opt => '//'],
);
}
metatype('meta');
metatype('template');
metatype('output');
# And now the real code...
sub _qual($$) {
my ($file, $dir) = @_;
return unless $file;
if(File::Spec->file_name_is_absolute($file)) {
return $file;
} else {
return File::Spec->rel2abs($file, $dir);
}
}
sub _get_cfg {
lib/Config/Maker/Option.pm view on Meta::CPAN
'/' => sub {
croak "Can't \"divide by\" option" if $_[2];
$_[0]->get($_[1]);
},
'&{}' => sub {
my $self = $_[0];
sub { $self->get(@_); };
},
fallback => 1;
sub _ref(\%$;$) {
my ($hash, $key, $default) = @_;
if(exists $hash->{$key}) {
my $rv = $hash->{$key};
delete $hash->{$key};
return $rv;
} elsif(@_ == 3) {
return $default;
} else {
croak "Mandatory argument $key not specified";
}
lib/Config/Maker/Type.pm view on Meta::CPAN
@{$self->{format}};
}
# Get the name of the option type.
sub name {
my ($self) = @_;
$self->{name};
}
# Build a new type...
sub _ref(\%$;$) {
my ($hash, $key, $default) = @_;
if(exists $hash->{$key}) {
my $rv = $hash->{$key};
delete $hash->{$key};
return $rv;
} elsif(@_ == 3) {
return $default;
} else {
croak "Mandatory argument $key not specified";
}
( run in 0.374 second using v1.01-cache-2.11-cpan-1f129e94a17 )