use My::Exception::Class ( 'My::Exception::BadInput' => { isa => 'My::Exception', }, ); package ABC; use constant PACKAGE_CONSTANT => 'abc'; sub xyz { print "hello\n"; } package main; use ABC; ABC::xyz(); if (1) { goto XYZ; } XYZ: print "OK"; My::Exception::BadInput->throw(message => ABC::PACKAGE_CONSTANT);