"Tom Wyant via RT" <bug-ANSIColor@rt.cpan.org> writes:
Show quoted text> My problem is that I'm just the messenger.
>
> The request was made while wearing my "Perl::Critic maintenance
> programmer" hat, which is why they were on the cc: list.
Yeah, sorry, I took them off because RT was totally not coping and was
opening a new ticket every time anything was sent to this RT ticket
because their mailing list was bouncing all the messages.
Show quoted text> One of the lead developers solved the problem I caused by copying the
> %ATTRIBUTES hash into the relevant place in Perl::Critic. I
> counterproposed using exceptions for color validation, but this was
> nixed because "exceptions should be exceptional." Hence this RT
> ticket.
>
> What I believe is wanted is a public method/static method/subroutine in
> Term::ANSIColor, something like
>
> sub check_keyword {
> return exists %ATTRIBUTES{pop @_};
> }
>
> (with the name being of course entirely up to you).
>
> If you are willing to do this, fine. Otherwise, if you would be
> willing to document the exception mechanism as the "official" way to
> do this, I'll go back to the lead developers and see what happens.
Well, I don't have any fundamental objections to such an interface, but
I hate to introduce more interfaces than are necessary, which is why I
was wondering if the existing exception checking would be enough. What
I have right now in the documentation is:
It's sometimes useful to check attributes for validity in one place,
such as when reading a configuration file that specifies colors. To
do that, run color on a possible attribute, catching any exceptions.
If it throws an exception, the attribute name isn't valid.
for my $attr (@attributes) {
eval { color ($attr) };
warn "$attr is not valid\n" if $@;
}
If you could run that by them and see what they think, I'd appreciate
it. If that doesn't work, I can go back and add an interface easily
enough.
Sorry about the long delay in turnaround on this. I've not had a lot of
chance for module hacking lately.
--
Russ Allbery (rra@stanford.edu) <
http://www.eyrie.org/~eagle/>