in reply to Unable to preload Data::Dumper with mod_perl
use is two parts:
require Data::Dumper; Data::Dumper->import('Dumper');
The first part is done in your startup.pl.
The ->import(...) part is also only done in your startup.pl instead of (what you intend to) in every module.
The solution would be to either explicitly import it, to explicitly call it as Data::Dumper::Dumper( ... ), or to have one central module, App::Nysus::Utils(), which exports Data::Dumper::Dumper into every caller:
use App::Nysus::Utils; # import all the stuff
package App::Nysus::Utils; use strict; use Data::Dumper (); # just for completeness / offline testing outside + of Apache sub import { (my $target) = caller(); no strict 'refs'; *{ "$target\::Dumper" } = \&Data::Dumper::Dumper; }; 1;
I'm not sure which route I would go. They all have disadvantages and advantages:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Unable to preload Data::Dumper with mod_perl
by nysus (Parson) on Dec 04, 2017 at 13:10 UTC |