diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-01-24 00:39:40 -0800 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-01-24 00:39:40 -0800 |
commit | f3ac48703be75c0e2aec161487057eafeb8fc74f (patch) | |
tree | fd3bc7402cf055bbdccd86927532283cde51b562 /FS/FS/MAC_Mixin.pm | |
parent | 960c55002469c33ea9b0a949ad473a705e1b6cf9 (diff) |
svc_pbx devices, for RT#24968
Diffstat (limited to 'FS/FS/MAC_Mixin.pm')
-rw-r--r-- | FS/FS/MAC_Mixin.pm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/FS/FS/MAC_Mixin.pm b/FS/FS/MAC_Mixin.pm new file mode 100644 index 000000000..8715995c1 --- /dev/null +++ b/FS/FS/MAC_Mixin.pm @@ -0,0 +1,65 @@ +package FS::MAC_Mixin; + +use strict; +#use FS::Record qw(qsearch); +#use FS::Conf; +# careful about importing anything here--it will end up in a LOT of +# namespaces + +#use vars qw(@subclasses $DEBUG $conf); + +#$DEBUG = 0; + +# any subclass that can have MAC addresses needs to be added here +#@subclasses = (qw(FS::svc_broadband FS::svc_cable)); + +#sub conf { +# $conf ||= FS::Conf->new; +#} + +=head1 NAME + +FS::MAC_Mixin - Mixin class for objects that have MAC addresses assigned. + +=head1 SYNOPSIS + +=head1 DESCRIPTION + +=head1 METHODS + +=head1 METHODS + +=over 4 + +=item mac_addr_pretty + +=cut + +sub mac_addr_pretty { + my $self = shift; + $self->mac_addr_formatted('U',':'); +} + +=item mac_addr_formatted CASE DELIMITER + +Format the MAC address (for use by exports). If CASE starts with "l" +(for "lowercase"), it's returned in lowercase. DELIMITER is inserted +between octets. + +=cut + +sub mac_addr_formatted { + my $self = shift; + my ($case, $delim) = @_; + my $addr = $self->mac_addr; + $addr = lc($addr) if $case =~ /^l/i; + join( $delim || '', $addr =~ /../g ); +} + +=back + +=head1 BUGS + +=cut + +1; |