Ask a Question related to PERL Beginners, Design and Development.
-
The Danimal #1
Can perltidy left-align side comments to a specific column?
Dear Perl beginners and mentors thereto,
I would like to use perltidy to left-align side comments
in a Perl script to a specific column, if possible.
That is, I want an option like: --left-align-side-comments=n
which would tell perltidy to left-align each side comment
in a file at column n if text to the left of the side
comment ends before column n (that is, if there is room).
For example, I want to change code like this:
$i = 1; # a side comment
$j = 1; # a side comment
$a_long_string = "Imagine this is quite long.";
to this:
$i = 1; # a side comment
$j = 1; # a side comment
$a_long_string = "Imagine this is quite long.";
where the # character appears in a column I specify, and
if the rest of the line allows it.
I read the perltidy manual and I tried a few combinations
of options, but can't find any way to align the side
comments file-wide. In particular, I seem to be running
into problems with Perl scripts that contain very long
strings. perltidy can line up the side comments to some
degree, but I get various results depending on other
options I specify, such as whether to outdent the long
strings or whether to break long lines. I would like to
nail down the starting column of the side comments so they
don't wander around depending on other formatting options.
I thought I would run this problem by perl.beginners
before I e-mail the author of perltidy, in case the
answer is boneheadedly obvious and I'm missing something.
I suspect there must be some way to do this because
aligning side comments file-wide seems like something
a person would obviously want. I might be projecting
what seems obvious to me.
If what I'm trying to do is not obvious from the above
description, I could present specific examples of
code with various formatting options to illustrate the
problems I am having. But if such examples are necessary,
that probably means perltidy has no option to left-align
side comments to a specific target column.
-- Daniel Mocsny
The Danimal Guest
-
I cannot get a png file to align all the way to left ofthe browser
So I have my navbar created in fireworks and it works fine, its just that I cannot get to line up on the left side of the browser... There is... -
right align a number column in a datagrid
How can right align a number column in a datagrid? -
How to set button text Align to left?
How to set button.text Align to left? -
How could i align the text in a column?
All the columns in my I'd like to align the columns to the right, left or center but i don't find a property to do it. Is it possible? Thanks -
how to Align text left & vertical align middle
Hello, I have a asp lable control, which I use to display text in, I would like to have the text display aligned in the center and vertical...



Reply With Quote

