detaching required scripts

Discussion in 'Ruby' started by MiG, Sep 12, 2005.

  1. MiG

    MiG Guest

    Hello,

    I was trying to remove required script (plugin) from memory via =20
    remove_const.
    It works fine but after that the require method doesn't require the scrip=
    t =20
    again.
    It's because or $" array which contains already required file names.

    Unfortunately the $" variable is read-only so I have to
    1. temporarily rename the script, then require it or
    2. use eval instead of require

    Do you think is there a better solution?

    thank you,
    jan molic
     
    MiG, Sep 12, 2005
    #1
    1. Advertising

  2. ------=_Part_8671_332497.1126521395115
    Content-Type: text/plain; charset=ISO-8859-1
    Content-Transfer-Encoding: quoted-printable
    Content-Disposition: inline

    try load

    ------=_Part_8671_332497.1126521395115--
     
    Lyndon Samson, Sep 12, 2005
    #2
    1. Advertising

  3. MiG wrote:
    > Hello,
    >
    > I was trying to remove required script (plugin) from memory via
    > remove_const.
    > It works fine but after that the require method doesn't require the
    > script again.
    > It's because or $" array which contains already required file names.
    >
    > Unfortunately the $" variable is read-only so I have to


    You cannot assign $" but you can change the array:

    13:08:03 [~]: ruby -r socket -e 'p $";$".delete "socket.so"; p $"'
    ["socket.so"]
    []

    Kind regards

    robert
     
    Robert Klemme, Sep 12, 2005
    #3
  4. MiG wrote:
    > Hello,
    >
    > I was trying to remove required script (plugin) from memory via
    > remove_const.
    > It works fine but after that the require method doesn't require the
    > script again.
    > It's because or $" array which contains already required file names.
    >
    > Unfortunately the $" variable is read-only so I have to
    > 1. temporarily rename the script, then require it or
    > 2. use eval instead of require
    >
    > Do you think is there a better solution?


    Check out my "script" lib on RAA.

    --
    vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
     
    Joel VanderWerf, Sep 12, 2005
    #4
    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. Edward
    Replies:
    2
    Views:
    429
    Edward
    Jul 3, 2004
  2. Attila Feher
    Replies:
    2
    Views:
    442
    Ron Natalie
    Sep 23, 2003
  3. Replies:
    1
    Views:
    341
    Vinay Sajip
    Feb 14, 2006
  4. Sean
    Replies:
    6
    Views:
    575
    Alf P. Steinbach
    Aug 4, 2005
  5. Replies:
    13
    Views:
    580
    Anno Siegel
    Sep 10, 2007
Loading...

Share This Page