Skip to content

Commit 690a313

Browse files
committed
lib/Rex/CLI.pm: display a warning when/if Rex::Template is loaded.
1 parent fa11474 commit 690a313

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/Rex/CLI.pm

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ use Rex::TaskList;
3030
use Rex::Logger;
3131
use YAML;
3232

33-
use Data::Dumper;
34-
3533
my $no_color = 0;
3634
eval "use Term::ANSIColor";
3735
if ($@) { $no_color = 1; }
@@ -197,6 +195,7 @@ FORCE_SERVER: {
197195

198196
load_server_ini_file($::rexfile);
199197
load_rexfile($::rexfile);
198+
check_template_modules();
200199

201200
#### check if some parameters should be overwritten from the command line
202201
CHECK_OVERWRITE: {
@@ -455,6 +454,21 @@ sub __help__ {
455454

456455
}
457456

457+
# Check whether Rex/Template.pm
458+
# or Rex/Template/NG.pm modules are loaded. If there are,
459+
# they should be present in the %INC hash.
460+
sub check_template_modules {
461+
my @tpl_modules_loaded = grep {
462+
/(Rex\/Template|Rex\/Template\/NG)/
463+
} keys %INC;
464+
if (scalar @tpl_modules_loaded > 0) {
465+
Rex::Logger::info( "WARNING! You are using Rex built-in template engine aka Rex::Template.", "warn" );
466+
Rex::Logger::info( "This engine is obsolete, unmaintained and will be retired in future releases.", "warn" );
467+
Rex::Logger::info( "Please consider migrating to a more modern template engine.", "warn" );
468+
Rex::Logger::info( "Text::Template::Simple, Template::Toolkit, etc. As usual, CPAN is you friend.", "warn" );
469+
}
470+
}
471+
458472
sub add_help {
459473
my ( $self, $code ) = @_;
460474
push( @help, $code );

0 commit comments

Comments
 (0)