Guest User

Untitled

a guest
Jun 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. package CatalystX::Modern::Function;
  2.  
  3. use warnings;
  4. use strict;
  5. use parent 'Devel::Declare::MethodInstaller::Simple';
  6.  
  7. sub import {
  8. my ($class, %opts) = (@_);
  9. $class->install_methodhandler(
  10. name => 'function',
  11. into => caller,
  12. %opts,
  13. );
  14. }
  15.  
  16. sub parse_proto {
  17. my ($self, $proto) = @_;
  18. $proto ||= '@args';
  19. $proto =~ s/[\r\n]//g;
  20. return "my ($proto) = (\@_);";
  21.  
  22. }
  23.  
  24. ########
  25.  
  26. method lowercase($string) {
  27. my $test = function($a) { '' };
  28. my $method = function($extra) {
  29. $string
  30. ->lc
  31. ->do(function { my $i = shift;
  32. "$extra:$i";
  33. });
  34. };
  35. return $method->('extra');
  36. }
  37.  
  38.  
  39. #####
  40.  
  41. #line 37 "t/object.t"
  42. my $method = &function(sub {
  43. #line 33 "t/object.t"
  44. my($extra) = @_;
  45. #line 36 "t/object.t"
  46. $string->lc->do(&function(sub {
  47. #line 34 "t/object.t"
  48. my(@args) = @_;
  49. #line 34 "t/object.t"
  50. my $i = shift @_;
  51. #line 35 "t/object.t"
  52. "${extra}:$i";
  53. }
  54. ));
  55. }
  56. );
Add Comment
Please, Sign In to add comment