View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Wolfgang Hommel > pcsc-perl > Chipcard::PCSC



Annotate this POD


New  1
Open  1
View/Report Bugs
Module Version: 0.05   Source  


Chipcard::PCSC - Smart card reader interface library


 my $hContext = new Chipcard::PCSC();

 @ReadersList = $hContext->ListReaders ();

 $hContext->GetStatusChange(\@readers_states, $timeout);

 $apdu = Chipcard::PCSC::array_to_ascii(@apdu);

 @apdu = Chipcard::PCSC::ascii_to_array($apdu);

 $hContext = undef;


The PCSC module implements the Chipcard::PCSC class. Objects of this class are used to communicate with the PCSC-lite daemon (see pcscd(1) for more information).

PC/SC represents an abstraction layer to smart card readers. It provides a communication layer with a wide variety of smart card readers through a standardized API.

A PCSC object can be used to communicate with more than one reader through Chipcard::PCSC::Card objects. Please read Chipcard::PCSC::Card for extended information on how to talk to a smart card reader.

A PCSC object uses the following property: $pcsc_object->{hContext} the context returned by the pcsc library


The following methods can be used to construct a PCSC object:


Chipcard::PCSC constructors return an undef value when the object can not be created. $Chipcard::PCSC::errno can be used to get more information about the error. (See section "ERROR HANDLING" below for more information)

Chipcard::PCSC METHODS ^

Here is a list of all the methods that can be used with a PCSC object.


All functions from PCSC objects save the return value in a global variable called $Chipcard::PCSC::errno. This variable therefore holds the latest status of PCSC.

It is a double-typed magical variable that behaves just like $!. This means that it both holds a numerical value describing the error and the corresponding string. The numerical value may change from a system to another as it depends on the PCSC library...

Here is a small example of how to use it:

 $hContext = new Chipcard::PCSC();
 die ("Can't create the PCSC object: $Chipcard::PCSC::errno\n")
     unless (defined $hContext);

In case the last call was successful, $Chipcard::PCSC::errno contains the SCARD_S_SUCCESS status. Here is a list of all possible error codes. They are defined as read-only variables with in the PCSC module:



PCSClite users will also be able to use the following (PCSClite specific) codes:


In addition, the wrapper defines:



pcscd(1) manpage has useful information about PC/SC lite. Chipcard::PCSC::Card manpage gives information about how to communicate with a reader and the smart card inside it.


(C) Lionel VICTOR & Ludovic ROUSSEAU, 2001-2004, GNU GPL (C) Ludovic ROUSSEAU, 2005-2008, GNU GPL


 Lionel VICTOR <>

 Ludovic ROUSSEAU <>
syntax highlighting: