require
Loads and executes a Perl file or module, caching it in %INC so
that subsequent calls for the same module are no-ops.
Behaviour depends on the argument type:
-
Version number (numeric or v-string): asserts that the Perl version is at least that value. pperl claims 5.42 compatibility, so any 5.x requirement succeeds; 6+ dies.
-
Bareword / string: converts
Foo::BartoFoo/Bar.pm, then searches@INCfor the file. If already present in%INC, the call is a no-op. Otherwise the file is compiled and executed in a sub-interpreter, subs are registered, and%INCis updated.
Dies with "Can't locate ..." if the file is not found. Returns 1
on success.
Synopsis
require 5.036; # version check
require Carp; # load Carp.pm via @INC
require "config.pl"; # load a file by path