Hi Brian,

I have been working on perl-plugin-tools which allows one to create maven
plugins written in perl.  This is based on BSF technology [1,2].  I'm taking a
slightly different approach in that I generate a java layer to inject the
perl plugin with mojo parameters via setters only.  Thus there is a
code-generation step involved, and plugin parameters are specified
in the plugin project pom.  The end result is a standard java plugin
as far as maven is concerned, and pure perl as far as the perl-mojo
developer is concerned.  The perl-mojo code is very uncluttered since the java
layer injects it with a single perl object containing getters to access the
mojo parameters.

In concert, I'm developing an unpack plugin that will cache the contents of a 
maven artifact
in the local build repository according to it's jar manifest, and from that 
generate
the perl @INC (Include) variable so that perl can have access to shared 
scripting libraries.
The unpack plugin is similar to the nar plugin approach, but much simpler 
overall.
(In fact, I stole some of the code in the maven-dependency-plugin to do the 
unpack part. :)

In addition, I have several plugins in mind that will wrapper some existing 
perl tools.
Some of these may be useful to the community as well.

Since the perl toolkit and unpack plugins are fundamental plugins,
I think they should go to codehaus but I'm open to suggestions...

I'm not done yet... but would like a place to start staging things since this
is a fairly large piece of development.  I do have a working prototype; see 
below.

thx,
-Russ

[1] http://jakarta.apache.org/bsf/
[2] http://bsfperl.sourceforge.net/

Output from perl mojo test:

tanami{rtmojo.155} smvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building zip-mojo-test
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Not compiling test sources
[INFO] [surefire:test]
[INFO] Tests are skipped.
[INFO] [jar:jar]
[WARNING] JAR will be empty - no content was marked for inclusion!
CONSTRUCTING ZipMojoImpl
INJECTING __0mojos
initPerlContext
ATTEMPTING TO SET DEPENDENCY CLASSPATH
ATTEMPTING TO LOAD PERL ENGINE
REGISTERED PERL ENGINE.
ATTEMPTING TO INSTANTIATE PERL WRAPPER OBJECT
INSTANTIATED PERL WRAPPER OBJECT
ATTEMPTING TO INSTANTIATE PERL MOJO IMPLEMENTATION
SETTING PERL EXECUTION ENVIRONMENT
INSTANTIATED PERL MOJO IMPLEMENTATION
INJECTING 'artifactId' of type 'String'
PERL MOJO WRAPPER: INJECTING 'artifactId' of type 'String'
INJECTING 'basedir' of type 'String'
PERL MOJO WRAPPER: INJECTING 'basedir' of type 'String'
INJECTING 'buildDirectory' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildDirectory' of type 'String'
INJECTING 'buildFinalName' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildFinalName' of type 'String'
INJECTING 'buildOutputDirectory' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildOutputDirectory' of type 'String'
INJECTING 'buildSourceDirectory' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildSourceDirectory' of type 'String'
INJECTING 'buildTestOutputDirectory' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildTestOutputDirectory' of type 'String'
INJECTING 'buildTestSourceDirectory' of type 'String'
PERL MOJO WRAPPER: INJECTING 'buildTestSourceDirectory' of type 'String'
INJECTING 'localRepository' of type 'String'
PERL MOJO WRAPPER: INJECTING 'localRepository' of type 'String'
INJECTING 'projectPackaging' of type 'String'
PERL MOJO WRAPPER: INJECTING 'projectPackaging' of type 'String'
INJECTING 'projectVersion' of type 'String'
PERL MOJO WRAPPER: INJECTING 'projectVersion' of type 'String'
INJECTING 'timeout' of type 'Integer'
PERL MOJO WRAPPER: INJECTING 'timeout' of type 'Integer'

[INFO] [zip:zip {execution: zip-mojo-test}]
EXECUTE PERL MOJO FROM JAVA
PERL MOJO : EXECUTE with 'configObj'
excludes is 'UNDEFINED'
includes is 'UNDEFINED'
timeout is '100'
projectUrl is 'UNDEFINED'
basedir is '/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test'
artifactId is 'zip-mojo-test'
buildDirectory is 
'/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test/target'
buildFinalName is 'zip-mojo-test-1.0-SNAPSHOT'
buildOutputDirectory is 
'/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test/target/classes'
buildSourceDirectory is 
'/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test/src/main/java'
buildTestOutputDirectory is 
'/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test/target/test-classes'
buildTestSourceDirectory is 
'/Users/russt/proj/rtmojo/zip-mojo/srcgen/bld/zip-mojo/test/src/test/java'
projectPackaging is 'jar'
projectVersion is '1.0-SNAPSHOT'
localRepository is '/Users/russt/proj/rtmojo/m2/repository'

WORLD'S FIRST PERL MOJO IS CALLING WALKDIR WITH ARGS: '-crc -nocvs -f'
--------------------------------------------------------------------------------
908A1F7D ./pom.xml
FAA9EA3A ./target/zip-mojo-test-1.0-SNAPSHOT.jar
DE37FC9B ./target/maven-archiver/pom.properties
--------------------------------------------------------------------------------

