1. class CompUnit::Repository::Perl5 does CompUnit::Repository {
  2. method need(
  3. CompUnit::DependencySpecification $spec,
  4. CompUnit::PrecompilationRepository $precomp = self.precomp-repository(),
  5. --> CompUnit:D)
  6. {
  7. if $spec.from eq 'Perl5' {
  8. require Inline::Perl5;
  9. my $perl5 = ::('Inline::Perl5').default_perl5;
  10. if $*RAKUDO_MODULE_DEBUG -> $RMD {
  11. $RMD("Loading {$spec.short-name} via Inline::Perl5");
  12. }
  13. my $handle := $perl5.require(
  14. $spec.short-name,
  15. $spec.version-matcher !== True ?? $spec.version-matcher.Num !! Num,
  16. :handle
  17. );
  18. return CompUnit.new(
  19. :short-name($spec.short-name),
  20. :$handle,
  21. :repo(self),
  22. :repo-id($spec.short-name),
  23. :from($spec.from),
  24. );
  25. CATCH {
  26. when X::CompUnit::UnsatisfiedDependency {
  27. X::NYI::Available.new(:available('Inline::Perl5'), :feature('Perl 5')).throw;
  28. }
  29. }
  30. }
  31. return self.next-repo.need($spec, $precomp) if self.next-repo;
  32. X::CompUnit::UnsatisfiedDependency.new(:specification($spec)).throw;
  33. }
  34. method loaded() {
  35. []
  36. }
  37. method id() {
  38. 'Perl5'
  39. }
  40. method path-spec() {
  41. 'perl5#'
  42. }
  43. }