Skip to content

Instantly share code, notes, and snippets.

@stevan
Created July 29, 2023 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevan/e120a5100914946df99662ecfe508895 to your computer and use it in GitHub Desktop.
Save stevan/e120a5100914946df99662ecfe508895 to your computer and use it in GitHub Desktop.
#!perl
use v5.38;
package Test::Foo;
use v5.38;
use experimental 'class';
sub get_bar (@args) {
Test::Foo::Bar->new( @args )
}
class Test::Foo::Bar {
field $bar :param = "BAR";
method bar { $bar }
}
package main;
my $foo = Test::Foo::Bar->new;
warn $foo->bar;
__END__
Subroutine attributes must come before the signature at t/test.pl line 14.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment