Take the 2-minute tour ×

I in a large codebase of an application written in perl there is a lot of HTML and JS written inline in the perl file.

$html_str = qq^ <A LOT OF HTML> ^;

All the code development in done using Eclipse IDE and EPIC plugin. For ease of merging/diffs et al, I am looking for a way to tell the EPIC source formatter not to apply formatting rules to the HTML and JS that is written inline. Is there a way to do this?

share|improve this question
Could you post an example of how its changing the HTML? –  Schwern Oct 22 '09 at 4:56

1 Answer 1

HTML embedded in the code is a red flag. That's stuff a designer is going to want to tweak, and so should be able to get at easily. The HTML should be split out into template files. I realize this doesn't answer your question, but it does solve your problem.

Otherwise, use perltidy to handle Perl code formatting. It won't mess with content inside strings and certainly isn't going to try and format HTML.

share|improve this answer
@Schwern You have no idea how much I wish all the HTML was in template files. But this one is a legacy application that has HTML spilled all over. All new functionality that is being added uses best practices but here is just no time to refactor old code. I am already using EPIC that uses perltidy for source formatting. My problem is.. it does mess with the HTML within the string variables. Since this HTML is very long most of the times perltidy would trim it to whatever is the max line size. I want a way to tell perltidy to skip some section from formatting?? –  Sumeet Pareek Oct 20 '09 at 11:09
How about using vim for fixing formatting. See this macro to run perltidy on a region: stackoverflow.com/questions/1573782/… –  Sinan Ünür Oct 20 '09 at 14:12

Your Answer


