Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: In praise of h2xs: A tool you gotta have

by hossman (Prior)
on Mar 30, 2004 at 00:36 UTC ( #340807=note: print w/ replies, xml ) Need Help??


in reply to Re: In praise of h2xs: A tool you gotta have
in thread In praise of h2xs: A tool you gotta have

Even after reading the thread you cite, i still think the statement "it makes broken file layouts" is missleading.

It doesn't make the exact directory structure that you will ultimately have once the module is installed, it makes *a* directory structure designed to let you easily group all files related to the distribution "Foo::Bar" in one directory in your "development" directory, and files related to "Foo" in a seperate directory under your development directory -- so they don't get bundled together by mistake.

The generated Makefile.pl should "Do the Right Thing" and find your module when it comes time to install it.

You can allways install it into "./test_lib" to confirm that the installed directory structure is correct, and that the module works.


Comment on Re: Re: In praise of h2xs: A tool you gotta have
Re: Re: Re: In praise of h2xs: A tool you gotta have
by perrin (Chancellor) on Mar 30, 2004 at 01:42 UTC
    Michael Schwern, maintainer of ExtUtils::MakeMaker, also called it broken and said he wanted to fix it at some point. It makes a layout which is practical only if you are doing an XS module with an actual compile step. For pure perl modules, it is very annoying to develop within. Either you have to keep installing it every time you edit the file, or you mess with @INC and edit it within the blib/ directory (where it goes when you do the make) and then copy it back into place when you finish. It's even worse if you have multiple modules in your distribution with different namespaces (i.e. Foo::Something and Bar::Something). I have seen people other than me get extremely confused by the h2xs structure. Basically, I can't see a good reason to use when ExtUtils::ModuleMaker exists.
      Michael Schwern, maintainer of ExtUtils::MakeMaker, also called it broken and said he wanted to fix it at some point.

      While these days I just grab my default module template from my code repository, since at least 5.8 you get a sensible default layout with h2xs:

      % h2xs --use-new-tests -AXn Foo::Bar::Ni Defaulting to backwards compatibility with perl 5.8.3 If you intend this module to be compatible with earlier perl versions, + please specify a minimum perl version with the -b option. Writing Foo-Bar-Ni/lib/Foo/Bar/Ni.pm Writing Foo-Bar-Ni/Makefile.PL Writing Foo-Bar-Ni/README Writing Foo-Bar-Ni/t/Foo-Bar-Ni.t Writing Foo-Bar-Ni/Changes Writing Foo-Bar-Ni/MANIFEST % ls Foo-Bar-Ni/ Changes Makefile.PL lib MANIFEST README t % ls -lR Foo-Bar-Ni/lib total 0 drwxrwxr-x 3 adrianh staff 102 30 Mar 12:52 Foo Foo-Bar-Ni/lib/Foo: total 0 drwxrwxr-x 3 adrianh staff 102 30 Mar 12:52 Bar Foo-Bar-Ni/lib/Foo/Bar: total 8 -rw-rw-r-- 1 adrianh staff 1756 30 Mar 12:52 Ni.pm
      Either you have to keep installing it every time you edit the file, or you mess with @INC and edit it within the blib/ directory (where it goes when you do the make) and then copy it back into place when you finish. It's even worse if you have multiple modules in your distribution with different namespaces (i.e. Foo::Something and Bar::Something).

      h2xs now puts things in DIST/lib so the old default layout problems you mention are simple to overcome with PERL5LIB and PERL5OPT.

        That looks very helpful. Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://340807]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2014-09-01 07:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (299 votes), past polls