Skip to content

Instantly share code, notes, and snippets.

@knutov
Last active October 9, 2015 10:38
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 knutov/3490726 to your computer and use it in GitHub Desktop.
Save knutov/3490726 to your computer and use it in GitHub Desktop.
Padre FunctionList
# I did a little patch, which shows Dancer routes in Padre's Function List. It's work fine for me.
# Any ideas about committing it to mainstream?
# pwd
# /usr/local/share/perl/5.14.2/Padre/Document/Perl
# ===========================================================================
# diff -c FunctionList.pm.orig FunctionList.pm
# ===========================================================================
*** FunctionList.pm.orig 2013-02-19 14:19:35.000000000 +0600
--- FunctionList.pm 2013-05-06 18:18:44.000000000 +0600
***************
*** 31,36 ****
--- 31,45 ----
|
\* (\w+(?:::\w+)*) \s*=\s* (?: sub\b | \\\& )
)
+ |
+ (?:^|$newline)\s*
+ ((?:any|get|post|ajax|head|patch|put|del)\s+(?:\'|\").+?(?:\'|\"))\s*=>
+ |
+ (?:^|$newline)\s*
+ ((?:any|get|post|ajax|head|patch|put|del)\s+qr\{.+?\})\s*=>
+ |
+ (?:^|$newline)\s*
+ (hook\s+(?:\'|\")?\w+(?:\'|\")?)\s*=>
)
}sx;
# ===========================================================================
# pwd
# /usr/local/share/perl/5.14.2/Padre/Document
# ===========================================================================
# diff -c Perl.pm.orig Perl.pm
# ===========================================================================
*** Perl.pm.orig 2013-02-19 14:19:35.000000000 +0600
--- Perl.pm 2013-05-01 01:39:29.000000000 +0600
***************
*** 333,339 ****
# return qr/(?:(?<=^)\s*sub\s+$_[1]|(?<=[\012\015])\s*sub\s+$_[1])\b/;
sub get_function_regex {
my $name = quotemeta $_[1];
! return qr/(?:^|[^# \t-])[ \t]*((?:sub|func|method)\s+$name\b|\*$name\s*=\s*(?:sub\b|\\\&))/;
}
=pod
--- 333,350 ----
# return qr/(?:(?<=^)\s*sub\s+$_[1]|(?<=[\012\015])\s*sub\s+$_[1])\b/;
sub get_function_regex {
my $name = quotemeta $_[1];
! # return qr/(?:^|[^# \t-])[ \t]*((?:sub|func|method)\s+$name\b|\*$name\s*=\s*(?:sub\b|\\\&))/;
! return qr/(?:^|[^#\ \t-])[\ \t]*
! (
! (?:sub|func|method)\s+$name\b|\*$name\s*=\s*(?:sub\b|\\\&)
! |
! (?:any|get|post|ajax|head|patch|put|del)\s+[\'|\"]$name[\'|\"]\s+\=\>
! |
! (?:any|get|post|ajax|head|patch|put|del)\s+qr\{$name\}\s+\=\>
! |
! $name\s*=>
! )
! /x;
}
=pod
#===========================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment