Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move
sprintf
message formatting into its own object method ofHP::Server
and makeadd_info()
,add_extendedinfo()
andadd_message()
use it. This waysprintf
is a no-op.This saves a lot of typing and makes code somewhat easier to read by replacing all the nested
add_info(sprintf "foo %s bar %d%s", $self->{attr1}, $self->{attr2}, 'quux')
calls with
add_info('foo %s bar %d%s', \'attr1', \'attr2', 'quux')
.Considering that attribute lookups are much more frequent in arguments to
add_info
etc. than calculated arguments, it would make sense to reverse the semantics and insert scalar references as-is while plainscalars would be taken as attribute names. This would save a heap of unsightly backslashes. However, the way it is now is completely compatible with the old calling conventions so it should be the gentler change after all.
I just came up with this while adding
--customfanspeeds
and actually did it first, however to make the two changes independent I based the customfanspeeds change on the master as well as this is a fairly big one stylistically :)