Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

fix Safe and YAML issues #16

Closed
wants to merge 3 commits into from

3 participants

Damien Krotkine Leon Timmermans Pedro Melo
Damien Krotkine
Collaborator
dams commented

This PR fixes these issues :

https://rt.cpan.org/Public/Bug/Display.html?id=76664
https://rt.cpan.org/Public/Bug/Display.html?id=74487

This is just to demonstrate how to fix it. You might want to try to find a way to have it more golfed but still working...

Pedro Melo

@dams You are changing lib/Mo.pm but AFAIK lib/Mo.pm is a generated file via make -C src/.

Shouldn't this be done in src/Mo.pm?

Collaborator

@melo Aww yes, I had forgotten about that :) make test worked so I commited it, but yeah. I have added a new commit to the PR. Should be alright now

Leon Timmermans
Leont commented

I've squashed and committed the patches

Leon Timmermans Leont closed this
Damien Krotkine
Collaborator
dams commented

@Leont thanks. But I think you meant "squashed and merged the commits" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 3 changed files with 13 additions and 3 deletions. Show diff stats Hide diff stats

  1. +1 1  lib/Mo.pm
  2. +2 2 src/Mo.pm
  3. +10 0 t/main_sub.t
2  lib/Mo.pm
... ... @@ -1,3 +1,3 @@
1 1 package Mo;
2 2 $VERSION='0.30';
3   -no warnings;my$M=__PACKAGE__.::;*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.::;shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};
  3 +no warnings;my$M=__PACKAGE__.'::';*{$M.Object::new}=sub{bless{@_[1..$#_]},$_[0]};*{$M.import}=sub{import warnings;$^H|=1538;my($P,%e,%o)=caller.'::';shift;eval"no Mo::$_",&{$M.$_.::e}($P,\%e,\%o,\@_)for@_;return if$e{M};%e=(extends,sub{eval"no $_[0]()";@{$P.ISA}=$_[0]},has,sub{my$n=shift;my$m=sub{$#_?$_[0]{$n}=$_[1]:$_[0]{$n}};$m=$o{$_}->($m,$n,@_)for sort keys%o;*{$P.$n}=$m},%e,);*{$P.$_}=$e{$_}for keys%e;@{$P.ISA}=$M.Object};
4 src/Mo.pm
@@ -7,7 +7,7 @@ no warnings;
7 7 # We need the package name to be relocatable for inlining. Adding the :: makes
8 8 # everything shorter thereafter. :: is a bareword string. We do that a lot for
9 9 # golfing reasons. Scary.
10   -my $MoPKG = __PACKAGE__.::;
  10 +my $MoPKG = __PACKAGE__.'::';
11 11
12 12 # This is our minimal constructor. Can we make it faster? We should have tests
13 13 # for that.
@@ -20,7 +20,7 @@ my $MoPKG = __PACKAGE__.::;
20 20 import warnings;
21 21 # This is a golf for: use strict(); strict->import;
22 22 $^H |= 1538;
23   - my ($caller_pkg, %exports, %options) = caller.::;
  23 + my ($caller_pkg, %exports, %options) = caller.'::';
24 24 shift;
25 25 # Load each feature and call its &e.
26 26 eval "no Mo::$_",
10 t/main_sub.t
... ... @@ -0,0 +1,10 @@
  1 +use Test::More;
  2 +
  3 +no warnings;
  4 +\&::main::;
  5 +
  6 +plan tests => 1;
  7 +
  8 +eval 'use Mo';
  9 +
  10 +ok !$@, 'Mo works with global sub called "" ' . ($@||'');

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.