Skip to content
Tcl Source Code View Ticket
Login

View Ticket

package ifneeded does not function

Closed / Invalid218318ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:56:06
OriginalBugID: 3796 Bug
Version: 1.2
SubmitDate: '1999-12-07'
LastModified: '1999-12-07'
Severity: SER
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
FixedDate: '2000-10-25'
ClosedDate: '1999-12-07'


Name:
Chia-Wei Chow

ReproducibleScript:
i have 3 packages in /tmp/lib each as a pkgIndex.tcl file in it

cat /tmp/lib/a1.0/pkgIndex.tcl
package ifneeded A 1.0 [list
        puts "hello from A!"
        package provide A 1.0 ]

cat /tmp/lib/b1.0/pkgIndex.tcl
package ifneeded B 1.0 [list
        puts "hello from B!"
        package provide B 1.0 ]

cat /tmp/lib/c1.0/pkgIndex.tcl
package ifneeded C 1.0 [list
        puts "hello from C!"
        package provide C 1.0 ]

here's my main tcl script file:

lappend auto_path /tmp/lib
puts [package require A]


when i run "protclsh80 mine.tcl", here's what i got
hello from B!
hello from C!
hello from A!
1.0

ObservedBehavior:
i didn't expect to see
hello from B!
hello from C!

DesiredBehavior:
i would expect getting
hello from A!
1.0



When it runs through finding an unknown package, it will source
all the found pkgIndex.tcl files, so it doesn't have to do it
again later (unless auto_path changes).  Thus, all the files
will get evaluated, then it will look to see if 'A' is defined. 
-- 12/07/1999 hobbs
welch Closed ticket [218318ffff]. [History diff]2000-10-26 08:19:00
dgp Ticket [218318ffff]: 4 changes [History diff]2001-04-06 02:15:23
Log in (anonymous is fine) to add a comment.