Skip to content

Commit

Permalink
Rename v6::inline to v6-inline for compatibility with Perl < 5.18
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed Dec 3, 2016
1 parent 9f07780 commit f91ab9a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@ can be caught like any other Perl 5 exceptions:

## Mix Perl 5 and Perl 6 code in the same file

Inline::Perl5 creates a virtual module called "v6::inline". By saying
"use v6::inline;" in a Perl 5 module, you can declare that the rest of the file
Inline::Perl5 creates a virtual module called "v6-inline". By saying
"use v6-inline;" in a Perl 5 module, you can declare that the rest of the file
is written in Perl 6:

```
package Some::Perl5::Module;
use v6::inline;
use v6-inline;
has $.name;
Expand Down
14 changes: 6 additions & 8 deletions lib/Inline/Perl5.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -1130,12 +1130,6 @@ method init_callbacks {
v6::invoke($static_class, 'new_shadow_of_p5_object', $object);
return $object;
}
sub import {
die 'v6-inline got renamed to v6::inline to allow passing an import list';
}
package v6::inline;
use mro;
sub install_function {
Expand All @@ -1162,7 +1156,6 @@ method init_callbacks {
my $package_to_create;
sub import {
my ($class, %args) = @_;
my $package = $package_to_create = scalar caller;
push @inlined, $package;
}
Expand All @@ -1173,6 +1166,11 @@ method init_callbacks {
};
}
package v6::inline;
sub import {
die 'v6::inline got renamed to v6-inline for compatibility with older Perl 5 versions. Sorry for the back and forth about this.';
}
$INC{'v6.pm'} = '';
$INC{'v6/inline.pm'} = '';
Expand All @@ -1198,7 +1196,7 @@ method rebless(Perl5Object $obj, Str $package, $p6obj) {
}

method install_wrapper_method(Str:D $package, Str $name, *@attributes) {
self.call('v6::inline::install_p6_method_wrapper', $package, $name, |@attributes);
self.call('v6::install_p6_method_wrapper', $package, $name, |@attributes);
}

role Perl5Package[Inline::Perl5 $p5, Str $module] {
Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestV6.pm
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ sub check_attrs {
return attributes::get(\&hasattrs);
}

use v6::inline;
use v6-inline;

has $.name;

Expand Down
2 changes: 1 addition & 1 deletion t/lib/TestV6Directly.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sub search {
1
}

use v6::inline;
use v6-inline;

method foo() {
self.search;
Expand Down

0 comments on commit f91ab9a

Please sign in to comment.