Padre::PluginBuilder - L<Module::Build> subclass for building Padre plug-ins


Padre documentation Contained in the Padre distribution.

Index


Code Index:

NAME

Top

Padre::PluginBuilder - Module::Build subclass for building Padre plug-ins

DESCRIPTION

Top

This is a Module::Build subclass that can be used in place of Module::Build for the Build.PL of Padre plug-ins. It adds two new build targets for the plug-ins:

ADDITIONAL BUILD TARGETS

Top

plugin

Generates a .par file that contains all the plug-in code. The name of the file will be according to the plug-in class name: Padre::Plugin::Foo will result in Foo.par.

Installing the plug-in (for the current architecture) will be as simple as copying the generated .par file into the plugins directory of the user's Padre configuration directory (which defaults to ~/.padre on Unix systems).

installplugin

Generates the plug-in .par file as the plugin target, but also installs it into the user's Padre plug-ins directory.

SEE ALSO

Top

Padre, Padre::Config

Module::Build

PAR for more on the plug-in system.

COPYRIGHT

Top

LICENSE

Top

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.


Padre documentation Contained in the Padre distribution.
package Padre::PluginBuilder;

use 5.008;
use strict;
use warnings;
use Module::Build   ();
use Padre::Constant ();

our $VERSION = '0.86';
our @ISA     = 'Module::Build';

sub ACTION_plugin {
	my ($self) = @_;

	# Need PAR::Dist
	# Don't make a dependency in the Padre Makefile.PL for this
	if ( not eval { require PAR::Dist; PAR::Dist->VERSION(0.17) } ) {
		$self->log_warn("In order to create .par files, you need to install PAR::Dist first.");
		return ();
	}
	$self->depends_on('build');
	my $module = $self->module_name;
	$module =~ s/^Padre::Plugin:://;
	$module =~ s/::/-/g;

	return PAR::Dist::blib_to_par(
		name    => $self->dist_name,
		version => $self->dist_version,
		dist    => "$module.par",
	);
}

sub ACTION_installplugin {
	my ($self) = @_;

	$self->depends_on('plugin');

	my $module = $self->module_name;
	$module =~ s/^Padre::Plugin:://;
	$module =~ s/::/-/g;
	my $plugin = "$module.par";

	require Padre;
	return $self->copy_if_modified(
		from   => $plugin,
		to_dir => Padre::Constant::PLUGIN_DIR,
	);
}

1;

__END__

# Copyright 2008-2011 The Padre development team as listed in Padre.pm.
# LICENSE
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl 5 itself.