Skip to content

Instantly share code, notes, and snippets.

@cubabit
Created May 2, 2013 18:00
Show Gist options
  • Save cubabit/5504048 to your computer and use it in GitHub Desktop.
Save cubabit/5504048 to your computer and use it in GitHub Desktop.
#!perl
use Dancer;
get '/' => sub {
return <<EOF;
<html>
<body>
<form>
RFID: <input type="text" name="rfid" /> <br />
PID: <input type="pid" name="pid" /> <br />
Location: <input type="location" name="location" /> <br />
Size <input type="size" name="size" /> <br />
<input type="submit" value="submit" />
</form>
</body>
</html>
EOF
};
get '/tag' => sub {
my @out = `nfc-list`;
my $rfid;
foreach my $line ( @out ) {
if ( $line =~ /UID/ ) {
$rfid = $line;
$rfid =~ s/UID\s+\(.+\)://;
$rfid =~ s/\s+//g;
}
}
return $rfid;
};
dance;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment