1Palm::StdAppInfo(3)   User Contributed Perl Documentation  Palm::StdAppInfo(3)
2
3
4

NAME

6       Palm::StdAppInfo - Handle standard AppInfo blocks in Palm OS PDBs
7

VERSION

9       This document describes version 1.400 of Palm::StdAppInfo, released
10       March 14, 2015 as part of Palm version 1.400.
11

SYNOPSIS

13       Usually:
14
15           package MyPDBHandler;
16           use Palm::StdAppInfo();             # Note the parentheses
17
18           @ISA = qw( Palm::StdAppInfo );
19
20           use constant APPINFO_PADDING = 1;
21
22           sub ParseAppInfoBlock {
23               my $self = shift;
24               my $data = shift;
25               my $appinfo = {};
26
27               &Palm::StdAppInfo::parse_StdAppInfo($appinfo, $data);
28
29               $app_specific_data = $appinfo->{other};
30           }
31
32           sub PackAppInfoBlock {
33               my $self = shift;
34               my $retval;
35
36               $self->{appinfo}{other} = <pack application-specific data>;
37               $retval = &Palm::StdAppInfo::pack_StdAppInfo($self->{appinfo});
38               return $retval;
39           }
40
41       Or as a standalone "PDB" helper class:
42
43           use Palm::StdAppInfo;
44

DESCRIPTION

46       Many Palm applications use a common format for keeping track of
47       categories.  The "Palm::StdAppInfo" class deals with this common
48       format:
49
50               $pdb = new Palm::PDB;
51               $pdb->Load("myfile.pdb");
52
53               @categories  = @{ $pdb->{appinfo}{categories} };
54               $lastUniqueID =   $pdb->{appinfo}{lastUniqueID};
55               $other        =   $pdb->{appinfo}{other};
56
57       where:
58
59       @categories is an array of references-to-hash:
60
61       "$cat = $categories[0];"
62       "$cat->{name}"
63           The name of the category, a string of at most 16 characters.
64
65       "$cat->{id}"
66           The category ID, an integer in the range 0-255. Each category has a
67           unique ID. By convention, 0 is reserved for the "Unfiled" category;
68           IDs assigned by the Palm are in the range 1-127, and IDs assigned
69           by the desktop are in the range 128-255.
70
71       "$cat->{renamed}"
72           A boolean. This field is true iff the category has been renamed
73           since the last sync.
74
75       $lastUniqueID is (I think) the last category ID that was assigned.
76
77       $other is any data that follows the category list in the AppInfo block.
78       If you're writing a helper class for a PDB that includes a category
79       list, you should parse this field to get any data that follows the
80       category list; you should also make sure that this field is initialized
81       before you call &Palm::StdAppInfo::pack_AppInfo.
82
83   APPINFO_PADDING
84       Normally, the AppInfo block includes a byte of padding at the end, to
85       bring its length to an even number. However, some databases use this
86       byte for data.
87
88       If your database uses the padding byte for data, then your
89       &ParseAppInfoBlock method (see "SYNOPSIS") should call
90       &parse_StdAppInfo with a true $nopadding argument.
91
92       If, for whatever reason, you wish to inherit
93       &StdAppInfo::ParseAppInfoBlock, then add
94
95           use constant APPINFO_PADDING => 0;
96
97       to your handler package, to tell it that the padding byte is really
98       data.
99

FUNCTIONS

