Commits

Anonymous committed 523ce1c

Converted to use File::ShareDir for the extradata directory.

This was done per the advice given here:

1. http://www.nntp.perl.org/group/perl.module.build/2010/10/msg2765.html .

Comments (0)

Files changed (2)

XML-Grammar-Fortune/module/inc/XML/Grammar/Builder.pm

 
 use File::Find;
 
-our $VERSION = '0.0101';
+our $VERSION = '0.0200';
 
 sub new
 {
     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)
-        },
+        share_dir => 'extradata',
+        auto_configure_requires => 1,
         @_
     );
 
-    $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;
 }
 

XML-Grammar-Fortune/module/lib/XML/Grammar/Fortune.pm

 use XML::LibXML;
 use XML::LibXSLT;
 
-use XML::Grammar::Fortune::ConfigData;
+use File::ShareDir ':ALL';
 
 use base 'Class::Accessor';
 
 
     $self->_output_mode($args->{output_mode} || "filename");
 
-    my $data_dir = $args->{'data_dir'} ||
-        XML::Grammar::Fortune::ConfigData->config('extradata_install_path')->[0];
+    my $data_dir = $args->{'data_dir'} || dist_dir( 'XML-Grammar-Fortune' );
 
     $self->_data_dir($data_dir);