How to distribute perl over modules

KildClient forum.
Post Reply
Posts: 7
Joined: Mon Feb 06, 2012 10:20 pm

How to distribute perl over modules

Post by rumex »

[Original came from the Nabble forum]

I want to separate my perl into files (modules) without having to create a plugin.
How do I instruct kildclient to honour 'use x;' statements? Normally this is via @PERL5LIB or @INC. I've tried setting these, but the use statements are not finding the files.

Did you set PERL5LIB before you invoked kildclient. The following works for me...
- contents of file
package tt;
sub tttt
print "yyyesss\n";
print "tt loaded\n";
- extract of contents of my file which is loaded at startup by kildclient
use Data::Dumper qw(Dumper);
use tt;
- in unix bash, assuming the file is in the current directory
$export PERL5LIB=`pwd`
- in kildclient input window type
- The output in the bash window I started kildclient is...
tt loaded

Thanks, I didn't want to have to set an external environment variable. I sorted it by using require rather than use as in:
The harness loaded by kildclient was:
use strict;
push @INC, "/tmp/lib";
require "";

use testLibStub; # does not work

print "finished\n";

and the stub library in a file /tmp/lib/ looked like:
package testLibStub;

print "testLibStub loading\n";
sub makeNoise
print "noise\n";

Posts: 19
Joined: Mon Jun 04, 2012 4:59 am

Re: How to distribute perl over modules

Post by jmud »

So. You want one KildClient plugin, but several Perl modules, yes?

This is how I did it:

Code: Select all

package jmud;
#: Version: 1.0.13 22-04-13
#: Description: JMud plugin for Kildclient (and other compatible hosts)
#: Author: A S Lewis

use strict;
use diagnostics;
use warnings;


    # Minimum standards for Perl
    require 5.008;

    # Get the JMud directory
    require File::Basename;
    my $dir = File::Basename::dirname(__FILE__);

    # Put all JMud directories, and all subdirectories which contain Perl modules which form part of
    #   this script, into @INC
    push (@INC,
        $dir,                       #
        $dir . '/include',          # Most of the .pm modules
        $dir . '/jbasiclib',        # JBasic gets its own directory...
        $dir . '/jbasiclib/JBasic', # ...and subdirectory
#       $dir . '/public',           # Examples of how to write .pm modules for yourself
        $dir . '/private',          # .pm modules that you write yourself go here

    # Load JMud modules from '/include'
    require automap;
    require commands;
    require definitions;
    require editwin;
    require generics;
    require gui;
    require mainloop;
    require mudmodel;
    require objects;
    require setup;
    require tasks;
    require templates;
    require wrapper;
    # Load JBasic modules from '/jbasiclib' and '/jbasiclib/JBasic'
    require JBasic;
    require Expression;
    require Function;
    require Statement;
    require Subroutine;
    require Variable;
    # Load JMud modules from '/public'
#   require public;
    # Load JMud modules from '/private' (if commented out, the call to &jmud::privateSetup in
    #   &start must also be commented out)
    require private;
Posts: 7
Joined: Mon Feb 06, 2012 10:20 pm

Re: How to distribute perl over modules

Post by rumex »

nice, thanks
Posts: 1
Joined: Thu Apr 24, 2014 9:16 pm

How to distribute perl over modules

Post by AwamaprCB »

Hi Subba Rao,
By using adlicmgr, Ive added the required modules. I notice that, by using it, we can not remove any licence. Also in the last, its message that, another task need to done, but didnt tell that, what is that task.

Thanks for your help.
Post Reply