use strict; use warnings; my %queries; for (@ARGV) { open my $FH, '<', $_ or die("failed opening $_ :$!"); s'\.sql$''; while (chomp($queries{$_}.=<$FH>)) {} } # the PERLINST env var holds the location of our private # Perl Module store open my $MODULE, '>', "$ENV{PERLINST}/MyProject/SQL.pm" or die("Unable to open SQL module"); print $MODULE q( package Private::MyProject::SQL; require Exporter; use vars (@ISA, @EXPORT); ); print $MODULE '@EXPORT = qw(',join(' ',keys %queries),");\n"; for (keys %queries) { print $MODULE 'use constant '.$_.' => q('.$queries{$_}.");\n"; } print $MODULE '1;\n'; close $MODULE;