The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

RFID::Tag - Abstract base class for an RFID tag object

SYNOPSIS

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.

DESCRIPTION

Methods

get

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.

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.

id method

Returns the tag's ID as a string. This is a shortcut for using the get method.

type

Returns the tag's type as a string. This is a shortcut for using the get method.

tagcmp

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.

You can use this method in a call to 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.

Properties

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.

Antenna

Some Tags.

Which antenna this tag was detected from.

id

All Tags.

The identifier for this tag as a string.

Location

Some Tags.

The location where this tag was detected as a string.

Time

Some Tags.

The time when this tag was detected, in the format returned by time (Unix epoch time).

Type

A string describing the type of this tag.

SEE ALSO

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.

AUTHOR

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.