Since most of the tools in WebKitTools are written in Perl, we should make prepare-ChangeLog work with Perl scripts.
See Bug 21567 for a similar change for JavaScript files. We'll need to check the first line of files to see if "#!/usr/bin/perl" or similar appears there since not all Perl scripts end with ".pl".
A very simple first cut would be to match against /^sub (\w\S+)/.
Created attachment 99751 [details] Make prepare-ChangeLog include modified Perl functions in its ChangeLog template
Comment on attachment 99751 [details] Make prepare-ChangeLog include modified Perl functions in its ChangeLog template View in context: https://bugs.webkit.org/attachment.cgi?id=99751&action=review > Tools/Scripts/prepare-ChangeLog:1213 > +# Read a file and get all the line ranges of the things that look like Perl functions. Only lines > +# which start with "sub " are recognized as starting a function, and only lines that are exactly "}" > +# are recognized as ending a function. This isn't quite accurate. Rewritten as: # Read a file and get all the line ranges of the things that look like Perl functions. Functions # start on a line that starts with "sub ", and end on the first line starting with "}" thereafter.
Comment on attachment 99751 [details] Make prepare-ChangeLog include modified Perl functions in its ChangeLog template View in context: https://bugs.webkit.org/attachment.cgi?id=99751&action=review r=me! > Tools/Scripts/prepare-ChangeLog:1232 > + warn "nested functions found at top-level at $fileName:$.\n"; FYI, it is possible to nest subroutines in Perl. You can define a subroutine and assign it to a variable, too. I guess you can change $currentFunction to @currentFunction later.
Comment on attachment 99751 [details] Make prepare-ChangeLog include modified Perl functions in its ChangeLog template View in context: https://bugs.webkit.org/attachment.cgi?id=99751&action=review > Tools/Scripts/prepare-ChangeLog:1227 > + if (/^sub ([^(]+)/) { I tweaked this to: /^sub\s+([^(\s]+)/ This better handles functions which have no prototype, and is a little more lenient about spaces after "sub".
Comment on attachment 99751 [details] Make prepare-ChangeLog include modified Perl functions in its ChangeLog template View in context: https://bugs.webkit.org/attachment.cgi?id=99751&action=review >> Tools/Scripts/prepare-ChangeLog:1232 >> + warn "nested functions found at top-level at $fileName:$.\n"; > > FYI, it is possible to nest subroutines in Perl. You can define a subroutine and assign it to a variable, too. > > I guess you can change $currentFunction to @currentFunction later. Yes, I just decided to punt on nested subroutines in this patch. Note that we'll only complain if the nested function isn't indented, like this: sub outerFunction { sub innerFunction { } }
Committed r90409: <http://trac.webkit.org/changeset/90409>