Skip to content

Alien::Build plugin to rewrite network requests to local resources

Notifications You must be signed in to change notification settings

PerlAlien/Alien-Build-Plugin-Fetch-Rewrite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

12ade5f · Dec 23, 2024

History

26 Commits
Dec 23, 2024
Dec 23, 2024
Jul 13, 2017
May 7, 2021
Aug 29, 2022
Aug 29, 2022
May 7, 2021
Jul 18, 2017
Dec 23, 2024
Aug 29, 2022
Dec 23, 2024
Jul 13, 2017
Dec 23, 2024
May 7, 2021

Repository files navigation

Alien::Build::Plugin::Fetch::Rewrite linux macos windows

Alien::Build plugin to rewrite network requests to local resources

SYNOPSIS

In your ~/.alienbuild/rc.pl:

postload 'Fetch::Rewrite';

sub rewrite {
  my($build, $uri) = @_;

  # $build isa Alien::Build
  # $uri isa URI

  if($uri->host eq 'ftp.gnu.org')
  {
    # if we see a request to ftp.gnu.org (either ftp or http)
    # we redirect it to the local mirror at
    # http://mirror.example.com/ftp.gnu.org
    $uri->scheme('http');
    $uri->host('mirror.example.com');
    $uri->host('/ftp.gnu.org' . $uri->path);
  }
}

1;

DESCRIPTION

This plugin allows you to rewrite the URLs for remote networked resources to local resources. This is useful if you are building CPAN modules that rely on Alien distributions where you do not have system packages. It may also seem useful if you do not trust the remote resources, although please keep in mind that like a Makefile.PL or Build.PL, an alienfile is arbitrary Perl code, and should be appropriately vetted before being used in an environment with security requirements.

CAVEATS

This plugin is only able to rewrite URLs that are fetched through the standard Alien::Build URL fetching interface, and only URLs that are supported by LWP::UserAgent and URI.

SEE ALSO

AUTHOR

Graham Ollis [email protected]

COPYRIGHT AND LICENSE

This software is copyright (c) 2017-2024 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

Alien::Build plugin to rewrite network requests to local resources

Resources

Stars

Watchers

Forks

Packages

No packages published