Quite amount of interest exists in use of Perl for interprocess message passing and object-oriented persistence, in fact there is a list called poop-scoop (perl 0bject-oriented persistence) devoted to this this topic.

Cons is a tool for constructing software systems --- a Perl-based make replacement.

However, as I was reading through its docs, I noticed that it automatically would export scalars from a Cons program (nothing but a perl script that uses the Cons API) in one directory to a Cons program in another... poof! This means it does message passing for you without learning POE or Class::Tom or some other beast.

So now I unveil my tour de force, my arc de triomphe, my yo-check-it-out-daddy-its-megafresh, example of having Cons automatically serialize my data (ala, Data::Dumper or Freezethaw or Storable) and de-serialize it in another process:

# This is a Cons "Construct" file. It exports a scalar # named po, which is received by the perl program # tmp/Conscript $po = { 1, 'two', 'buckle my', 'shoo' }; Export qw (po); Build qw (tmp/Conscript);
# This is the tmp/Conscript. I receive serialized data and # process it, in this case, simply printing it to STDERR Import qw( po ) ; use Data::Dumper; warn Data::Dumper->Dump([$po],['po']);

Output of run is

$po = { 1 => 'two', 'buckle my' => 'shoo' };

Replies are listed 'Best First'.
RE: Object-Oriented Persistence and Message Passing with Cons
by mirod (Canon) on Oct 13, 2000 at 18:54 UTC

    Humm... I fail to understand what the advantage of this method over just Data::Dumper

    Plus how does it deal with code references, or nested references (as in a tree)? Those are usually the hard parts.

    Would you care to elaborate?

      This method is more definitional than the use of Data::Dumper. You focus on importing and exporting and use as opposed to dumping and evaling.

      Excellent question, it DOES handle both nested references and code refs. Updated and more complex example follows:

      Construct File

      po = { 1, 'two', 'buckle my', [ 'Florsheim', 'Nike', 'Sandals', 'Thongs' ], 'shoo' }; $sub = sub { print "code ref passed to the edge of panic boyeeeee\n" } +; Export qw (po sub); Build qw (tmp/Conscript);

      Conscript file

      Import qw( po sub ) ; use Data::Dumper; warn Data::Dumper->Dump([$po],['po']); $sub->();

      OUTPUT

      $po = { 'shoo' => undef, 1 => 'two', 'buckle my' => [ 'Florsheim', 'Nike', 'Sandals', 'Thongs' ] }; code ref passed to the edge of panic boyeeeee