Sha256: c632dd9b2cdc38017652ac0db4536e86e93cbabc14eb7f01d0c9337461b1b0b4

Contents?: true

Size: 1.4 KB

Versions: 57

Compression:

Stored size: 1.4 KB

Contents

package Module::Build::PodParser;

use strict;
use warnings;
our $VERSION = '0.4234';
$VERSION = eval $VERSION;

sub new {
  # Perl is so fun.
  my $package = shift;

  my $self;
  $self = bless {have_pod_parser => 0, @_}, $package;

  unless ($self->{fh}) {
    die "No 'file' or 'fh' parameter given" unless $self->{file};
    open($self->{fh}, '<', $self->{file}) or die "Couldn't open $self->{file}: $!";
  }

  return $self;
}

sub parse_from_filehandle {
  my ($self, $fh) = @_;

  local $_;
  while (<$fh>) {
    next unless /^ =encoding \s+ (\S+)/ix;
    binmode $fh, ":encoding($1)";
    last;
  }
  seek $fh, 0, 0;

  while (<$fh>) {
    next unless /^=(?!cut)/ .. /^=cut/;  # in POD
    # Accept Name - abstract or C<Name> - abstract
    last if ($self->{abstract}) = /^ (?: [a-z_0-9:]+ | [BCIF] < [a-z_0-9:]+ > ) \s+ - \s+ (.*\S) /ix;
  }

  my @author;
  while (<$fh>) {
    next unless /^=head1\s+AUTHORS?/i ... /^=/;
    next if /^=/;
    push @author, $_ if /\@/;
  }
  return unless @author;
  s/^\s+|\s+$//g foreach @author;

  $self->{author} = \@author;

  return;
}

sub get_abstract {
  my $self = shift;
  return $self->{abstract} if defined $self->{abstract};

  $self->parse_from_filehandle($self->{fh});

  return $self->{abstract};
}

sub get_author {
  my $self = shift;
  return $self->{author} if defined $self->{author};

  $self->parse_from_filehandle($self->{fh});

  return $self->{author} || [];
}

Version data entries

57 entries across 33 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.5.7 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.6 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.5 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.4 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.3 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.2 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.1 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.5.0 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.11 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.10 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.9 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.8 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.7 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.6 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm
javonet-ruby-sdk-2.4.5 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/Module/Build/PodParser.pm