0: $caller = "My::Class::Path::myfunc";
1:
2: # Fastest method
3: # regex-with-prematch
4: my ($func) = $caller =~ /::([^:]*)$/;
5: my $class = $`; # aka. $PREMATCH
6:
7: # Second place; only .09sec in 100,000 iterations slower
8: # split-pop-join
9: my (@objpath) = split(/::/, $caller);
10: my ($func) = pop @objpath;
11: my ($class) = join('::', @objpath);
12:
13: # Third place; 25% slower
14: # globalrx-pop-join
15: my (@objpath) = $caller =~ /([^:]+)/g;
16: my ($func) = pop @objpath;
17: my ($class) = join('::', @objpath);
In reply to Parsing Class Paths by LunaticLeo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |