Search code examples
perltie

Tie variable multiple times


Can I tie a variable multiple times? I'd try it myself, but I'm not sure of the syntax. I want to tie a hash to Cache::Memcached::Tie and IPC::Shareable.


Solution

  • I don't think it is possible to tie two classes to single item. Running tie second time just remove original link and replace with new one.

    It should be possible to write some kind of multi-dispatch, though. I mean writing a class that accept multiple other classes and call their respective methods like FETCH or STORE.