101   seed_StdAppInfo
102           &Palm::StdAppInfo::seed_StdAppInfo(\%appinfo);
103
104       Creates the standard fields in an existing AppInfo hash. Usually used
105       to ensure that a newly-created AppInfo block contains an initialized
106       category array:
107
108               my $appinfo = {};
109
110               &Palm::StdAppInfo::seed_StdAppInfo($appinfo);
111
112       Note: this is not a method.
113
114   newStdAppInfo
115           $appinfo = Palm::StdAppInfo->newStdAppInfo;
116
117       Like "seed_StdAppInfo", but creates an AppInfo hash and returns a
118       reference to it.
119
120   new
121           $pdb = new Palm::StdAppInfo;
122
123       Create a new PDB, initialized with nothing but a standard AppInfo
124       block.
125
126       There are very few reasons to use this, and even fewer good ones. If
127       you're writing a helper class to parse some PDB format that contains a
128       category list, then you should make that helper class a subclass of
129       "Palm::StdAppInfo".
130
131   parse_StdAppInfo
132           $len = &Palm::StdAppInfo::parse_StdAppInfo(\%appinfo, $data, $nopadding);
133
134       This function (this is not a method) is intended to be called from
135       within a PDB helper class's "ParseAppInfoBlock" method.
136
137       parse_StdAppInfo() parses a standard AppInfo block from the raw data
138       $data and fills in the fields in %appinfo. It returns the number of
139       bytes parsed.
140
141       $nopadding is optional, and defaults to false. Normally, the AppInfo
142       block includes a padding byte at the end. If $nopadding is true, then
143       &parse_StdAppInfo assumes that the padding byte is application data,
144       and includes it in $appinfo{'other'}, so that the caller can parse it.
145
146   ParseAppInfoBlock
147           $pdb = new Palm::StdAppInfo;
148           $pdb->ParseAppInfoBlock($data);
149
150       If your application's AppInfo block contains standard category support
151       and nothing else, you may choose to just inherit this method instead of
152       writing your own "ParseAppInfoBlock" method. Otherwise, see the example
153       in "SYNOPSIS".
154
155   pack_StdAppInfo
156           $data = &Palm::StdAppInfo::pack_StdAppInfo(\%appinfo);
157
158       This function (this is not a method) is intended to be called from
159       within a PDB helper class's "PackAppInfoBlock" method.
160
161       "pack_StdAppInfo" takes an AppInfo hash and packs it as a string of raw
162       data that can be written to a PDB.
163
164       Note that if you're using this inside a helper class's
165       "PackAppInfoBlock" method, you should make sure that $appinfo{other} is
166       properly initialized before you call
167       &Palm::StdAppInfo::pack_StdAppInfo.
168
169       $nopadding is optional, and defaults to false. Normally, the AppInfo
170       block includes a byte of padding at the end. If $nopadding is true,
171       then &pack_StdAppInfo doesn't include this byte of padding, so that the
172       application can use it.
173
174   PackAppInfoBlock
175           $pdb = new Palm::StdAppInfo;
176           $data = $pdb->PackAppInfoBlock();
177
178       If your application's AppInfo block contains standard category support
179       and nothing else, you may choose to just inherit this method instead of
180       writing your own "PackAppInfoBlock" method. Otherwise, see the example
181       in "SYNOPSIS".
182
183   addCategory
184           $pdb->addCategory($name [, $id [, $renamed]]);
185
186       Adds a category to $pdb.
187
188       The $name argument specifies the new category's name.
189
190       The optional $id argument specifies the new category's numeric ID; if
191       omitted or undefined, &addCategory will pick one.
192
193       The optional $renamed argument is a boolean value indicating whether
194       the new category should be marked as having been modified. This
195       defaults to true since, conceptually, &addCategory doesn't really add a
196       category: it finds one whose name happens to be empty, and renames it.
197
198       Returns a true value if successful, false otherwise. In case of
199       failure, &addCategory sets $Palm::StdAppInfo::error to an error
200       message.
201
202   deleteCategory
203           $pdb->deleteCategory($name);
204
205       Deletes the category with name $name. Actually, though, it doesn't
206       delete the category: it just changes its name to the empty string, and
207       marks the category as renamed.
208
209   renameCategory
210           $pdb->renameCategory($oldname, $newname);
211
212       Renames the category named $oldname to $newname.
213
214       If successful, returns a true value. If there is no category named
215       $oldname, returns a false value and sets $Palm::StdAppInfo::error to an
216       error message.
217

SEE ALSO

219       Palm::PDB
220

CONFIGURATION AND ENVIRONMENT

222       Palm::StdAppInfo requires no configuration files or environment
223       variables.
224

INCOMPATIBILITIES

226       None reported.
227

BUGS AND LIMITATIONS

229       No bugs have been reported.
230

AUTHORS

232       Andrew Arensburger "<arensb AT ooblick.com>"
233
234       Currently maintained by Christopher J. Madsen "<perl AT cjmweb.net>"
235
236       Please report any bugs or feature requests to
237       "<bug-Palm AT rt.cpan.org>" or through the web interface at
238       <http://rt.cpan.org/Public/Bug/Report.html?Queue=Palm>.
239
240       You can follow or contribute to p5-Palm's development at
241       <https://github.com/madsen/p5-Palm>.
242
244       This software is copyright (c) 2003 by Andrew Arensburger & Alessandro
245       Zummo.
246
247       This is free software; you can redistribute it and/or modify it under
248       the same terms as the Perl 5 programming language system itself.
249

DISCLAIMER OF WARRANTY

251       BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
252       FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
253       WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
254       PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
255       EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
256       WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
257       ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
258       YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
259       NECESSARY SERVICING, REPAIR, OR CORRECTION.
260
261       IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
262       WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
263       REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE
264       TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
265       CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
266       SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
267       RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
268       FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
269       SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
270       DAMAGES.
271
272
273
274perl v5.36.0                      2023-01-20               Palm::StdAppInfo(3)
Impressum