package FS::svc_hardware;
+use base qw( FS::svc_Common );
use strict;
-use base qw( FS::svc_Common );
use vars qw( $conf );
-use FS::Record qw( qsearch qsearchs );
-use FS::hardware_type;
+use FS::Record qw( qsearchs ); #qsearch qsearchs );
use FS::hardware_status;
use FS::Conf;
my ($class, $string) = @_;
my @where = ();
- my $ip = NetAddr::IP->new($string);
- if ( $ip ) {
- push @where, $class->search_sql_field('ip_addr', $ip->addr);
+ if ( $string =~ /^[\d\.:]+$/ ) {
+ # if the string isn't an IP address, this will waste several seconds
+ # attempting a DNS lookup. so try to filter those out.
+ my $ip = NetAddr::IP->new($string);
+ if ( $ip ) {
+ push @where, $class->search_sql_field('ip_addr', $ip->addr);
+ }
}
if ( $string =~ /^(\w+)$/ ) {
Returns the L<FS::hardware_type> object associated with this installation.
-=cut
-
-sub hardware_type {
- my $self = shift;
- return qsearchs('hardware_type', { 'typenum' => $self->typenum });
-}
-
=item status_label
Returns the 'label' field of the L<FS::hardware_status> object associated