h2xs & perl module creation 
Author Message
 h2xs & perl module creation

Hi guys,

I want to create 3 modules, 2 to be used by applications and a 3rd
helper one.

I decided to start using the h2xs in order to generate my module
templates and also to be able to post them to CPAN, if I do a realy
good job :-)

Now this is what I did to create them:

Quote:
> h2xs -X -v 0.01 -n HTTPRPC::Client

Writing HTTPRPC/GVClient/GVClient.pm
Writing HTTPRPC/GVClient/Makefile.PL
Writing HTTPRPC/GVClient/test.pl
Writing HTTPRPC/GVClient/Changes
Writing HTTPRPC/GVClient/MANIFEST
Quote:
> h2xs -X -v 0.01 -n HTTPRPC::Server

Writing HTTPRPC/GVServer/GVServer.pm
Writing HTTPRPC/GVServer/Makefile.PL
Writing HTTPRPC/GVServer/test.pl
Writing HTTPRPC/GVServer/Changes
Writing HTTPRPC/GVServer/MANIFEST

Now the questions:
1) For them being in different directories to start with, it makes it
harder to develop/debug; is there anyway I can force them to be placed
under the same dir, using the h2xs tool?
2) Where do I place the helper module do I create another module using
h2xs?

I am a bit confused.  I have checked www.perldoc.com, www.perl.com,
www.cpan.org, etc, but I got no (or didn't find a) satisfactory
answer.

thanks,

George



Mon, 23 Feb 2004 05:30:29 GMT  
 h2xs & perl module creation

Quote:

> I decided to start using the h2xs in order to generate my module
> templates and also to be able to post them to CPAN, if I do a realy
> good job :-)
> Now this is what I did to create them:
> > h2xs -X -v 0.01 -n HTTPRPC::Client
> > h2xs -X -v 0.01 -n HTTPRPC::Server
> 1) For them being in different directories to start with, it makes it
> harder to develop/debug; is there anyway I can force them to be placed
> under the same dir, using the h2xs tool?

just use one directory where you can place all of your modules:

     h2xs -X -v 0.01 -n HTTPRPC

create the .pm files and add them to MANIFEST.

then, in your Makefile.PL, add a PM key (see ExtUtils::MakeMaker)
that tells make where to put the modules

    'PM' => { 'Server.pm' => '$(INST_LIBDIR)/Server/Server.pm',
              'Client.pm' => '$(INST_LIBDIR)/Client/Client.pm' }

panix3_comdog[2291]$ more Makefile.PL
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
    'NAME'              => 'HTTPRPC',
    'VERSION_FROM'      => 'HTTPRPC.pm', # finds $VERSION
    'PREREQ_PM'         => {}, # e.g., Module::Name => 1.1
    'PM' => { 'Server.pm' => '$(INST_LIBDIR)/Server/Server.pm',
              'Client.pm' => '$(INST_LIBDIR)/Client/Client.pm' }
);

panix3_comdog[2292]$ ls      
Changes      HTTPRPC.pm   Makefile.PL  Server.pm
Client.pm    MANIFEST     Makefile.old test.pl

panix3_comdog[2293]$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for HTTPRPC

panix3_comdog[2294]$ make
mkdir blib
mkdir blib/lib
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/HTTPRPC
mkdir blib/lib/auto
mkdir blib/lib/auto/HTTPRPC
cp Server.pm blib/lib/Server/Server.pm
cp Client.pm blib/lib/Client/Client.pm

--

CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html



Mon, 23 Feb 2004 10:13:05 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ANN: Tut # 1 (reissued) Auto-generation of Perl module skeletons using h2xs

2. tree & forest creation/traversal in perl

3. tree & forest creation/traversal in perl

4. h2xs & enum

5. h2xs & typemap issue

6. h2xs question / creating a new module

7. multiple modules makefile and h2xs

8. writing modules with h2xs

9. Hints about External Module Creation?

10. creation of a francophone mailing list about modules

11. Help w/ module creation and access needed

12. dynamic module creation without shared libs?

 

 
Powered by phpBB® Forum Software