Nokia::File::NFB::ElementNokia::File::NFB::Element is a storage for a NFB file element. | |
Download |
Nokia::File::NFB::Element Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Robert Price
- Publisher web site:
- http://search.cpan.org/~rprice/
Nokia::File::NFB::Element Tags
Nokia::File::NFB::Element Description
Nokia::File::NFB::Element is a storage for a NFB file element. Nokia::File::NFB::Element is a storage for a NFB file element.SYNOPSIS 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.METHODSnew()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.type()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.name()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();timestamp()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();data()Get or set the data of the element. ## set the data. $nfb->data($testdata); ## get the element's data. my $testdata = $nfb->data();size()Get the size of the data part of the element. ## get the size of the data. my $datasize = $nfb->size();binary()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();pretty_print()Return a string with the elements (except the raw data) in a format suitable for debugging. ## print the element. print $nfb->pretty_print(); Requirements: · Perl
Nokia::File::NFB::Element Related Software