Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-Mouse/t/001_mouse/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/proc/self/root/proc/self/root/usr/share/doc/perl-Mouse/t/001_mouse/042-override.t
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 3;
use Test::Exception;

my @parent_calls;
my @child_calls;

do {
    package Parent;
    sub foo { push @parent_calls, [@_] }

    package Child;
    use Mouse;
    extends 'Parent';

    override foo => sub {
        my $self = shift;
        push @child_calls, [splice @_];
        super;
    };
};

Child->foo(10, 11);
is_deeply([splice @parent_calls], [[Child => 10, 11]]);
is_deeply([splice @child_calls], [[10, 11]]);

throws_ok {
    package Orphan; # :(
    use Mouse;
    override foo => sub { };
} qr/^You cannot override 'foo' because it has no super method/;


Hry