How to run perl script which is loaded into a string?

Discussion in 'Perl Misc' started by yong, Jan 5, 2006.

  1. yong

    yong Guest

    I load some perl script from socket,and store them into some
    strings.Can I send the strings to perl directly and run them?

    thanks
    yong, Jan 5, 2006
    #1
    1. Advertising

  2. yong wrote:
    > I load some perl script from socket,and store them into some
    > strings.Can I send the strings to perl directly and run them?


    You can create a gaping security hole by using eval().

    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett
    Josef Moellers, Jan 5, 2006
    #2
    1. Advertising

  3. yong

    yong Guest

    Thanks a lot. :)

    And by the way,if I load the script to string with other language for
    exmaple C,how can I do this?

    thanks
    yong, Jan 5, 2006
    #3
  4. yong

    Anno Siegel Guest

    yong <> wrote in comp.lang.perl.misc:
    > Thanks a lot. :)
    >
    > And by the way,if I load the script to string with other language for
    > exmaple C,how can I do this?


    You ask a group that concerns itself with C.

    Anno
    --
    If you want to post a followup via groups.google.com, don't use
    the broken "Reply" link at the bottom of the article. Click on
    "show options" at the top of the article, then click on the
    "Reply" at the bottom of the article headers.
    Anno Siegel, Jan 5, 2006
    #4
  5. yong

    Samwyse Guest

    yong wrote:
    > Thanks a lot. :)
    >
    > And by the way,if I load the script to string with other language for
    > exmaple C,how can I do this?


    Not nearly as easily. You need to write the string to a file, invoke
    your favorite C compiler, and run the resulting executable. All of the
    above needs to be done in a way that avoids collisions if multiple
    instances of your parent script are running simultaneously.
    Samwyse, Jan 5, 2006
    #5
  6. yong wrote:

    > And by the way,if I load the script to string with other language for
    > exmaple C,how can I do this?


    perldoc perlembed
    Brian McCauley, Jan 5, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marcelo Birnbach [MS]
    Replies:
    0
    Views:
    3,321
    Marcelo Birnbach [MS]
    Jun 28, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,792
  3. John
    Replies:
    0
    Views:
    358
  4. Replies:
    6
    Views:
    146
    Tad McClellan
    Apr 14, 2005
  5. jeet_sen
    Replies:
    5
    Views:
    135
    Randy Webb
    Mar 8, 2006
Loading...

Share This Page