I have written 2 packages :
First package :
# firstpackage.tcl
namespace eval mypackage::firstpackage {}
proc mypackage::firstpackage::myproc {} {
# ...
}
package provide mypackage::firstpackage 1.0
Second package :
# secondpackage.tcl
namespace eval mypackage::secondpackage {}
proc mypackage::secondpackage::myproc {} {
# ...
}
package provide mypackage::secondpackage 1.0
I'm calling these 2 packages at once, like this :
# mypackage.tcl
package require mypackage::firstpackage 1.0
package require mypackage::secondpackage 1.0
package provide mypackage 1.0
Now when I call mypackage 1.0
I don't want to call the full name of my procedure like this :
package require mypackage
# set myvar [mypackage::firstpackage::myproc] works...
set myvar [firstpackage::myproc]
I thought it was possible... But I have this error : invalid command name "firstpackage::myproc"
I tried to use namespace export myproc
in my 2 files (firstpackage.tcl & secondpackage.tcl) or namespace export *
in mypackage.tcl but without success...
Is there a way to call my procedure without full name ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…