http://qs321.pair.com?node_id=615136


in reply to Reopen a class, add methods ?

I recommend changing the package for the reasons I already gave.

However, instead of

package Tk::HList; sub updaterow { ... } package main;

I'd use

{ package Tk::HList; sub updaterow { ... } }

The package directive will only be effective until the end of the block, at which time the package will revert to what it was before the package directive was encountered.

Hardcoding main will cause code to fail once ported to Apache::Registry, or if the code is copied/moved into a module.

Replies are listed 'Best First'.
Re^2: Reopen a class, add methods ?
by Rudif (Hermit) on May 13, 2007 at 15:27 UTC
    ikegami,

    Thank you (and others) for clarifications and guidance. A  package directive in a block works fine for me.

    Rudif