Acme-Blarghy-McBlarghBlargh
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
345678910111213141516171819202122use
strict;
use
Cwd ();
use
ExtUtils::MakeMaker ();
BEGIN {
$VERSION
=
'1.03'
;
}
# special map on pre-defined feature sets
my
%FeatureMap
= (
''
=>
'Core Features'
,
# XXX: deprecated
'-core'
=>
'Core Features'
,
);
# various lexical flags
my
(
@Missing
,
@Existing
,
%DisabledTests
,
$UnderCPAN
,
$HasCPANPLUS
);
my
(
$Config
,
$CheckOnly
,
$SkipInstall
,
$AcceptDefault
,
$TestOnly
);
my
(
$PostambleActions
,
$PostambleUsed
);
inc/Module/AutoInstall.pm view on Meta::CPAN
119120121122123124125126127128129130131132133134135136137138139my
(
@required
,
@tests
,
@skiptests
);
my
$default
= 1;
my
$conflict
= 0;
if
(
$feature
=~ m/^-(\w+)$/ ) {
my
$option
=
lc
($1);
# check for a newer version of myself
_update_to(
$modules
,
@_
) and
return
if
$option
eq
'version'
;
# sets CPAN configuration options
$Config
=
$modules
if
$option
eq
'config'
;
# promote every features to core status
$core_all
= (
$modules
=~ /^all$/i ) and
next
if
$option
eq
'core'
;
next
unless
$option
eq
'core'
;
}
"["
. (
$FeatureMap
{
lc
(
$feature
) } ||
$feature
) .
"]\n"
;
inc/Module/AutoInstall.pm view on Meta::CPAN
341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379my
@config
= _cpanplus_config( @{ +
shift
} );
my
$installed
= 0;
require
CPANPLUS::Backend;
my
$cp
= CPANPLUS::Backend->new;
my
$conf
=
$cp
->configure_object;
return
unless
$conf
->can(
'conf'
)
# 0.05x+ with "sudo" support
or _can_write(
$conf
->_get_build(
'base'
));
# 0.04x
# if we're root, set UNINST=1 to avoid trouble unless user asked for it.
my
$makeflags
=
$conf
->get_conf(
'makeflags'
) ||
''
;
if
( UNIVERSAL::isa(
$makeflags
,
'HASH'
) ) {
# 0.03+ uses a hashref here
$makeflags
->{UNINST} = 1
unless
exists
$makeflags
->{UNINST};
}
else
{
# 0.02 and below uses a scalar
$makeflags
=
join
(
' '
,
split
(
' '
,
$makeflags
),
'UNINST=1'
)
if
(
$makeflags
!~ /\bUNINST\b/ and
eval
qq{ $> eq '0' }
);
}
$conf
->set_conf(
makeflags
=>
$makeflags
);
$conf
->set_conf(
prereqs
=> 1 );
while
(
my
(
$key
,
$val
) =
splice
(
@config
, 0, 2 ) ) {
$conf
->set_conf(
$key
,
$val
);
}
my
$modtree
=
$cp
->module_tree;
while
(
my
(
$pkg
,
$ver
) =
splice
(
@modules
, 0, 2 ) ) {
"*** Installing $pkg...\n"
;
MY::preinstall(
$pkg
,
$ver
) or
next
if
defined
&MY::preinstall
;
my
$success
;
my
$obj
=
$modtree
->{
$pkg
};
inc/Module/AutoInstall.pm view on Meta::CPAN
438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467_load_cpan();
require
Config;
if
(CPAN->VERSION < 1.80) {
# no "sudo" support, probe for writableness
return
unless
_can_write( MM->catfile(
$CPAN::Config
->{cpan_home},
'sources'
) )
and _can_write(
$Config::Config
{sitelib} );
}
# if we're root, set UNINST=1 to avoid trouble unless user asked for it.
my
$makeflags
=
$CPAN::Config
->{make_install_arg} ||
''
;
$CPAN::Config
->{make_install_arg} =
join
(
' '
,
split
(
' '
,
$makeflags
),
'UNINST=1'
)
if
(
$makeflags
!~ /\bUNINST\b/ and
eval
qq{ $> eq '0' }
);
# don't show start-up info
$CPAN::Config
->{inhibit_startup_message} = 1;
# set additional options
while
(
my
(
$opt
,
$arg
) =
splice
(
@config
, 0, 2 ) ) {
(
$args
{
$opt
} =
$arg
,
next
)
if
$opt
=~ /^force$/;
# pseudo-option
$CPAN::Config
->{
$opt
} =
$arg
;
}
local
$CPAN::Config
->{prerequisites_policy} =
'follow'
;
while
(
my
(
$pkg
,
$ver
) =
splice
(
@modules
, 0, 2 ) ) {
MY::preinstall(
$pkg
,
$ver
) or
next
if
defined
&MY::preinstall
;
inc/Module/Install.pm view on Meta::CPAN
1234567891011121314151617181920212223242526#line 1
package
Module::Install;
# For any maintainers:
# The load order for Module::Install is a bit magic.
# It goes something like this...
#
# IF ( host has Module::Install installed, creating author mode ) {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
# 3. The installed version of inc::Module::Install loads
# 4. inc::Module::Install calls "require Module::Install"
# 5. The ./inc/ version of Module::Install loads
# } ELSE {
# 1. Makefile.PL calls "use inc::Module::Install"
# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
# 3. The ./inc/ version of Module::Install loads
# }
BEGIN {
require
5.004;
}
BEGIN {
inc/Module/Install.pm view on Meta::CPAN
3536373839404142434445464748495051525354555657
*inc::Module::Install::VERSION
=
*VERSION
;
@inc::Module::Install::ISA
= __PACKAGE__;
}
# 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
:
not:
inc/Module/Install/Metadata.pm view on Meta::CPAN
201202203204205206207208209210211212213214215216217218219220221
}
return
1;
}
sub
all_from {
my
(
$self
,
$file
) =
@_
;
unless
(
defined
(
$file
) ) {
my
$name
=
$self
->name or
die
(
"all_from called with no args without setting name() first"
);
$file
=
join
(
'/'
,
'lib'
,
split
(/-/,
$name
)) .
'.pm'
;
$file
=~ s{.*/}{}
unless
-e
$file
;
unless
( -e
$file
) {
die
(
"all_from cannot find $file from $name"
);
}
}
unless
( -f
$file
) {
die
(
"The path '$file' does not exist, or is not a file"
);
}
inc/Module/Install/Metadata.pm view on Meta::CPAN
308309310311312313314315316317318319320321322323324325326327328
return
$self
->{
values
}{no_index};
}
sub
read
{
my
$self
=
shift
;
$self
->include_deps(
'YAML::Tiny'
, 0 );
my
$data
= YAML::Tiny::LoadFile(
'META.yml'
);
# Call methods explicitly in case user has already set some values.
while
(
my
(
$key
,
$value
) =
each
%$data
) {
next
unless
$self
->can(
$key
);
if
(
ref
$value
eq
'HASH'
) {
while
(
my
(
$module
,
$version
) =
each
%$value
) {
$self
->can(
$key
)->(
$self
,
$module
=>
$version
);
}
}
else
{
$self
->can(
$key
)->(
$self
,
$value
);
}
}
( run in 0.627 second using v1.01-cache-2.11-cpan-94b05bcf43c )