projects
/
Biblio-RFID.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d4c7751
)
fail chain without serial ports
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 6 Aug 2010 19:25:35 +0000
(21:25 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Fri, 6 Aug 2010 19:25:35 +0000
(21:25 +0200)
lib/RFID/Biblio/Reader/Serial.pm
patch
|
blob
|
history
diff --git
a/lib/RFID/Biblio/Reader/Serial.pm
b/lib/RFID/Biblio/Reader/Serial.pm
index
74f8cfa
..
b118fe3
100644
(file)
--- a/
lib/RFID/Biblio/Reader/Serial.pm
+++ b/
lib/RFID/Biblio/Reader/Serial.pm
@@
-23,9
+23,7
@@
sub new {
my $self = {@_};
bless $self, $class;
my $self = {@_};
bless $self, $class;
- $self->port;
-
- $self->init && return $self;
+ $self->port && $self->init && return $self;
}
}
@@
-49,12
+47,15
@@
sub port {
return;
}
return;
}
- $self->{port} = Device::SerialPort->new( $settings->{device} )
- || die "can't open serial port: $!\n";
-
- $self->{port}->$_( $settings->{$_} )
- foreach ( qw/handshake baudrate databits parity stopbits/ );
+ if ( $self->{port} = Device::SerialPort->new( $settings->{device} ) ) {
+ $self->{port}->$_( $settings->{$_} )
+ foreach ( qw/handshake baudrate databits parity stopbits/ );
+ } else {
+ warn "can't open serial port: $!\n";
+ $self->{port} = 0;
+ }
+ $self->{port};
}
1
}
1