WALKDIR RETURNED WITH STATUS 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Thu Jul 10 12:01:15 PDT 2008
[INFO] Final Memory: 8M/14M
[INFO] ------------------------------------------------------------------------


Source to the perl mojo:

#
#ZipMojoImpl - test implementation of a perl mojo
#

use strict;

package ZipMojoImpl;
my $pkgname = __PACKAGE__;

#imports:
require "walkdir.pl";

#package variables:

sub new
{
    my ($invocant) = @_;
    shift @_;

    #allows this constructor to be invoked with reference or with explicit 
package name:
    my $class = ref($invocant) || $invocant;

    #set up class attribute  hash and bless it into class:
    my $self = bless {
        }, $class;

    #post-attribute init after we bless our $self (allows use of accessor 
methods):

    return $self;
}

sub getMojoConfig
{
    my ($self) = @_;
    return $self->{'mMojoConfig'};
}

sub execute
#Usage:  obj->execute(configObj)
#REQUIRED.
#this sets our configuration to wrapper and executes the mojo.
{
    my ($self, $configObj) = @_;

    #wrapper passes in configuration object.  use it to fetch mojo parameters:
    $self->{'mMojoConfig'} = $configObj;

    printf("PERL MOJO : EXECUTE with 'configObj'\n", ref($configObj));

    #call local routine to implement mojo:
    $self->doMojoStuff();
}

################################### PACKAGE ####################################

sub doMojoStuff()
{
    my ($self) = @_;
    my ($cfg) = $self->getMojoConfig();

    #dump the mojo parameters:
    $cfg->dumpMojoConfiguration();

    local (@ARGV) = qw(-crc -nocvs -f);

    printf "\nWORLD'S FIRST PERL MOJO IS CALLING WALKDIR WITH ARGS: '%s'\n", 
join(" ", @ARGV);
    &hdr();
    my $status = &walkdir::main(*ARGV, *ENV);
    &hdr();
    printf "\nWALKDIR RETURNED WITH STATUS %d\n", $status;
}

sub hdr
{
    printf "%s\n", "-" x 80;
}

#return an instance of this object to java:
return(new ZipMojoImpl());



At 4:21 PM -0400 7/16/08, Brian E. Fox wrote:
>Hi Russ,
>What's the plugin? The process at codehaus is usually to attach it to a
>jira and then try to find someone to sponsor it.
>
>-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, July 16, 2008 2:40 PM
>To: Adam
>Cc: Maven Users List
>Subject: Re: newbie plugin developer questions..
>
>I need a place to check it in.  I was thinking about checking it in on
>mojo.codehaus.org.
>However, haven't been able to raise a response there following the
>procedures on http://mojo.codehaus.org
>(which is basically just send an email to the dev list).
>
>There are some other pages that say to submit a jira; so maybe I should
>try that.
>
>thanks!
>-Russ
>
>At 1:21 PM -0400 7/16/08, Adam wrote:
>>http://maven.apache.org/plugin-developers/index.html
>>
>>Or do you mean you have one done and would like to make it available?
>>If so, you might want to have it somewhere like Sourceforge, and have
>>your repository rsync'd with Ibiblio.
>>
>>On Wed, Jul 16, 2008 at 1:16 PM, Russ Tremain <[EMAIL PROTECTED]>
>wrote:
>>> anyone know how to get started contributing a new plugin?
>>>
>>> tia,
>>> -Russ
>>>
>>>
>>>>Date: Fri, 11 Jul 2008 13:14:30 -0700
>>>>From: Russ Tremain <[EMAIL PROTECTED]>
>>>>Subject: [mojo-dev] newbie plugin developer questions..
>>>>Sender: [EMAIL PROTECTED]
>> >>To: [EMAIL PROTECTED]
>>>>Reply-to: [EMAIL PROTECTED]
>>>>Delivered-to: mailing list [EMAIL PROTECTED]
>>>>Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
>>>>List-Post: <http://xircles.codehaus.org/manage_email>
>>>>List-Subscribe: <http://xircles.codehaus.org/manage_email>
>>>>List-Unsubscribe: <http://xircles.codehaus.org/manage_email>
>>>>List-Help: <http://xircles.codehaus.org/manage_email>
>>>>List-Id: <dev.mojo.codehaus.org>
>>>>Original-recipient: rfc822;[EMAIL PROTECTED]
>>>>
>>>>Hi,
>>>>
>>>>I've been developing a perl plugin toolkit, and I'm thinking about
>which community
>>>>I should contribute it to.
>>>>
>>>>Would this be a good site, and if so, how do I go about setting up a
>new project?
>>>>
>>>>Also, is there another list more appropriate for questions like this
>(developer help)?
>>>>Most of the email on this list seems to be generated by JIRA
>automation.
>>>>
>>>>Many thanks,
>>>>-Russ
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>
>>
>>
>>--
>>Adam
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to