How to install self written modules
jeanluca
created: 2006-03-03 10:11:55
Dear Monks
I think I pretty much figured out how to install one module:
   
  > h2xs -AX ABC::Test
change the file Test.pm and install it.
However, what will happen if I would like to install 2 modules, Test.pm and Test1.pm...... What should my h2xs command look like ? The above command only installs Test.pm. I've tried:
  > h2xs -AX ABC
But this creates a file ABC.pm, somehow I don't think that is what I want, I want my modules inside the directory ABC
Any suggestions ?

Thanks in advance
Luca
Re: How to install self written modules
created: 2006-03-03 10:14:39
You make it two modules.
cd mod_working_dir
> h2xs -AX ABC::Test
> h2xs -AX ABC::Test1

-Lee
"To be civilized is to deny one's nature."
Re^2: How to install self written modules
created: 2006-03-03 10:33:56
Ok, so you have to do
perl Makefile.PL
make 
make install
for each module ?
What if I've 100 modules ? Do I have to write a install script ?

Luca
Re^3: How to install self written modules
created: 2006-03-03 10:39:05
I've not done a lot of modification to module installation scripts. There might be an easy and obvious solution (damn if I know though)

You could make a script to make and install them all. Not that good with Make but you could probably right a makefile as well to handle the task.

I'm getting the impression that you're after plugins. If so, 100 seems like a lot for any medium.

May I ask what exactly you're trying to do?

-Lee
"To be civilized is to deny one's nature."
Re^4: How to install self written modules
created: 2006-03-03 10:45:19
Maybe plugins is the solutions, but Idon't know nothing about them.
Anyway I'm writing a tool that can process data, different types of data. For each type of data I've a couple of modules which know how to deal with this data. So with time more and more types of data can be included, just by adding new modules that know how to deal with this data.

Any suggestions what my approach for installing them should be ?

Tnx
Luca
Re^5: How to install self written modules
created: 2006-03-03 14:20:15
Whether plugins are the right or wrong way, depends on your problem. Do you want to be able to have everything in one monolithic module or a number of smaller ones.

A good example of were plugins make sense is playing music. No matter what type of file or hardware, you basically have one goal.

DECODE -> DSP? -> PLAY

This is ideal for plugins as you can just "plug-in" the code that knows how to decode the input format. New formats come along? Just write a new plugin. Same with outputting to the hardware.

Whant to have some DSP effects? You set up common hooks and then can "just add" DSP plugins with the proper interface and it all just works (in theory).

-Lee
"To be civilized is to deny one's nature."
Re: How to install self written modules
created: 2006-03-03 11:10:10
You can put both modules under 1 distribution by putting them under a lib directory.
 > h2xs -AX ABC::Test
 > cd ABC/Test
 > mkdir lib
 > mkdir lib/ABC
 > mv Test.pm lib/ABC
 > cp lib/ABC/Test.pm lib/ABC/Test1.pm 

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Re^2: How to install self written modules
created: 2006-03-04 07:05:29
I like this approach, but what should you change inside the Makefile.PL:
use 5.008007;
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    NAME              => 'ABC::Test',
    VERSION_FROM      => 'lib/ABC/Test.pm', # finds $VERSION
    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
    ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
      (ABSTRACT_FROM  => 'lib/ABC/Test.pm', # retrieve abstract from module
       AUTHOR         => 'A. U. Thor ') : ()),
);
Howto include Test1.pm ?

Luca
Re^3: How to install self written modules
created: 2006-03-06 05:05:24

There's no need to put anything about Test1.pm in the Makefile.PL, as MakeMaker globs the entire lib tree. You can use this to add other modules as dependencies to PREREQ_PM if you need any others packaged separately, or indeed CPAN modules.

You probably want to take out the line use 5.008007; that h2xs put in, as you are not really dependent on this version of Perl.

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Re: How to install self written modules
created: 2006-03-04 09:08:57
Uhm, wouldn't just adding ABC/Test1.pm to your MANIFEST do the trick? Or is that too obvious?
Re^2: How to install self written modules
created: 2006-03-04 15:16:11
Oh, MANIFEST..... where can I read more about this stuff ?

Thanks
Luca
Re^3: How to install self written modules
created: 2006-03-05 21:07:00
Basically, your MANIFEST is a list of all the files that should go into your distribution when you type "make dist". You can probably find way more info than you ever wanted at ExtUtils::MakeMaker, or ExtUtils::Manifest, or Module::Build, or Module::Install, or Module::Starter :)

perlmonks.org content © perlmonks.org and jeanluca, rhesa, rinceWind, shotgunefx

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03