diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-05 15:05:42 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-03-05 15:05:42 -0800 |
commit | 4ef3988035e980e62da5d1557ebec817cba7f3a5 (patch) | |
tree | 6513a9e0f50deea7095a2880a48f73f2030f1812 /scripts/VyattaQosTrafficShaper.pm | |
parent | 095dfa147f6e3ea833e9c4a4824672a2060b1b2b (diff) | |
download | vyatta-cfg-qos-4ef3988035e980e62da5d1557ebec817cba7f3a5.tar.gz vyatta-cfg-qos-4ef3988035e980e62da5d1557ebec817cba7f3a5.zip |
use object factory rather than hardcoded switch for policy config
Having a hardcoded switch statement is harder to update than
using a hash.
Diffstat (limited to 'scripts/VyattaQosTrafficShaper.pm')
-rw-r--r-- | scripts/VyattaQosTrafficShaper.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/VyattaQosTrafficShaper.pm b/scripts/VyattaQosTrafficShaper.pm index 1c35ba2..bb0afbd 100644 --- a/scripts/VyattaQosTrafficShaper.pm +++ b/scripts/VyattaQosTrafficShaper.pm @@ -203,12 +203,12 @@ } package VyattaQosTrafficShaper; -@ISA = qw/VyattaQosPolicy/; use strict; require VyattaConfig; use VyattaQosUtil; my %fields = ( + _name => undef, _rate => undef, _classes => undef, ); @@ -216,11 +216,13 @@ my %fields = ( # new VyattaQosTrafficShaper($config) # Create a new instance based on config information sub new { - my ( $that, $config ) = @_; + my ( $that, $config, $name ) = @_; my $self = {%fields}; my $class = ref($that) || $that; + bless $self, $class; + $self->{_name} = $name; $self->_define($config); return $self; |