in reply to (jeffa) Re: Generic Composite Interface
in thread Generic Composite Interface

I think that's what i am looking for. So the:

BEGIN { # scan the current directory eval{require $_} for <*.pm>; };

substitutes the "use" declarations?

I absolutely agree, this should'nt the recommended or normal style to add new functionality, but i context of my application it certainly helps.

Chris

Replies are listed 'Best First'.
(jeffa) 3Re: Generic Composite Interface
by jeffa (Bishop) on Mar 23, 2002 at 19:52 UTC

    jeffa

    From 'perldoc -f use':
    Imports some semantics into the current package
    from the named module, generally by aliasing
    certain subroutine or variable names into your
    package.  It is exactly equivalent to
    
       BEGIN { require Module; import Module LIST; }
    
    except that Module must be a bareword.
    
    Turns out that evaling the way i did is not very useful, better to stick with the traditional for loop syntax like so to take advantage of 'exceptions':
    BEGIN { for (<*.pm>) { eval {require $_}; warn $@ if $@; # but it's prolly going to die anyway! } };
    So you can more easily find which module(s) and what line(s) caused the error(s). Also, defining a path to the directory that contains the modules would be a good thing to do. Good luck! :)
    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)