[Module-build-checkins] Module-Build/lib/Module/Build Base.pm,1.509,1.510
Status: Beta
Brought to you by:
kwilliams
From: Randy W. S. <si...@us...> - 2005-10-25 21:18:21
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30704/lib/Module/Build Modified Files: Base.pm Log Message: Searching for the main POD document can fail when using 'dist_name' instead of 'module_name in construction. Added consitency to here-documents labels. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.509 retrieving revision 1.510 diff -u -d -r1.509 -r1.510 --- Base.pm 25 Oct 2005 20:26:01 -0000 1.509 +++ Base.pm 25 Oct 2005 21:18:13 -0000 1.510 @@ -727,7 +727,10 @@ my ($self) = @_; my $p = $self->{properties}; if ($self->module_name) { - $p->{dist_version_from} ||= join( '/', 'lib', split '::', $self->module_name ) . '.pm'; + return $p->{dist_version_from} ||= + join( '/', 'lib', split(/::/, $self->module_name) ) . '.pm'; + } else { + return undef; } } @@ -941,12 +944,12 @@ } } - $self->log_warn(<<'ERRSTR'); + $self->log_warn(<<EOF); ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation -ERRSTR +EOF return 0; } else { @@ -2514,17 +2517,27 @@ my $parser = eval {require Pod::Readme; 1} ? Pod::Readme->new : eval {require Pod::Text; 1} ? Pod::Text->new : die "Can't load Pod::Readme or Pod::Text to create README"; - $self->log_info("Creating README using " . ref($parser) . "\n"); - $parser->parse_from_file($self->_main_docfile, 'README', @_); - $self->_add_to_manifest('MANIFEST', 'README'); + if ( my $docfile = $self->_main_docfile ) { + $self->log_info("Creating README using " . ref($parser) . "\n"); + $parser->parse_from_file($self->_main_docfile, 'README', @_); + $self->_add_to_manifest('MANIFEST', 'README'); + } else { + $self->log_warn(<<EOF); +Cannot create README; can't determine which file contains documentation; +Must supply either 'dist_version_from', or 'module_name' parameter. +EOF + } } sub _main_docfile { my $self = shift; $self->_find_dist_version_from; - my $pm_file = $self->dist_version_from; - (my $pod_file = $pm_file) =~ s/.pm$/.pod/; - return (-e $pod_file ? $pod_file : $pm_file); + if ( my $pm_file = $self->dist_version_from ) { + (my $pod_file = $pm_file) =~ s/.pm$/.pod/; + return (-e $pod_file ? $pod_file : $pm_file); + } else { + return undef; + } } sub ACTION_distdir { @@ -2751,7 +2764,7 @@ # XXX Add the meta_add & meta_merge stuff - print $fh <<"END_OF_META"; + print $fh <<"EOF"; --- #YAML:1.0 name: $p->{dist_name} version: $p->{dist_version} @@ -2760,7 +2773,7 @@ abstract: @{[ $self->dist_abstract ]} license: $p->{license} generated_by: Module::Build version $Module::Build::VERSION, without YAML.pm -END_OF_META +EOF } sub ACTION_distmeta { @@ -2816,10 +2829,12 @@ $self->{wrote_metadata} = $yaml_sub->($metafile, $node ); } else { - $self->log_warn(<<EOM); -\nCouldn't load YAML.pm, generating a minimal META.yml without it. -Please check and edit the generated metadata, or consider installing YAML.pm.\n -EOM + $self->log_warn(<<EOF); + +Couldn't load YAML.pm, generating a minimal META.yml without it. +Please check and edit the generated metadata, or consider installing YAML.pm. + +EOF $self->_write_minimal_metadata; } |