[ Modules | The ECLiPSe Built-In Predicates | Reference Manual | Alphabetic Index ]

unlock(+Module, +Password)

Unlocks the access to the module Module, if the password given in Password is correct
Module
Atom.
Password
String.

Description

unlock(Module, Password) unlock a module previously locked with lock(Module, Password). The access to the module is now again possible.

An error is raised (and the module not unlocked) when trying to unlock a module with a wrong password or when trying to unlock a module locked with lock/1 (error 82).

Modes and Determinism

Exceptions

(4) instantiation fault
Module or Password is/are not instantiated.
(5) type error
Module is instantiated, but not to an atom or Password is instantiated but not to a string.
(80) not a module
Module is not a module.
(82) trying to access a locked module
Trying to access a locked module Module.

Examples

Success:
     [eclipse]: [user].
      :- module(m).
      :- export p/0.
      p :- writeln(hello).
      user        compiled 60 bytes in 0.00 seconds
     yes.
     [eclipse]: lock(m, "pass").
     yes.
     [eclipse]: module(m).
     trying to access a locked module in module(m)
     [eclipse]: import p/0 from m.
     yes.
     [eclipse]: p.
     hello
     yes.
     [eclipse]: call(p) @ m.
     trying to access a locked module in p
     [eclipse]: unlock(m, "pass").
     yes.
     [eclipse]: call(p) @ m.
     hello
     yes.

Error:
     unlock(M, "pass").                        (Error 4).
     unlock(m, Pass).                          (Error 4).
     unlock(1, "pass").                        (Error 5).
     unlock(not_a_module, "pass").             (Error 80).
     lock(m, "pass"), unlock(m, "wrong_pass"). (Error 82).
     lock(m), unlock(m, "pass").               (Error 82).



See Also

lock / 1, lock / 2, get_module_info / 3