Class::PObject::Driver::csv - CSV Pobject Driver


Class-PObject documentation  | view source Contained in the Class-PObject distribution.

Index


NAME

Top

Class::PObject::Driver::csv - CSV Pobject Driver

SYNOPSIS

Top

    use Class::PObject;
    pobject Person => {
        columns => ['id', 'name', 'email'],
        driver  => 'csv',
        datasource => {
            Dir => 'data/',
            Table => 'person'
        }
    };

DESCRIPTION

Top

Class::PObject::Driver::csv is a direct subclass of Class::PObjecet::Driver::DBI. It inherits all the base functionality needed for all the DBI-related classes. For details of these methods and their specifications refer to Class::PObject::Driver and Class::PObject::Driver::DBI.

DATASOURCE

datasource attribute should be in the form of a hashref. The following keys are supported

METHODS

Top

Class::PObject::Driver::csv (re-)defines following methods of its own

NOTES

Top

If the table is detected to be missing in the database, it will attempt to create proper table for you. To have more control over how it creates this table, you can fill-in column types using tmap argument.

SPEED

csv driver can get incredibly processor intensive once the number of records exceeds 1,000. This can be fixed by providing indexing functionality to the driver, which it currently misses.

Main issue of the driver is in its save() method, where it first needs to SELECT the records to find out if the record being inserted exists or not. Then, depending on its discoveries either runs INSERT or UPDATE queries.

generate_id() method could also be improved by allowing it to keep track of record count in a separate file.

All these issues need to be addressed in subsequent releases of the library.

SEE ALSO

Top

Class::PObject, Class::PObject::Driver::mysql, Class::PObject::Driver::file

COPYRIGHT AND LICENSE

Top


Class-PObject documentation  | view source Contained in the Class-PObject distribution.