-
-
13 Mar 2022 08:40:18 UTC
- Distribution: perl
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (2152)
- Testers
- Kwalitee
Bus factor: 15- License: perl_5
- Activity
24 month- Tools
- Download (17.35MB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- perl5-porters@perl.org
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
OS2::PrfDB - Perl extension for access to OS/2 setting database.
SYNOPSIS
use OS2::PrfDB; tie %settings, OS2::PrfDB, 'my.ini'; tie %subsettings, OS2::PrfDB::Sub, 'my.ini', 'mykey'; print "$settings{firstkey}{subkey}\n"; print "$subsettings{subkey}\n"; tie %system, OS2::PrfDB, SystemIni; $system{myapp}{mykey} = "myvalue";
DESCRIPTION
The extension provides both high-level and low-level access to .ini files.
High level access
High-level access is the tie-hash access via two packages:
OS2::PrfDB
andOS2::PrfDB::Sub
. First one supports one argument, the name of the file to open, the second one the name of the file to open and so called Application name, or the primary key of the database.tie %settings, OS2::PrfDB, 'my.ini'; tie %subsettings, OS2::PrfDB::Sub, 'my.ini', 'mykey';
One may substitute a handle for already opened ini-file instead of the file name (obtained via low-level access functions). In particular, 3 functions SystemIni(), UserIni(), and AnyIni() provide handles to the "systemish" databases. AniIni will read from both, and write into User database.
Low-level access
Low-level access functions reside in the package
OS2::Prf
. They areOpen(file)
-
Opens the database, returns an integer handle.
Close(hndl)
-
Closes the database given an integer handle.
Get(hndl, appname, key)
-
Retrieves data from the database given 2-part-key
appname
key
. Ifkey
isundef
, return the "\0" delimited list ofkey
s, terminated by \0. Ifappname
isundef
, returns the list of possibleappname
s in the same form. GetLength(hndl, appname, key)
-
Same as above, but returns the length of the value.
Set(hndl, appname, key, value [ , length ])
-
Sets the value. If the
value
is not defined, removes thekey
. If thekey
is not defined, removes theappname
. System(val)
-
Return an integer handle associated with the system database. If
val
is 1, it is User database, if 2, System database, if 0, handle for "both" of them: the handle works for read from any one, and for write into User one. Profiles()
-
returns a reference to a list of two strings, giving names of the User and System databases.
SetUser(file)
-
(Not tested.) Sets the profile name of the User database. The application should have a message queue to use this function!
Integer handles
To convert a name or an integer handle into an object acceptable as argument to tie() interface, one may use the following functions from the package
OS2::Prf::Hini
:Exports
SystemIni(), UserIni(), and AnyIni().
AUTHOR
Ilya Zakharevich, ilya@math.ohio-state.edu
SEE ALSO
perl(1).
Module Install Instructions
To install utf8, copy and paste the appropriate command in to your terminal.
cpanm utf8
perl -MCPAN -e shell install utf8
For more information on module installation, please visit the detailed CPAN module installation guide.