develooper Front page | perl.module.build | Postings from October 2010

Re: How to properly install Data Files

Thread Previous | Thread Next
From:
David Golden
Date:
October 18, 2010 04:59
Subject:
Re: How to properly install Data Files
Message ID:
AANLkTikSm_rno7FoDQcBsue3CBbwCCyncWa2pZJ2N+_0@mail.gmail.com
If you use a more recent Module::Build, look at the "share_dir"
parameter and File::ShareDir.  That has been more widely tested than a
home-grown solution.

Regards,
David


On Mon, Oct 18, 2010 at 7:15 AM, Shlomi Fish <shlomif@iglu.org.il> wrote:
> Hi all,
>
> After I released a new version of XML-Grammar-Fortune-Synd, I got a lot of
> error reports from the CPAN testers:
>
> http://www.cpantesters.org/distro/X/XML-Grammar-Fortune-Synd.html
>
> The problem is that the data file installed by XML-Grammar-Fortune (its
> dependency) are not available for testing:
>
> http://search.cpan.org/dist/XML-Grammar-Fortune/
>
> So my question is: how can I install them properly? There's a repository for
> XML-Grammar-Fortune where you can see the Module-Build sub-class I used for
> that:
>
> http://svn.berlios.de/svnroot/repos/web-cpan/XML-Grammar-Fortune/trunk
>
> Currently I have:
>
> {{{
> package XML::Grammar::Builder;
>
> use strict;
> use warnings;
>
> use base 'Test::Run::Builder';
>
> use File::Find;
>
> our $VERSION = '0.0101';
>
> sub new
> {
>    my $package = shift;
>    my %args = @_;
>    my @extradata_files;
>
>    my $module_name = $args{'module_name'};
>    $module_name =~ s{::}{-}g;
>
>    my $filter_files_cb = sub {
>        my $filename = $File::Find::name;
>        if ((-f $filename) &&
>            ($filename =~ /\.(?:mod|xslt|dtd|ent|cat|jpg|rng|xcf\.bz2)$/)
>        )
>        {
>            push @extradata_files, $filename;
>        }
>    };
>
>    find({ wanted => $filter_files_cb, no_chdir => 1}, "extradata");
>
>    my $builder = $package->SUPER::new(
>        extradata_files =>
>        {
>            (map { $_ => $_ } @extradata_files)
>        },
>        @_
>    );
>
>    $builder->add_build_element('extradata');
>
>    $builder->install_path()->{'extradata'} =
>        File::Spec->catdir(
>                $builder->install_destination("lib"),
>                qw(data modules),
>                $module_name,
>                qw(data)
>        );
>
>    $builder->config_data(
>        'extradata_install_path' =>
>        [$builder->install_path()->{'extradata'}]
>    );
>
>    return $builder;
> }
>
>
> =begin excluded
>
>    my $get_dest_extradata_cb = sub {
>        my $fn = shift;
>
>        # Trying if this makes it work.
>        # TODO : Either remove this line or the rest of the lines.
>        return $fn;
>
>        $fn =~ s{^extradata}{data};
>        return "lib/$module_name/$fn";
>    };
>
> =end excluded
>
> =cut
>
> 1;
> }}}
>
> Regards,
>
>        Shlomi Fish
>
> --
> -----------------------------------------------------------------
> Shlomi Fish       http://www.shlomifish.org/
> Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/
>
> <rindolf> She's a hot chick. But she smokes.
> <go|dfish> She can smoke as long as she's smokin'.
>
> Please reply to list if it's a mailing list post - http://shlom.in/reply .
>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About