|
OS2::PrfDB - Perl extension for access to OS/2 setting database. |
OS2::PrfDB - Perl extension for access to OS/2 setting database.
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";
The extention provides both high-level and low-level access to .ini files.
High-level access is the tie-hash access via two packages:
OS2::PrfDB and OS2::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 functions reside in the package OS2::Prf. They are
Open(file)Close(hndl)Get(hndl, appname, key)appname key.
If key is undef, return the ``\0'' delimited list of keys,
terminated by \0. If appname is undef, returns the list of
possible appnames in the same form.
GetLength(hndl, appname, key)Set(hndl, appname, key, value [ , length ])value is not defined, removes the key. If
the key is not defined, removes the appname.
System(val)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()SetUser(file)
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:
new(package, file)new_from_int(package, int_hndl [ , filename ])
SystemIni(), UserIni(), and AnyIni().
Ilya Zakharevich, ilya@math.ohio-state.edu
perl(1).
|
OS2::PrfDB - Perl extension for access to OS/2 setting database. |