use strict; use warnings; use Carp qw(croak); my $croak = \&croak; package Test; sub croak_test { $croak->("this is a test"); } package main; Test::croak_test;