Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Make sure setting subroutines are properly package ('our') scoped
Browse files Browse the repository at this point in the history
instead of defaulting to lexically scoped.
  • Loading branch information
pmichaud committed May 15, 2010
1 parent cf979eb commit cf5f0c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/setting/Hash.pm
Expand Up @@ -75,6 +75,6 @@ module Hash {
Construct a hash from named arguments.
=end item

sub hash(*%h) { %h }
our sub hash(*%h) { %h }

# vim: ft=perl6
4 changes: 2 additions & 2 deletions src/setting/IO.pm
Expand Up @@ -10,7 +10,7 @@ IO Methods and Functions
Returns the contents of C<$filename> as a single string.
=end
sub slurp ($filename) {
our sub slurp ($filename) {
my $handle := pir::open__Pss($file, 'r');
my $contents := $handle.readall;
pir::close($handle);
Expand All @@ -22,7 +22,7 @@ sub slurp ($filename) {
Write the string value of C<$contents> to C<$filename>.
=end item
sub spew($filename, $contents) {
our sub spew($filename, $contents) {
my $handle := pir::open__Pss($filename, 'w');
$handle.print($contents);
pir::close($handle);
Expand Down
4 changes: 2 additions & 2 deletions src/setting/Regex.pm
Expand Up @@ -11,7 +11,7 @@ Match C<$text> against C<$regex>. If the C<$global> flag is
given, then return an array of all non-overlapping matches.
=end item

sub match ($text, $regex, :$global?) {
our sub match ($text, $regex, :$global?) {
my $match := $text ~~ $regex;
if $global {
my @matches;
Expand All @@ -33,7 +33,7 @@ returning the substituted string. If C<$global> is given, then
perform the replacement on all matches of C<$text>.
=end item

sub subst ($text, $regex, $repl, :$global?) {
our sub subst ($text, $regex, $repl, :$global?) {
my @matches := $global ?? match($text, $regex, :global)
!! [ $text ~~ $regex ];
my $is_code := pir::isa($repl, 'Sub');
Expand Down
6 changes: 3 additions & 3 deletions src/setting/ResizablePMCArray.pm
Expand Up @@ -44,8 +44,8 @@ module ResizablePMCArray {
}


sub join ($separator, *@values) { @values.join($separator); }
sub map (&code, *@values) { @values.map(&code); }
sub list (*@values) { @values; }
our sub join ($separator, *@values) { @values.join($separator); }
our sub map (&code, *@values) { @values.map(&code); }
our sub list (*@values) { @values; }

# vim: ft=perl6

0 comments on commit cf5f0c7

Please sign in to comment.