Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unicode attributes #105

Open
tlby opened this issue Sep 20, 2019 · 0 comments
Open

unicode attributes #105

tlby opened this issue Sep 20, 2019 · 0 comments

Comments

@tlby
Copy link

tlby commented Sep 20, 2019

It seems like Mouse is not adding methods for attributes with unicode names though I can't find any limitations that would prevent it.

use strict;
use warnings;
use utf8;

package C1 {
    use Mouse;
    has 'pi', is => 'ro', isa => 'Num', default => 2 * atan2(1, 0);
    no Mouse;
    sub π { goto \&pi }
}

package C2 {
    use Mouse;
    has 'π', is => 'ro', isa => 'Num', default => 2 * atan2(1, 0);
    no Mouse;
}

binmode STDERR, ':utf8';

eval {
    my $c1 = C1->new();
    print $c1->π, "\n";
};
warn $@ if $@;

eval {
    my $c2 = C2->new();
    print $c2->π, "\n";
};
warn $@ if $@;

is giving me the output:

3.14159265358979
Can't locate object method "π" via package "C2" at bug.pl line 29.

Is this something that should work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant