Acme-Perl-Consensual
view release on metacpan or search on metacpan
CONTRIBUTING view on Meta::CPAN
If there's anything unclear in the documentation, please submit this
as a bug report or patch as above.
Non-toy example scripts that I can bundle would also be appreciated.
* Translation
Translations of documentation would be welcome.
For translations of error messages and other strings embedded in the
code, check with me first. Sometimes the English strings may not in
a stable state, so it would be a waste of time translating them.
Coding Style
I tend to write using something approximating the Allman style, using
tabs for indentation and Unix-style line breaks.
* <http://en.wikipedia.org/wiki/Indent_style#Allman_style>
* <http://www.derkarl.org/why_to_tabs.html>
inc/Module/AutoInstall.pm view on Meta::CPAN
my $missing = join( ',', @Missing );
my $config = join( ',',
UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
if $Config;
return
unless system( 'sudo', $^X, $0, "--config=$config",
"--installdeps=$missing" );
print << ".";
*** The 'sudo' command exited with error! Resuming...
.
}
return _prompt(
qq(
==> Should we try to install the required module(s) anyway?), 'n'
) =~ /^[Yy]/;
}
# load a module and return the version it reports
inc/Module/Install.pm view on Meta::CPAN
# all of the following checks should be included in import(),
# to allow "eval 'require Module::Install; 1' to test
# installation of Module::Install. (RT #51267)
#-------------------------------------------------------------
# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as
# the caller loaded module this in the documented manner.
# If not set, the caller may NOT have loaded the bundled version, and thus
# they may not have a MI version that works with the Makefile.PL. This would
# result in false errors or unexpected behaviour. And we don't want that.
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
unless ( $INC{$file} ) { die <<"END_DIE" }
Please invoke ${\__PACKAGE__} with:
use inc::${\__PACKAGE__};
not:
use ${\__PACKAGE__};
inc/Module/Install.pm view on Meta::CPAN
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
if ( -f $0 ) {
my $s = (stat($0))[9];
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future ($s > $t).
This is known to create infinite loops in make.
Please correct this, then run $0 again.
END_DIE
inc/Module/Install.pm view on Meta::CPAN
goto &$code unless $cwd eq $pwd;
}
unless ($$sym =~ s/([^:]+)$//) {
# XXX: it looks like we can't retrieve the missing function
# via $$sym (usually $main::AUTOLOAD) in this case.
# I'm still wondering if we should slurp Makefile.PL to
# get some context or not ...
my ($package, $file, $line) = caller;
die <<"EOT";
Unknown function is found at $file line $line.
Execution of $file aborted due to runtime errors.
If you're a contributor to a project, you may need to install
some Module::Install extensions from CPAN (or other repository).
If you're a user of a module, please contact the author.
EOT
}
my $method = $1;
if ( uc($method) eq $method ) {
# Do nothing
return;
inc/Module/Install/Package.pm view on Meta::CPAN
# must all have the same version. Seems wise.
sub module_package_internals_version_check {
my ($self, $version) = @_;
return if $version < 0.1800001; # XXX BOOTBUGHACK!!
die <<"..." unless $version == $VERSION;
Error! Something has gone awry:
Module::Package version=$version is using
Module::Install::Package version=$VERSION
If you are the author of this module, try upgrading Module::Package.
Otherwise, please notify the author of this error.
...
}
# Find and load the author side plugin:
sub _load_plugin {
my ($self, $spec, $namespace) = @_;
$spec ||= '';
$namespace ||= 'Module::Package';
my $version = '';
inc/Module/Package.pm view on Meta::CPAN
BEGIN {
$Module::Package::VERSION = '0.30';
$inc::Module::Package::VERSION ||= $Module::Package::VERSION;
@inc::Module::Package::ISA = __PACKAGE__;
}
sub import {
my $class = shift;
$INC{'inc/Module/Install.pm'} = __FILE__;
unshift @INC, 'inc' unless $INC[0] eq 'inc';
eval "use Module::Install 1.01 (); 1" or $class->error($@);
package main;
Module::Install->import();
eval {
module_package_internals_version_check($Module::Package::VERSION);
module_package_internals_init(@_);
};
if ($@) {
$Module::Package::ERROR = $@;
die $@;
}
}
# XXX Remove this when things are stable.
sub error {
my ($class, $error) = @_;
if (-e 'inc' and not -e 'inc/.author') {
require Data::Dumper;
$Data::Dumper::Sortkeys = 1;
my $dump1 = Data::Dumper::Dumper(\%INC);
my $dump2 = Data::Dumper::Dumper(\@INC);
die <<"...";
This should not have happened. Hopefully this dump will explain the problem:
inc::Module::Package: $inc::Module::Package::VERSION
Module::Package: $Module::Package::VERSION
inc::Module::Install: $inc::Module::Install::VERSION
Module::Install: $Module::Install::VERSION
Error: $error
%INC:
$dump1
\@INC:
$dump2
...
}
else {
die $error;
}
}
1;
inc/YAML/Tiny.pm view on Meta::CPAN
sub new {
my $class = shift;
bless [ @_ ], $class;
}
# Create an object from a file
sub read {
my $class = ref $_[0] ? ref shift : shift;
# Check the file
my $file = shift or return $class->_error( 'You did not specify a file name' );
return $class->_error( "File '$file' does not exist" ) unless -e $file;
return $class->_error( "'$file' is a directory, not a file" ) unless -f _;
return $class->_error( "Insufficient permissions to read '$file'" ) unless -r _;
# Slurp in the file
local $/ = undef;
local *CFG;
unless ( open(CFG, $file) ) {
return $class->_error("Failed to open file '$file': $!");
}
my $contents = <CFG>;
unless ( close(CFG) ) {
return $class->_error("Failed to close file '$file': $!");
}
$class->read_string( $contents );
}
# Create an object from a string
sub read_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless [], $class;
my $string = $_[0];
inc/YAML/Tiny.pm view on Meta::CPAN
my $document = { };
push @$self, $document;
$self->_read_hash( $document, [ length($1) ], \@lines );
} else {
die \"YAML::Tiny failed to classify the line '$lines[0]'";
}
}
};
if ( ref $@ eq 'SCALAR' ) {
return $self->_error(${$@});
} elsif ( $@ ) {
require Carp;
Carp::croak($@);
}
return $self;
}
# Deparse a scalar string to the actual scalar
sub _read_scalar {
inc/YAML/Tiny.pm view on Meta::CPAN
}
}
}
return 1;
}
# Save an object to a file
sub write {
my $self = shift;
my $file = shift or return $self->_error('No file name provided');
# Write it to the file
open( CFG, '>' . $file ) or return $self->_error(
"Failed to open file '$file' for writing: $!"
);
print CFG $self->write_string;
close CFG;
return 1;
}
# Save an object to a string
sub write_string {
inc/YAML/Tiny.pm view on Meta::CPAN
}
} else {
die "YAML::Tiny does not support $type references";
}
}
@lines;
}
# Set error
sub _error {
$YAML::Tiny::errstr = $_[1];
undef;
}
# Retrieve error
sub errstr {
$YAML::Tiny::errstr;
}
#####################################################################
# YAML Compatibility
( run in 0.398 second using v1.01-cache-2.11-cpan-65fba6d93b7 )