http://www.perlmonks.org?node_id=532043


in reply to use x; equivalent

pack is a Perl keyword, so the parser doesn't know what to do with that construct. I suggest changing the name of your module.

Of course, if the documentation had shown the unbroken way to call class methods, you wouldn't have had this problem:

BEGIN { require pack; pack::->import(); }

Update: fixed the code to use the really unambiguous way.

Replies are listed 'Best First'.
Re^2: use x; equivalent
by unclesmiff (Initiate) on Feb 22, 2006 at 18:13 UTC
    Thank you chromatic et al. I changed the name to packe and it worked.

    I was also wondering how to get debug from the importer, I thought this might work, but no. it doesn't print anything.

    BEGIN { require packe; $Exporter::Verbose=1; import packe; }
Re^2: use x; equivalent
by ikegami (Patriarch) on Feb 22, 2006 at 18:04 UTC

    Even using your 'unbroken' way, I get

    Not enough arguments for pack at -e line 1, near "pack;" Not enough arguments for pack at -e line 1, near "pack->import" BEGIN not safe after errors--compilation aborted at -e line 1.

    perl v5.6.1

Re^2: use x; equivalent
by vladb (Vicar) on Feb 22, 2006 at 17:57 UTC
    Good catch, chromatic! Gees, however I missed that!..

    (feeling red faced now)
    _____________________
    "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce
    the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." - Robert Wilensky, University of California