1

I understand 'use', 'require', etc., for including a function in different perl scripts. I believe the following is impossible in perl (and its just a nuisance), but let me ask anyway.

I would like my perl language to always enforce use of warnings; strict; warnings FATAL => qw{ uninitialized }; on all .pl and .pm files, without me having to write this boilerplate everywhere. Think perl configuration. Possible?

More sophisticated, I have many .pm module scripts that start with something like

#!/usr/bin/perl -w
package myp1;
require Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(f1 f2);
@EXPORT_OK = qw(f3);

use 5.018;
use strict;
use warnings FATAL => qw{ uninitialized };
use autodie;

and even more .pl scripts that always start with

#!/usr/bin/perl -w   
use 5.018;
use strict;
use warnings FATAL => qw{ uninitialized };
use autodie;

use myp1 ;
use myp2 ;
use myp3 ;
use myp4 ;
use myp5 ;
use myp6 ;
...

they really should start with something like

boilerplate myp1 { [f1,f2], [f3] };
boilerplate qw(myp1 myp2 myp3 ...);

I am asking for what amounts almost to a template for perl code itself.

all impossible?

ivo Welch
  • 2,427
  • 2
  • 23
  • 31

0 Answers0