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

can not require ::($.member) #6472

Open
p6rt opened this issue Aug 27, 2017 · 1 comment
Open

can not require ::($.member) #6472

p6rt opened this issue Aug 27, 2017 · 1 comment

Comments

@p6rt
Copy link

p6rt commented Aug 27, 2017

Migrated from rt.perl.org#131971 (status was 'new')

Searchable as RT131971$

@p6rt
Copy link
Author

p6rt commented Aug 27, 2017

From martin@senfdax.de

class Foo {
  has $.class is required;

  method require-class {
  try {
  require :​:($.class);

  CATCH {
  default {
  say .message;
  }
  }
  }
  }

  method require-c {
  my $c = $.class;
  try {
  require :​:($c);

  CATCH {
  default {
  say .message;
  }
  }
  }
  }
}

# use something that you have installed or you get a "Couldn not find
...." which is fine.
my $f = Foo.new(class => 'Bailador');

say 'works - or throws could not find Bailador';
$f.require-c;

say 'fails with "Too many positionals passed..."';
$f.require-class;

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