paperlined.org
dev > perl
document updated 11 years ago, on Jun 8, 2011

There are several places to hook various stages in the compile/runtime/etc.

BEGIN { }

Triggers as soon as the parser processes this line.

@INC coderef

Triggers every time a 'use' or 'require' is encountered.

B::Hooks::EndOfScope

Triggers when compilation of the current scope ends.

UNITCHECK { }

Triggers when compilation of the current module/eval ends.

CHECK { }

Triggers just before runtime starts.

INIT { }

Triggers just before runtime starts... but after CHECK { } .....?

Hook::AfterRuntime

Triggers when runtime of the current scope ends.

Value::Canary

Triggers when a variable's scope ends.

END { }

Triggers after all runtime ends.