Created
October 3, 2012 09:16
-
-
Save xtetsuji/3825975 to your computer and use it in GitHub Desktop.
Emulate __DATA__ section for mod_perl Registry/PerlRun script, and so on.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# Emulate __DATA__ section for mod_perl Registry/PerlRun script, and so on. | |
use strict; | |
use warnings; | |
### In tail of this file, its "data" exists and defines inside BEGIN { ... } block. | |
my $DATA; | |
open \*DATA, '<', \$DATA; | |
### can I read fake DATA filehandle? | |
while (<DATA>) { | |
print "DUMMY_DATA_SECTION: $_"; | |
} | |
BEGIN { $DATA = <<__FAKE_DATA__; } | |
Hello! Data! | |
This is emulate DATA section. | |
This way can be used on mod_perl! | |
__FAKE_DATA__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment