Re: [AOLSERVER] Question on ns_eval
I think I figured out what's wrong. Basically, I have a custom proc_doc that does its own things and remaps namespaces and apparently it was calling ns_eval on its own. It looks like it was also confusing the braces because of the args on proc_docs. I think I'm good now. :) On Friday, February 15, 2013 6:48:58 AM UTC+8, Sep Ng wrote: > > Thank you for the responses. I'll conduct some tests. The code I use to > reload right now is: > > eval namespace eval :: source $file > > so on swtching to ns_eval, I thought to maybe skip the namespace eval. > With or without don't seem to make a difference, but I'll > continue to look into this. > > > On Friday, February 15, 2013 2:59:28 AM UTC+8, William J. Webb wrote: >> >> >> >> On Thursday, February 14, 2013 12:33:26 PM UTC-6, William J. Webb wrote: >>> >>> At the core, we use a slightly different version of: >>> proc eval_source { filename } { >>> if { [file exists $filename] } { >>> set err [catch { ns_eval [list source $filename] } result] >>> if { $err } { >>> ns_log notice eval_source ERROR: $result >>> } >>> } else { >>> error "file $filename does not exist." >>> } >>> } >>> #}}} >>> >>> >>> There are some wrappers around this to recurse through directories using >>> patterns, ignore certain types of files, etc. >>> >>> Note that "ns_eval is asynchronous and the script isn't immediately >>> evaluated in the other interpreters until their next atalloc event". E.g.: >>> you run an ns_eval/source in one nscp, you won't see it reflected in a >>> second concurrent nscp session. >>> >>> Will >>> >>> >>> On Thursday, February 14, 2013 3:21:30 AM UTC-6, Sep Ng wrote: Hello, I've been looking into improve my development environment by using ns_eval to update all the TCL interps everytime I do changes on it. First off, it looks like I have to escape all the special TCL characters on ns_eval. Is this the intended behaviour because I've seen many examples of people using ns_eval to do something like this: ns_eval {source /somewhere/out/there/file.tcl} but this has never worked for me (source seems to get confused with the [ and the ]. I did a test and ran: ns_eval {ns_log notice {test me}} which produced errors where there were too many ns_log arguments. I was able to get it to work by doing this: ns_eval {ns_log notice \{test me\}} This leads me to believe that I have to escape every character that I use for ns_eval. My second question is that some of my custom API calls don't seem to be recognized when running ns_eval. I don't really have much of an explanation for what this could be. If anyone has ideas and theories, I'm all ears. Thanks! >>>-- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
Re: [AOLSERVER] Question on ns_eval
Thank you for the responses. I'll conduct some tests. The code I use to reload right now is: eval namespace eval :: source $file so on swtching to ns_eval, I thought to maybe skip the namespace eval. With or without don't seem to make a difference, but I'll continue to look into this. On Friday, February 15, 2013 2:59:28 AM UTC+8, William J. Webb wrote: > > > > On Thursday, February 14, 2013 12:33:26 PM UTC-6, William J. Webb wrote: >> >> At the core, we use a slightly different version of: >> proc eval_source { filename } { >> if { [file exists $filename] } { >> set err [catch { ns_eval [list source $filename] } result] >> if { $err } { >> ns_log notice eval_source ERROR: $result >> } >> } else { >> error "file $filename does not exist." >> } >> } >> #}}} >> >> >> There are some wrappers around this to recurse through directories using >> patterns, ignore certain types of files, etc. >> >> Note that "ns_eval is asynchronous and the script isn't immediately >> evaluated in the other interpreters until their next atalloc event". E.g.: >> you run an ns_eval/source in one nscp, you won't see it reflected in a >> second concurrent nscp session. >> >> Will >> >> >> On Thursday, February 14, 2013 3:21:30 AM UTC-6, Sep Ng wrote: >>> >>> Hello, >>> >>> I've been looking into improve my development environment by using >>> ns_eval to update all the TCL interps everytime I do changes on it. First >>> off, it looks like I have to escape all the special TCL characters on >>> ns_eval. Is this the intended behaviour because I've seen many examples of >>> people using ns_eval to do something like this: >>> ns_eval {source /somewhere/out/there/file.tcl} >>> but this has never worked for me (source seems to get confused with the >>> [ and the ]. >>> >>> I did a test and ran: >>> ns_eval {ns_log notice {test me}} >>> which produced errors where there were too many ns_log arguments. I was >>> able to get it to work by doing this: >>> ns_eval {ns_log notice \{test me\}} >>> >>> This leads me to believe that I have to escape every character that I >>> use for ns_eval. >>> >>> My second question is that some of my custom API calls don't seem to be >>> recognized when running ns_eval. I don't really have much of an >>> explanation for what this could be. If anyone has ideas and theories, I'm >>> all ears. >>> >>> Thanks! >>> >>-- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
Re: [AOLSERVER] Question on ns_eval
On Thursday, February 14, 2013 12:33:26 PM UTC-6, William J. Webb wrote: > > At the core, we use a slightly different version of: > proc eval_source { filename } { > if { [file exists $filename] } { > set err [catch { ns_eval [list source $filename] } result] > if { $err } { > ns_log notice eval_source ERROR: $result > } > } else { > error "file $filename does not exist." > } > } > #}}} > > > There are some wrappers around this to recurse through directories using > patterns, ignore certain types of files, etc. > > Note that "ns_eval is asynchronous and the script isn't immediately > evaluated in the other interpreters until their next atalloc event". E.g.: > you run an ns_eval/source in one nscp, you won't see it reflected in a > second concurrent nscp session. > > Will > > > On Thursday, February 14, 2013 3:21:30 AM UTC-6, Sep Ng wrote: >> >> Hello, >> >> I've been looking into improve my development environment by using >> ns_eval to update all the TCL interps everytime I do changes on it. First >> off, it looks like I have to escape all the special TCL characters on >> ns_eval. Is this the intended behaviour because I've seen many examples of >> people using ns_eval to do something like this: >> ns_eval {source /somewhere/out/there/file.tcl} >> but this has never worked for me (source seems to get confused with the [ >> and the ]. >> >> I did a test and ran: >> ns_eval {ns_log notice {test me}} >> which produced errors where there were too many ns_log arguments. I was >> able to get it to work by doing this: >> ns_eval {ns_log notice \{test me\}} >> >> This leads me to believe that I have to escape every character that I use >> for ns_eval. >> >> My second question is that some of my custom API calls don't seem to be >> recognized when running ns_eval. I don't really have much of an >> explanation for what this could be. If anyone has ideas and theories, I'm >> all ears. >> >> Thanks! >> >-- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk
Re: [AOLSERVER] Question on ns_eval
At the core, we use a slightly different version of: #{{{ eval_source # proc eval_source { filename } { if { [file exists $filename] } { set err [catch { ns_eval [list source $filename] } result] } if { $err } { ns_log notice eval_source ERROR: $result } } else { error "file $filename does not exist." } } #}}} There are some wrappers around this to recurse through directories using patterns, ignore certain types of files, etc. Note that "ns_eval is asynchronous and the script isn't immediately evaluated in the other interpreters until their next atalloc event". E.g.: you run an ns_eval/source in one nscp, you won't see it reflected in a second concurrent nscp session. Will On Thursday, February 14, 2013 3:21:30 AM UTC-6, Sep Ng wrote: > > Hello, > > I've been looking into improve my development environment by using ns_eval > to update all the TCL interps everytime I do changes on it. First off, it > looks like I have to escape all the special TCL characters on ns_eval. Is > this the intended behaviour because I've seen many examples of people using > ns_eval to do something like this: > ns_eval {source /somewhere/out/there/file.tcl} > but this has never worked for me (source seems to get confused with the [ > and the ]. > > I did a test and ran: > ns_eval {ns_log notice {test me}} > which produced errors where there were too many ns_log arguments. I was > able to get it to work by doing this: > ns_eval {ns_log notice \{test me\}} > > This leads me to believe that I have to escape every character that I use > for ns_eval. > > My second question is that some of my custom API calls don't seem to be > recognized when running ns_eval. I don't really have much of an > explanation for what this could be. If anyone has ideas and theories, I'm > all ears. > > Thanks! > -- Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb___ aolserver-talk mailing list aolserver-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/aolserver-talk