Prev: catch not catching
Next: canvas scrolling (again)
From: Qatanah on 3 Mar 2010 10:14 Hi I need help in making a tree as member of a variable: heres a summary of my code oo::class c { method connect { my variable my_tree set html_source [ http::data $token ] struct::tree my_tree htmlparse::2tree $html_source tree } } I get this error message invalid command name "my_tree" "$tree set root type root" (procedure "htmlparse::2tree" line 17) invoked from within "htmlparse::2tree $html_source my_tree" any ideas?
From: Qatanah on 3 Mar 2010 10:22 On Mar 3, 3:14 pm, Qatanah <marlon.abas...(a)gmail.com> wrote: > Hi I need help in making a tree as member of a variable: heres a > summary of my code > > oo::class c { > method connect { > my variable my_tree > > set html_source [ http::data $token ] > struct::tree my_tree > htmlparse::2tree $html_source tree > } > > } > > I get this error message > > invalid command name "my_tree" > > "$tree set root type root" > (procedure "htmlparse::2tree" line 17) > invoked from within > "htmlparse::2tree $html_source my_tree" > > any ideas? i was able to fix this. I just replaced > htmlparse::2tree $html_source tree to > htmlparse::2tree $html_source "[self namespace]::tree"
From: Andreas Kupries on 3 Mar 2010 23:54 Qatanah <marlon.abastar(a)gmail.com> writes: > Hi I need help in making a tree as member of a variable: heres a > summary of my code > > oo::class c { > method connect { > my variable my_tree > > set html_source [ http::data $token ] > struct::tree my_tree > htmlparse::2tree $html_source tree > } > } > > I get this error message > > invalid command name "my_tree" We apparently an issue with scoping, the tree is not where you thought it is. One possible fix: set thetree [struct::tree my_tree] htmlparse::2tree $html_source $thetree The result of struct::tree is the fully qualified name of the object, sdaved into a variable, it can then be used regardless of location relative to your current scope. > "$tree set root type root" > (procedure "htmlparse::2tree" line 17) > invoked from within > "htmlparse::2tree $html_source my_tree" > > > any ideas? -- So long, Andreas Kupries <akupries(a)shaw.ca> <http://www.purl.org/NET/akupries/> Developer @ <http://www.activestate.com/> -------------------------------------------------------------------------------
From: Qatanah on 4 Mar 2010 20:22 On Mar 4, 12:54 pm, Andreas Kupries <akupr...(a)shaw.ca> wrote: > Qatanah <marlon.abas...(a)gmail.com> writes: > > Hi I need help in making a tree as member of a variable: heres a > > summary of my code > > > oo::class c { > > method connect { > > my variable my_tree > > > set html_source [ http::data $token ] > > struct::tree my_tree > > htmlparse::2tree $html_source tree > > } > > } > > > I get this error message > > > invalid command name "my_tree" > > We apparently an issue with scoping, the tree is not where you thought > it is. One possible fix: > > set thetree [struct::tree my_tree] > htmlparse::2tree $html_source $thetree > > The result of struct::tree is the fully qualified name of the object, > sdaved into a variable, it can then be used regardless of location > relative to your current scope. > > > "$tree set root type root" > > (procedure "htmlparse::2tree" line 17) > > invoked from within > > "htmlparse::2tree $html_source my_tree" > > > any ideas? > > -- > So long, > Andreas Kupries <akupr...(a)shaw.ca> > <http://www.purl.org/NET/akupries/> > Developer @ <http://www.activestate.com/> > ------------------------------------------------------------------------------- thanks!
|
Pages: 1 Prev: catch not catching Next: canvas scrolling (again) |