Nokia::File::NFB::Element - storage for a NFB file element.
use Nokia::File::NFB::Element; ## create an object. my $element = Nokia::File::NFB::Element({ 'name' => $filename, 'type' => $filetype, 'time' => $timestamp, 'data' => $rawdata, }); ## pretty print it. print $element->pretty_print(), "\n"; ## check if the filename is /CALENDAR if ($element->name() eq '/CALENDAR') { ## chang the filename. $element->name('/CALENDAR2'); } ## put the binary representation of the data into a filehandle. print FH $element->binary();
This module is used to store file elements from a Nokia NFB file.
It is mainly used internally from Nokia::File::NFB, but can be used to create or modify data to be included in an NFB file.
Creates a new Nokia::File::NFB::Element object.
my nfb = Nokia::File::NFB::Element->new({ 'type' => $filetype, 'name' => $filename, 'timestamp' => $timestamp, 'data' => $data, });
All the elements are optional at creation stage and can be added at later.
type - This is the type of file. It can be either '1' to represent a FILE, or '2' to represent a directory.
name - The name of the file or directory this element represents.
timestamp - The timestamp of the file. If none is given it takes the current time from the system clock.
data - The raw data contained in the element.
Get or set the filetype of the element.
## make the element a FILE. $nfb->type(1); ## show the element's file type. print "The file type is: " . $nfb->type();
The value passed in can only be '1' to represent a file, or '2' to represent a directory.
Get or set the filename of the element.
## set the filename to be \Calendar. $nfb->type('\\Calendar'); ## show the element's file name. print "The file name is: " . $nfb->name();
Get or set the timestamp of the element.
## set the timestamp to be the current time. $nfb->timestamp(time()); ## show the element's timestamp. print "The timestamp is: " . $nfb->timestamp();
Get or set the data of the element.
## set the data. $nfb->data($testdata); ## get the element's data. my $testdata = $nfb->data();
Get the size of the data part of the element.
## get the size of the data. my $datasize = $nfb->size();
Return the element in binary format. This is suitable for the Nokia::File::NFB::Element to use directly.
## return the element in binary format. my $element = $nfb->binary();
Return a string with the elements (except the raw data) in a format suitable for debugging.
## print the element. print $nfb->pretty_print();
Nokia::File::NFB
Nokia PC Suite - http://www.nokia.com/
Robert Price, <rprice@cpan.org>
http://www.robertprice.co.uk/
Copyright (C) 2004 by Robert Price
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
To install Nokia::File::NFB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nokia::File::NFB
CPAN shell
perl -MCPAN -e shell install Nokia::File::NFB
For more information on module installation, please visit the detailed CPAN module installation guide.