in reply to perl Data::Dumper'ed to C++

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.

Replies are listed 'Best First'.
(bbfu) (Inline::CPP) Re2: perl Data::Dumper'ed to C++
by bbfu (Curate) on Sep 06, 2001 at 06:05 UTC

    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.