Module-MetaInfo

 view release on metacpan or  search on metacpan

lib/Module/MetaInfo.pm  view on Meta::CPAN

=head1 FUTURE FUNCTIONS

There are a number of other things which should be implemented.  These
can be guessed from looking at the possible meta-information which can
be stored in the RPM or DPG formats, for example.  Examples include:

=over 4

=item *

copyright - GPL / as perl / redistributable / etc.

=item *

application area - Database / Internet / WWW / HTTP etc.

=item *

suggests - related applications

=back

In many cases this data is generated currently by package building
tools simply by using a fixed string.  The function should do better
than that in almost all cases or else it is't worth having...

=head1 COPYRIGHT

You may distribute under the terms of either the GNU General Public
License, version 2 or (at your option) later or the Artistic License,
as specified in the Perl README.

=head1 BUGS 

Please see bugs in sub modules.  Especially warnings in
C<Module::MetaInfo::_Exctractor>.

=head1 AUTHOR

Michael De La Rue.

=head1 SEE ALSO

L<pm-metainfo>

=cut


sub AUTOLOAD {
  (my $sub = $AUTOLOAD) =~ s/.*:://;
  $sub =~ m/^DESTROY$/ && return;
  my $self=shift;
  croak "Function call into Module::MetaInfo wasn't a method call"
    unless ref $self;
  my $tried=0;
  my $return=undef;
 FINDER: foreach my $mod (@{$self->{metafinders}}) {
    print "try $sub in " . ref ($mod) . "\n" if ${$self->{'_verbose'}};
    if (  $mod->can($sub) ) {
      $tried++;
      #how should I cascade the effect of wantarray efficiently?
      my $return=$mod->$sub();
      if (defined $return) {
	my $ref=ref $return;
	if ($ref) {
	  die "meta info functions should only return array refs"
	    unless $ref=~m/^ARRAY/;
	  return wantarray ? @$return : $return;
	}
	return $return;
      }
    }
  }
  print STDERR "no metainfo module could provide $sub\n"
    if ${$self->{'_verbose'}};
  return undef if $tried;
  die "No function $sub defined for retrieving meta information";
}

42;



( run in 1.645 second using v1.01-cache-2.11-cpan-5b529ec07f3 )