in reply to Return values to outside programs

It depends on the value(s) you're attempting to return from the perl script - for simple integer values exit is your friend - for more complicated return values, something along the lines you're already following sounds like the way since you've already got it working.

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Return values to outside programs
by patt (Scribe) on Aug 21, 2009 at 11:41 UTC
    Thanks for those replies. My return values are complicated, being String, integer, octal and boolean (either singly or combined). I was looking at pipes just after I posted, but they don't appear to solve my problem. I'll investigate perlipc (have not done that yet, was not aware of it). Since my returns may be only one line of 'text' or several hundred thousand, depending on the search criteria entered I'm strongly leaning towards write to disk, read from disk as the most efficient way to solve my problem.

      You could use data serialization with XML. That way you can get the data back as a Java object. The Perl program just need to write the results somewhere as a file.

      If this is too simple for you application (like it receives several concurrent requests) then you should look for using sockets and XML.

      Alceu Rodrigues de Freitas Junior
      ---------------------------------
      "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

        You could also use JSON instead of XML, which is easier to parse and produces less overhead. JSON interfaces exist for all major and a lot of minor languages, including, of course, Perl, Java, Javascript, C, C++, and C#.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      If you have large, complex data sets, you might consider a database as an intermediary rather than serialization to a file.