projects
/
Biblio-RFID.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use first ip if eth0 is not available
[Biblio-RFID.git]
/
scripts
/
RFID-JSONP-server.pl
diff --git
a/scripts/RFID-JSONP-server.pl
b/scripts/RFID-JSONP-server.pl
index
f29c638
..
62a2d79
100755
(executable)
--- a/
scripts/RFID-JSONP-server.pl
+++ b/
scripts/RFID-JSONP-server.pl
@@
-305,19
+305,20
@@
sub rfid_register {
foreach ( split(/\n/, `ip addr` ) ) {
if ( /^\d:\s(\w+):\s/ ) {
foreach ( split(/\n/, `ip addr` ) ) {
if ( /^\d:\s(\w+):\s/ ) {
- $ip->{last} = $1;
+ $ip->{
_
last} = $1;
} elsif ( /^\s+inet\s((\d+)\.(\d+)\.(\d+)\.(\d+))\/(\d+)/ ) {
} elsif ( /^\s+inet\s((\d+)\.(\d+)\.(\d+)\.(\d+))\/(\d+)/ ) {
- $ip->{ $ip->{last} } = $1;
+ $ip->{ $ip->{
_
last} } = $1;
} else {
} else {
- warn "# SKIP [$_]\n";
+
#
warn "# SKIP [$_]\n";
}
}
-
}
}
+ warn dump($ip);
+
my $ua = LWP::UserAgent->new;
my $url = URI->new( $rfid_url . '/register.pl');
$url->query_form(
my $ua = LWP::UserAgent->new;
my $url = URI->new( $rfid_url . '/register.pl');
$url->query_form(
- local_ip => $ip->{eth0},
+ local_ip => $ip->{eth0}
|| $ip->{ (keys %$ip)[0] }
,
);
warn "GET ",$url->as_string;
my $response = $ua->get($url);
);
warn "GET ",$url->as_string;
my $response = $ua->get($url);