Badger

 view release on metacpan or  search on metacpan

lib/Badger/Class.pm  view on Meta::CPAN

1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
Exactly. What we do is, if we need that extra push over the cliff, you know
what we do?
 
    my $amp = Amplifier->new( max_volume => 11 );
 
Eleven. Exactly. One louder.
 
So far, so good. But what if we wanted to make this the default? Sure, we
could make ten louder and make that be the top number, or we could remember to
specify the C<max_volume> parameter each time we use it. But let's assume
we're working with temperamental artistes who will be too busy worrying about
the quality of the backstage catering to think about checking their volume
settings before they go on stage.
 
Thankfully we didn't hard-code the maximum volume but used the C<$MAX_VOLUME>
package variable instead. We can change it directly like this:
 
    $Amplifier::MAX_VOLUME = 11;
 
Or using the class L<var()> method (just to show you what the roundabout way
looks like):



( run in 0.370 second using v1.01-cache-2.11-cpan-1dc43b0fbd2 )