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

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on passing the parameters from one perl code to another.

Replies are listed 'Best First'.
Re: passing the parameters from one perl code to another.
by shmem (Chancellor) on Jun 06, 2007 at 11:36 UTC
    from one perl code to the other

    Whilst editing or during runtime? What have you tried, do you have any specifics about your problem? Please read I know what I mean. Why don't you?

    Reason for this advice: there are many ways, depending on context, which you don't provide.

    You can pass variables in voking one perl process from within another; you can share variables between multiple files or between packages running one instance of perl; you can use Sockets etc. pp.

    What exactly is your problem? What are you trying to do (yeah, passing variables from one code...), but ... what code?

    Do you even have any? Post it.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: passing the parameters from one perl code to another.
by swampyankee (Parson) on Jun 06, 2007 at 12:45 UTC

    You could use pipes, an intermediate file, or command line arguments. It depends on how the two (or more) Perl codes are expected to run.

    emc

    Any New York City or Connecticut area jobs? I'm currently unemployed.

    There are some enterprises in which a careful disorderliness is the true method.

    —Herman Melville
Re: passing the parameters from one perl code to another.
by ww (Archbishop) on Jun 06, 2007 at 11:57 UTC
    Insufficient information!

    The best way to get help here is to show us what you've done and be explicit about what you understand to be the problem(s). Please UPDATE your question with additional information and the problematic code (or the minimal code that demonstrates your problem.)

    There are far too many possibilities that (sort of) fit your question to offer much of any use, other than the suggestion that you may also wish to use Search (just below the banner in the blue bar) or Super Search, using the terms "parameter" and "pass." It might also be well to read your documentation on topics such as "namespace" or even "subs."

Re: passing the parameters from one perl code to another.
by ikegami (Patriarch) on Jun 06, 2007 at 13:10 UTC
    You want some form of Interprocess Communication (IPC). Perhaps you should look at perlipc? IPC::Open3 might be useful.
Re: passing the parameters from one perl code to another.
by naikonta (Curate) on Jun 06, 2007 at 15:12 UTC
    OK, I did the search for you, now it's your turn to do your part. I, however, don't guarantee that you will find what you need from the search result (well, assuming you do know what you need).
    i am facing the problem in getting it's value in the other code
    In the same ways you would get the parameter values in every script. You could obtain them from @ARGV variable. You may also be interested in Getopt::Long, Getopt::Std, or the -s switch.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Re: passing the parameters from one perl code to another.
by perlfan (Parson) on Jun 06, 2007 at 14:28 UTC
    Are you trying to get 2 different running processes talking or do you just want to interface with some external Perl code in one running instance?

    If the latter, consider creating a Perl module and 'use'ing it in the main script. You could also make a system call or even use the 'eval' function.

    If the former, then previous replies make some good suggestions. You can also check out POE.
Re: passing the parameters from one perl code to another.
by sanPerl (Friar) on Jun 06, 2007 at 14:40 UTC
    Please let us know what have tried so far, so that we can help you in better way.
    Here is what I can suggest you. You can use system or exec command in perl script which will help you executing other perl script. You can pass scalars as arguments. Hope this helps, let me know if this NOT clear
A reply falls below the community's threshold of quality. You may see it by logging in.