siraj has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I need to write the java implementation for unpack function of perl. It would be better if some one can help me saying how can i see the source code for the native perl function unpack.

Thanks.
Siraj

Replies are listed 'Best First'.
Re: unpack implementation
by BrowserUk (Patriarch) on Jan 07, 2011 at 12:44 UTC

    See pp_pack.c. It'll be a lot of work.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: unpack implementation
by cdarke (Prior) on Jan 07, 2011 at 13:08 UTC
Re: unpack implementation
by dHarry (Abbot) on Jan 07, 2011 at 14:44 UTC

    I need to write the java implementation for unpack function of perl

    Do you really need to implement *all* of unpack's functionality??

    I can think of several approaches (each of them having pros and cons):

    1. Use Perl from Java
    2. (re)use/fiddle with the C implementation of unpack via the JNI (Java Native Interface)
    3. Implement only the unpack functionality that you need in Java. The Apache Commons could be a starting point.
    4. Think again! Maybe Java is not the right choice?!

    Anyway, not knowing the reason behind you wanting to implement a "jUnpack" it sounds a bit like a XY Problem.

    Cheers,

    Harry

      Thanks a lot for your suggestions.

      Regards,
      Siraj