# ProvisioningIsolate -- loaded before every script by the bundled perl (PERL5OPT=-MProvisioningIsolate, glue of the
# ctng-buildenv recipe). The perl binary carries its build-time module folders (/usr/share/perl5/...) at the end of
# @INC; PERL5LIB only puts the bundle's folders in front. This drops every absolute @INC entry outside the bundle, so a
# module missing from the bundle fails loudly instead of being loaded from the host's perl.
package ProvisioningIsolate;
use strict;
use warnings;

# This file lies in <bundle root>/.provisioning/; the root is the folder above.
my $strRoot = $INC{'ProvisioningIsolate.pm'};
$strRoot =~ s{/\.provisioning/ProvisioningIsolate\.pm$}{};
@INC = grep { ref($_) || !m{^/} || index($_, "$strRoot/") == 0 } @INC;

1;
