RFID::Tag - Abstract base class for an RFID tag object
This abstract base class provides a general framework for an abstract RFID tag. These objects are usually returned by an RFID::Reader object:
use RFID::SchmoozeMatic::Reader; my $reader = RFID::SchmoozeMatic::Reader::TCP->new(PeerAddr => 'schmooze.example.com', PeerPort => 4001, ) or die "Couldn't create reader object"; my @tags = RFID::SchmoozeMatic::Reader->new->readtags(); foreach my $tag (@tags) { my %t = $tag->get(qw(id Type Location)) print "I see tag $t{Type}.$t{id} at $t{Location}\n"; }
Tags don't support changing their properties; if you need to do that, create a new tag using some of the properties of the tag you want to change.
Get various properties of the tag. This method takes a list of parameters whose values you'd like to get. In a list context, it returns a hash with the parameters you asked for as the keys, and their values as the values. In a scalar context, it returns the value of the last property requested. If an error occurs or a value for the requested property can't be found, it is set to undef.
undef
For example:
my $tagtype = $tag->get('Type'); my %tag_properties = $tag->get(qw(Type ID Location));
See Properties for the properties that can be retreived with get.
Returns the tag's ID as a string. This is a shortcut for using the get method.
Returns the tag's type as a string. This is a shortcut for using the get method.
Compares another tag to this one, returning a value like cmp: -1 if this tag is smaller, 0 if the tags are the same, or 1 if the other tag is smaller.
cmp
You can use this method in a call to sort:
sort
@sorted_tags = sort { $a->tagcmp($b) } @tags;
The implementation in the abstract base class does an alphabetic comparison of the tags IDs converted to strings.
These are the properties you can retreive with get. Properties which must be available with all types of tags are marked with All Tags; properties which may or may not be available are marked with Some Tags.
Some Tags.
Which antenna this tag was detected from.
All Tags.
The identifier for this tag as a string.
The location where this tag was detected as a string.
The time when this tag was detected, in the format returned by time (Unix epoch time).
time
A string describing the type of this tag.
RFID::Reader, http://whereabouts.eecs.umich.edu/code/rfid-perl/, The manual for your particular RFID driver class, The manual for your RFID driver's tag class.
Scott Gifford <gifford@umich.edu>, <sgifford@suspectclass.com>
Copyright (C) 2004-2006 The Regents of the University of Michigan.
See the file LICENSE included with the distribution for license information.
To install RFID::Reader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RFID::Reader
CPAN shell
perl -MCPAN -e shell install RFID::Reader
For more information on module installation, please visit the detailed CPAN module installation guide.