File: MS_MXD_Sub.pm

package info (click to toggle)
libmethod-signatures-perl 20141021-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 620 kB
  • ctags: 133
  • sloc: perl: 3,561; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,132 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use My::Declare;


# Using Foo2 here just so we can insure we don't get our subclassing test crossed with our
# replacement test (which uses Foo).  Other than that, and the use statement above, note that this
# code is exactly the same as MS_MXD_Replace.pm.

class Foo2
{
    method test_before   (Num $num) {}
    method test_around   (Num $num) {}
    method test_after    (Num $num) {}
    method test_override (Num $num) {}
    method test_augment  (Num $num) { inner($num); }
}

# Obviously, it's not a very good idea to change the parameter types for before, after, or augment
# modifiers.  (Changing the parameter type for around is okay, and changing it for override is more
# of an academic/philosophical point.)  However, doing this allows us to test that MXMS is being
# replaced by MSM by looking at the error messages.
class Foo2::Bar extends Foo2
{
    before test_before (Int $num) {}

    around test_around (Int $num)
    {
        $self->$orig($num / 2);
    }

    after test_after (Int $num) {}

    after test_override (Int $num)
    {
        return super;
    }

    augment test_augment (Int $num) {}
}


1;