Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Get gen_setting_pm.pl to generate use statements at the end, which im…
…port the various classes in the setting. We also have to make sure we note them in %*INC so it doesn't go trying to load Any.pm, etc from disk. This is fine for when we're compiling - just use a BEGIN - but since those aren't persisted we need to make sure we set up %*INC in the pre-compiled version too. Did it with a sick hack for now; hopefully someone thinks of a good way...
  • Loading branch information
jnthn committed Mar 22, 2009
1 parent 3d030b0 commit f6e7fcb
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions build/gen_setting_pm.pl
Expand Up @@ -19,3 +19,26 @@
print join('', <$fh>);
close $fh;
}

my @classes = ('Any');
foreach my $file (@files) {
next unless $file =~ /[\/\\](\w+)\.pm$/;
push @classes, $1;
}

print <<"END_SETTING";
# Need to use all built-in classes, to import their exports.
END_SETTING
print join('', map { "BEGIN { \%*INC<$_> = 1 };\nuse $_;\n" } @classes);

# Why yes, "OMFG" is a correct response to this hack. We need to make sure
# that we set up %*INC properly for the pre-compiled case, and can't use
# BEGIN blocks to preserve those changes for now.
print <<"END_SETTING";
Q:PIR {
.return (1)
.end
.sub '' :load :init
};
END_SETTING
print join('', map { "\%*INC<$_> = 1;\n" } @classes);

0 comments on commit f6e7fcb

Please sign in to comment.