- PROGRAMMER'S INTERFACE
- new ($dict, $name, %input_fmt)
- set_label ($label)
- set_write_format (%fmt)
- set_print_format (%fmt)
- get_write_format ()
- get_print_format ()
- set_output_format (%fmt)
- clear_value_labels ()
- add_value_label ($key, $label)
- add_value_labels (@array)
- set_value_labels ($key, $value)
- set_missing_values ($val1 [, $val2[, $val3] ])
- get_name ()
- get_label ()
- get_value_labels ()
- Miscellaneous subroutines
- COPYRIGHT AND LICENSE
PSPP-Perl - Perl extension to PSPP
PSPP-Perl provides an interface to the libraries used by pspp to read and write system files.
None by default.
The subroutines in this package return zero or unref on error. When errors occur, a string describing the error is written to
Creates a new dictionary. This returned dictionary will be empty. Returns undef on failure.
Sets the documents (comments) to
string to the documents.
Removes all documents.
Sets the weighting variable to
Returns the number of variables in the dictionary.
idxth variable from the dictionary. Returns undef if
idx is greater than or equal to the number of variables in the dictionary.
Returns the variable from the dictionary whose name is
name. If there is no such variable, a null reference will be returned.
Contains constants used to denote variable format types. The identifiers are the same as those used in pspp to denote formats. For example
PSPP::Fmt::F defines floating point format, and
PSPP::Fmt::A denotes string format.
Creates and returns a new variable in the dictionary
dict. The new variable will have the name
name. The input format is set by the
input_fmt parameter (See "PSPP::Fmt"). By default, the write and print formats are the same as the input format. The write and print formats may be changed (See "set_write_format"), "set_print_format"). The input format may not be changed after the variable has been created. If the variable cannot be created, undef is returned.
Sets the variable label to
Sets the write format to
fmt. <fmt> is a hash containing the keys:
A constant denoting the format type. See "PSPP::Fmt".
An integer denoting the number of decimal places for the format.
An integer denoting the width of the format.
On error the subroutine returns zero.
Sets the print format to
fmt. On error the subroutine returns zero.
Returns a reference to a hash containing the write format for the variable.
Returns a reference to a hash containing the print format for the variable.
Sets the write and print formats to
fmt. This is the same as calling set_write_format followed by set_print_format. On error the subroutine returns zero.
Removes all value labels from the variable.
Adds the value label
label to the variable for the value
key. On error the subroutine returns zero.
Sets the missing values for the variable. No more than three missing values may be specified.
Returns a reference to a hash of the custom variable attributes. Each value of the hash is a reference to an array containing the attribute values.
Returns the name of the variable.
Returns the label of the variable or undef if there is no label.
Returns a reference to a hash containing the value labels for the variable. The hash is keyed by data values which correpond to the labels.
Creates a new system file from the dictionary
dict. The file will be written to the file called
opt, if specified, is a hash containing optional parameters for the system file. Currently, the only supported parameter is
compress is non zero, then the system file written will be in the compressed format. On error, undef is returned.
Appends a case to the system file.
Case is an array of scalars, each of which are the values of the variables in the dictionary corresponding to the system file. The special value
PSPP::SYSMIS may be used to indicate that a value is system missing. If the array contains less elements than variables in the dictionary, remaining values will be set to system missing.
Closes the system file.
This subroutine closes the system file and flushes it to disk. No further cases may be written once the file has been closed. The system file will be automatically closed when it goes out of scope.
Opens a system file for reading.
Open is used to read data from an existing system file. It creates and returns a PSPP::Reader object which can be used to read data and dictionary information from
Returns the dictionary associated with the reader.
Retrieves the next case from the reader. This method returns an array of scalars, each of which are the values of the data in the system file. The first call to
open has been called retrieves the first case in the system file. Each subsequent call retrieves the next case. If there are no more cases to be read, the function returns an empty list.
If the case contains system missing values, these values are set to the empty string.
The following subroutines provide (hopefully) useful information about the values retrieved from a reader.
Returns a scalar containing a string representing
value formatted according to the print format of
variable. In the most common ussage,
value should be a value of
Returns non-zero if
value is either system missing, or if it matches the user missing criteria for
John Darrington, <firstname.lastname@example.org>
Copyright (C) 2007, 2008, 2009 by Free Software Foundation
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.