SCAM Perl Front End Documentation

Tim TimeWaster <tim@cuba.xs4all.nl>

Scam Library

This library is used for communicating with the SCAM executable via named pipes.

Using the Library

use Scam;

Be sure that the $SCAM variable is set to the correct value.

Variables

The following variable(s) can be set:

Functions

init
starts the SCAM executable and sets up the communication with it.

recv
recv timeout
waits for output or error (or both) from the SCAM executable for at most timeout seconds. Without an argument it will wait for at most $DFL_WAIT seconds. Returns a list consisting of ($out,$err), where $out is the output from the SCAM executable and $err is the error from the SCAM program.

send string
sends string to the SCAM executable. string is the text you would normally have typed in yourself. A trailing \n is not necessary.
This function is usually not called directly, but from another function in this module.

reader readername
selects the reader specified by readername. reader is the text you would normally type after the reader command in SCAM.

reset
resets the smart card.

talk string
sends string to the smart card. string is the text you would normally type after the send command, without the trailing dot.

Example

#!/usr/bin/perl

use Scam;

Scam::init();
Scam::reader("dumbmouse(wait_etu=100,conv=inverse,parity=odd)");

# Flush the serial port & the named pipe
Scam::send("dump");
Scam::recv();

Scam::reset();
($out, $err) = Scam::recv(5.2); # wait 5.2 seconds

chomp $out; chomp $err;
print "output = $out, error = $err\n";
The flush should not be necessary, but if we do not do this, for some reason the output on the named pipe is not correct the first time we read from it.

Bugs