[Camps-users] [Camps-commits] [SCM] Camps development environments branch, master, updated. 71dc7b5e3651237c99f116565bac75474d378a5e

Jon Jensen jon at endpoint.com
Fri Jan 23 21:03:25 UTC 2009


On Thu, 22 Jan 2009, Brian J. Miller wrote:

>> One indentation level for line continuation, another for the 
>> parentheses, then back one once the parens are done.
>
> +    my $dbh = DBI->connect(
> +            $invocant->db_dsn($catalog),
> +            $invocant->db_user($catalog),
> +            $invocant->db_password($catalog),
> +            $options
> +        ) or die "Unable to obtain database handle\n";
>
> Isn't that two indents for line continuation? Why wouldn't the closing
> paren line up under 'my'? Like:
>
> +    my $dbh = DBI->connect(
> +        $invocant->db_dsn($catalog),
> +        $invocant->db_user($catalog),
> +        $invocant->db_password($catalog),
> +        $options
> +    ) or die "Unable to obtain database handle\n";

For the same reason that we don't do this:

my $string = "asfdals;kdjfas;ldkjfa;lsdkfja;sldkjfa;lskdjf;alskjdfasdl;"
. "askjfdaskldjfasdfasdkf;lasdkjfa";

The continuation line gets indented:

my $string = "asfdals;kdjfas;ldkjfa;lsdkfja;sldkjfa;lskdjf;alskjdfasdl;"
     . "askjfdaskldjfasdfasdkf;lasdkjfa";

When the continuation line is also part of a parenthesized expression that 
would be indented on its own, you end up with another indentation:

my $string = "asfdals;kdjfas;ldkjfa;lsdkfja;sldkjfa;lskdjf;alskjdfasdl;"
     . (
         join '',
         "askjfdaskldjfasdfasdkf;lasdkjfa",
         something(),
       );

Which is the same thing as:

my $string = something(
         $arg1,
         $arg2,
     );

I don't really care that much about this, but it does make sense to me.

> (Should also include the reason for failure in the error message)

Good idea. Done.

Jon

--
Jon Jensen
End Point Corporation
http://www.endpoint.com/


More information about the Camps-users mailing list