Your probably best off not using Data::Dumper, because
to handle this in C++, you're going to need to write
a parser/interperater
for a signifigant subset of perl.
(update: or, see below, you can put
perl inside your C++ program.)
You could also try
Data::Denter which should be more easily parsed then
Data::Dumper's output.
You could also have your perl code write out the structures
in a format designed specifically for the C++ program to
easily read. How complex this syntax would be would
depend on how complex the data you are reading is, though
in many cases you could probably make it pretty simple
(e.g. a flat file, key on one line, number of lines in
value on the next. This is pretty easy to parse in
C++.)
Another option is too embed a perl interperator in your
C++ program, or embed C++ in the perl program,
and have your C++ use perl's API. But, this
may very likely be inappropriate for your situation.
update: for information on
putting perl inside your C++ program see perlembed.
For putting C++ in perl see perlxs.
| [reply] |
For putting C++ in perl see perlxs.
Or check out Inline::CPP.
bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.
| [reply] |
If you're just trying to exchange data between Perl and C++, use the marshalling code from SOAP or XML-RPC. It's already implemented in Perl and C++ and it uses XML for the interchange format. | [reply] |
Another option would be to use any of the CORBA modules available (might be overkill, though).
Also depends on the question if you want/need a type-safe or a type-less interface.
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
| [reply] |