in reply to Re^3: Extend a module
in thread Extend a module

Which is why i write
sub Net::FTP::my_new_FTP_method { package Net::FTP; } # this is main, package is lexical

Replies are listed 'Best First'.
Re^5: Extend a module
by CountZero (Bishop) on Jul 07, 2009 at 16:25 UTC
    Indeed, another way of doing it. However, a package declaration cannot be "lexical". It can be enclosed in a block (as you did) and then it extends to the end of the block, but it cannot be "lexical" as you can have lexical ("my") variables.

    Personally, I like to have the packages switched in a more explicit manner without having to check beginning and ending of blocks, but that is my personal style.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James