Alien-Build

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      A Hash reference containing information about a file. See the fetch
      hook for details on the format.

    Returns true if the cryptographic signature matches, false if
    cryptographic signatures are disabled. Will throw an exception if the
    signature does not match, or if no plugin provides the correct
    algorithm for checking the signature.

 decode

     my $decoded_res = $build->decode($res);

    Decode the HTML or file listing returned by fetch. Returns the same
    hash structure described below in the decode hook documentation.

 prefer

     my $sorted_res = $build->prefer($res);

    Filter and sort candidates. The preferred candidate will be returned
    first in the list. The worst candidate will be returned last. Returns

lib/Alien/Build.pm  view on Meta::CPAN


=back

Returns true if the cryptographic signature matches, false if cryptographic
signatures are disabled.  Will throw an exception if the signature does not
match, or if no plugin provides the correct algorithm for checking the
signature.

=head2 decode

 my $decoded_res = $build->decode($res);

Decode the HTML or file listing returned by C<fetch>.  Returns the same
hash structure described below in the
L<decode hook|Alien::Build::Manual::PluginAuthor/"decode hook"> documentation.

=head2 prefer

 my $sorted_res = $build->prefer($res);

Filter and sort candidates.  The preferred candidate will be returned first in the list.

lib/Alien/Build/Plugin/Fetch/LWP.pm  view on Meta::CPAN

    my($type, $charset) = $res->content_type_charset;
    my $base            = $res->base;
    my $filename        = $res->filename;

    if($type eq 'text/html')
    {
      return {
        type     => 'html',
        charset  => $charset,
        base     => "$base",
        content  => $res->decoded_content || $res->content,
        protocol => $protocol,
      };
    }
    elsif($type eq 'text/ftp-dir-listing')
    {
      return {
        type     => 'dir_listing',
        base     => "$base",
        content  => $res->decoded_content || $res->content,
        protocol => $protocol,
      };
    }
    else
    {
      return {
        type     => 'file',
        filename => $filename || 'downloadedfile',
        content  => $res->content,
        protocol => $protocol,

t/alien_build.t  view on Meta::CPAN

    }),
    hash {
      field type     => 'list';
      field protocol => 'http';
      field list => [
        { filename => 'foo1.txt', url => 'http://foo.com/foo1.txt' },
        { filename => 'foo2.txt', url => 'http://foo.com/foo2.txt' },
      ];
      end;
    },
    'decoded html';

  is
    $build->decode({
      type     => 'dir_listing',
      base     => 'ftp://foo.com',
      content  => 'my FAUX DIR LISTING content',
      protocol => 'ftp',
    }),
    hash {
      field type     => 'list';
      field protocol => 'ftp';
      field list => [
        { filename => 'foo1.txt', url => 'ftp://foo.com/foo1.txt' },
        { filename => 'foo2.txt', url => 'ftp://foo.com/foo2.txt' },
      ];
      end;
    },
    'decoded dir listing';

};

subtest 'alien_download_rule' => sub {

  local $ENV{ALIEN_DOWNLOAD_RULE};
  delete $ENV{ALIEN_DOWNLOAD_RULE};

  is(
    Alien::Build->new,



( run in 0.339 second using v1.01-cache-2.11-cpan-26ccb49234f )