Click here to get back home

Reading Data::Dumper output

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Reading Data::Dumper output RB 02-08-2008
Posted by RB on February 8, 2008, 12:11 pm
Please log in for more thread options
Hi,

I'm trying to use Data::Dumper to determine how to read a structure
and determine how to unpack it. I'm seeing entries for INTYPE with
values of 8 or 9. Where would I find what a type 8 or 9 is and
generally how to interpret the output?

I'm running perl v5.8.8 build 822

'TYPE' => {
'DECIMALS' => 0,
'NAME' => 'TYPE',
'POSITION' => 1,
'OFFSET' => 0,
'INTYPE' => 9,
'LEN' => 2,
'EXID' => 's'
},
'LOAD1_AVG' => {
'DECIMALS' => 0,
'NAME' => 'LOAD1_AVG',
'POSITION' => 5,
'OFFSET' => 12,
'INTYPE' => 8,
'LEN' => 4,
'EXID' => 'I'
},
'NBR_CPU' => {
'DECIMALS' => 0,
'NAME' => 'NBR_CPU',
'POSITION' => 4,
'OFFSET' => 8,
'INTYPE' => 8,
'LEN' => 4,
'EXID' => 'I'
},

Thanks,
Russ

Posted by Mark Clements on February 8, 2008, 12:35 pm
Please log in for more thread options
RB wrote:
> Hi,
>
> I'm trying to use Data::Dumper to determine how to read a structure
> and determine how to unpack it. I'm seeing entries for INTYPE with
> values of 8 or 9. Where would I find what a type 8 or 9 is and
> generally how to interpret the output?
>
> I'm running perl v5.8.8 build 822
<snip>
> },
> 'NBR_CPU' => {
> 'DECIMALS' => 0,
> 'NAME' => 'NBR_CPU',
> 'POSITION' => 4,
> 'OFFSET' => 8,
> 'INTYPE' => 8,
> 'LEN' => 4,
> 'EXID' => 'I'
> },
That would depend on the application that created the data structure. It
has nothing to do with Data::Dumper per se. The documentation for
Data::Dumper would probably be a good start, though.

http://search.cpan.org/~ilyam/Data-Dumper-2.121/Dumper.pm


Mark

Posted by Jim Gibson on February 8, 2008, 12:49 pm
Please log in for more thread options
In article

> Hi,
>
> I'm trying to use Data::Dumper to determine how to read a structure
> and determine how to unpack it. I'm seeing entries for INTYPE with
> values of 8 or 9. Where would I find what a type 8 or 9 is and
> generally how to interpret the output?
>
> I'm running perl v5.8.8 build 822
>
> 'TYPE' => {
> 'DECIMALS' => 0,
> 'NAME' => 'TYPE',
> 'POSITION' => 1,
> 'OFFSET' => 0,
> 'INTYPE' => 9,
> 'LEN' => 2,
> 'EXID' => 's'
> },

[ rest snipped]

Perl structures like the above are actually a hash of hashes. You don't
show how you built your hash or the code that prints it, but it looks
like you have a hash with 3 elements. The values are references to 3
more hashes, each with 7 elements.

The => is a 'fat comma' that indicates a key/value pair as part of a
hash. The { indicates a reference to an anonymous hash with its own
key/value pairs. A [ character would indicate a reference to an array.

You can access the values like this:

print $hash->;

or

print $hash;

which would print the output TYPE.

See 'perldoc perldata' for more details on Perl data structures.

If you need any more help, please post a short program that
demonstrates your problem.

Thanks.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Similar ThreadsPosted
weirdness with CPAN modules that use Data::Dumper June 30, 2007, 2:34 am
reading array data back into perl with YAML December 1, 2005, 2:22 pm
Output binary data in base64 in YAML January 14, 2005, 7:20 pm
ANNOUNCE: Code::Dumper - a ::Dumper for code. Available on CPAN November 21, 2005, 11:03 am
Template-Toolkit: Flushing Output or Incremental Output, how? September 13, 2007, 2:45 pm
Help reading PDF to get text... November 26, 2004, 3:50 am
Any module for reading Apache log files? October 6, 2004, 9:17 am
Reading AND writing Excel spreadsheets April 30, 2005, 10:05 am
Increase file reading efficiency March 19, 2008, 1:26 pm
Device::Cdio - encapsulates CD control and reading February 10, 2006, 2:22 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap