Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Pass =finish POD data to Perl 5 as DATA handle
use Foo:from<Perl5>; =finish This data can be read by Foo by slurping <DATA>
- Loading branch information
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| use Test; | ||
| # | ||
| # DATA handle is only initialized if Inline::Perl5 is loaded at compile time of a compilation unit | ||
| use Data::Dumper:from<Perl5>; | ||
|
|
||
| is EVAL('<DATA>', :lang<Perl5>), "trailing data found in DATA handle\n"; | ||
|
|
||
| done-testing; | ||
|
|
||
| =finish | ||
| trailing data found in DATA handle | ||
|
|
||
| # vim: ft=perl6 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| use lib 't/lib'; | ||
| use Test; | ||
| use Data; | ||
|
|
||
| is look_for_data(), "trailing data found in DATA handle\n"; | ||
|
|
||
| done-testing; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| use lib:from<Perl5> 't/lib'; | ||
| use LookForData:from<Perl5>; | ||
|
|
||
| sub look_for_data() is export { | ||
| return LookForData::return_data; | ||
| } | ||
|
|
||
| =finish | ||
| trailing data found in DATA handle | ||
|
|
||
| # vim: ft=perl6 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| package LookForData; | ||
| use strict; | ||
| use warnings; | ||
|
|
||
| sub return_data { | ||
| my $handle = do { no strict 'refs'; \*{"main::DATA"} }; | ||
| return scalar <$handle>; | ||
| } | ||
|
|
||
| 1; |