Movatterモバイル変換


[0]ホーム

URL:


 / 
inc-latest-0.500
River stage zero No dependents
/inc::latest

NAME

inc::latest - use modules bundled in inc/ if they are newer than installed ones

VERSION

version 0.500

SYNOPSIS

# in Makefile.PL or Build.PLuse inc::latest 'Some::Configure::Prereq';

DESCRIPTION

WARNING -- THIS IS AN EXPERIMENTAL MODULE. It was originally bundled (as an experiment) withModule::Build and has been split out for more general use.

Theinc::latest module helps bootstrap configure-time dependencies for CPAN distributions. These dependencies get bundled into theinc directory within a distribution and are used byMakefile.PL orBuild.PL.

Arguments toinc::latest are module names that are checked against both the current@INC array and against specially-named directories ininc. If the bundled version is newer than the installed one (or the module isn't installed, then, the bundled directory is added to the start of@INC and the module is loaded from there.

There are actually two variations ofinc::latest -- one for authors and one for theinc directory. For distribution authors, theinc::latest installed in the system will record modules loaded viainc::latest and can be used to create the bundled files ininc, including writing the second variation asinc/latest.pm.

This secondinc::latest is the one that is loaded in a distribution being installed (e.g. fromMakefile.PL orBuild.PL). This bundledinc::latest is the one that determines which module to load.

Special notes on bundling

Theinc::latest module creates bundled directories based on the packlist file of an installed distribution. Even thoughinc::latest takes module name arguments, it is better to think of it as bundling and making available entiredistributions. When a module is loaded throughinc::latest, it looks in all bundled distributions ininc/ for a newer module than can be found in the existing@INC array.

Thus, the module-name provided should usually be the "top-level" module name of a distribution, though this is not strictly required.inc::latest has a number of heuristics to discover module names, allowing users to do things like this:

use inc::latest 'Devel::AssertOS::Unix';

even though Devel::AssertOS::Unix is contained within the Devel-CheckOS distribution.

At the current time, packlists are required. Thus, bundling dual-core modules may require a 'forced install' over versions in the latest version of perl in order to create the necessary packlist for bundling.

Managing dependency chains

Before bundling a distribution you must ensure that all prerequisites are also bundled and load in the correct order.

For example, if you needWibble, butWibble depends onWobble, and you have bundledModule::Build, yourBuild.PL might look like this:

use inc::latest 'Wobble';use inc::latest 'Wibble';use inc::latest 'Module::Build';Module::Build->new(  module_name => 'Foo::Bar',  license => 'perl',)->create_build_script;

Authors are strongly suggested to limit the bundling of additional dependencies if at all possible and to carefully test their distribution tarballs before uploading to CPAN.

USAGE

As bundled in inc/

Using"Author-mode", a special stub module will be created in your distribute directory asinc/latest.pm. In yourMakefile.PL orBuild.PL, you can then loadinc::latest to load bundled modules.

When callinguse, the bundledinc::latest takes a single module name and optional arguments to pass to that module's own import method.

use inc::latest 'Foo::Bar' qw/foo bar baz/;

The implementation is private. Only theimport method is public.

Author-mode

When you haveinc::latest installed from CPAN, then you are in author-mode if any of the Author-mode methods are available. For example:

if ( inc::latest->can('write') ) {  inc::latest->write('inc');}

Using author-mode, you can create the stubinc/latest.pm and bundle modules intoinc.

loaded_modules()
my @list = inc::latest->loaded_modules;

This takes no arguments and always returns a list of module names requested for loading via "use inc::latest 'MODULE'", regardless of whether the load was successful or not.

write()
inc::latest->write( 'inc' );

This writes the bundled version of inc::latest to the directory name given as an argument. It almost all cases, it should be 'inc'.

bundle_module()
for my $mod ( inc::latest->loaded_modules ) {  inc::latest->bundle_module($mod, $dir);}

If $mod corresponds to a packlist, then this function creates a specially-named directory in $dir and copies all .pm files from the modlist to the new directory (which almost always should just be 'inc'). For example, if Foo::Bar is the name of the module, and $dir is 'inc', then the directory would be 'inc/inc_Foo-Bar' and contain files like this:

inc/inc_Foo-Bar/Foo/Bar.pm

Currently, $modmust have a packlist. If this is not the case (e.g. for a dual-core module), then the bundling will fail. You may be able to create a packlist by forced installing the module on top of the version that came with core Perl.

SUPPORT

Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker athttps://github.com/dagolden/inc-latest/issues. You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

https://github.com/dagolden/inc-latest

git clone https://github.com/dagolden/inc-latest.git

AUTHORS

  • David Golden <dagolden@cpan.org>

  • Eric Wilhelm <ewilhelm@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2009 by David Golden.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

Module Install Instructions

To install inc::latest, copy and paste the appropriate command in to your terminal.

cpanm

cpanm inc::latest

CPAN shell

perl -MCPAN -e shellinstall inc::latest

For more information on module installation, please visitthe detailed CPAN module installation guide.

Keyboard Shortcuts

Global
sFocus search bar
?Bring up this help dialog
GitHub
gpGo to pull requests
gigo to github issues (only if github is preferred repository)
POD
gaGo to author
gcGo to changes
giGo to issues
gdGo to dist
grGo to repository/SCM
gsGo to source
gbGo to file browse
Search terms
module: (e.g.module:Plugin)
distribution: (e.g.distribution:Dancer auth)
author: (e.g.author:SONGMU Redis)
version: (e.g.version:1.00)

[8]ページ先頭

©2009-2025 Movatter.jp