Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Block commenting

by liz (Monsignor)
on Nov 04, 2003 at 12:22 UTC ( [id://304484]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Block commenting
in thread Block commenting

Not a very good idea, as the comment still is interpolated:
use strict; <<COMMENT; $foo = 'bar'; COMMENT
gives:
Global symbol "$foo" requires explicit package name at line 3.

Abigail-II's suggestion of Acme::Comment is pretty serious, if you really want to have multi-line comments the way you want them. Personally, I think Acme::Comment lives in the wrong namespace: it should probably live in the Filter::Comment namespace or so.

Liz

Replies are listed 'Best First'.
Re: Block commenting
by Abigail-II (Bishop) on Nov 04, 2003 at 12:37 UTC
    Personally, I think Acme::Comment lives in the wrong namespace: it should probably live in the Filter::Comment namespace or so.
    I disagree with that. I think that namespaces like Filter::* and Tie::* should be restricted to module that deal with filtering or tieing. It's just not right to make the implementation part of the name space. Just think about it, should all modules that use objects belong in the OO::* name space? And what are you going to do with a module that uses a filter, is hence named Filter::Whatever, and then modifies its implementation so that it uses a different technique?

    It's a bad, bad suggestion.

    Abigail

      Whatever. I think we agree that the Acme:: namespace is even more inappropriate.

      I personally don't care much where it winds up. Anything better than Acme::.

      Liz

        Anything better than Acme

        You should post that to London.pm and see how he reacts. =P

        --
        Allolex

Re^3: Block commenting
by flounder99 (Friar) on Nov 04, 2003 at 12:55 UTC
    use strict; use warnings; <<'COMMENT'; $foo = 'bar'; COMMENT
    Will avoid the interpolation. But you will still get
    Useless use of a constant in void context at temp.pl line 3.
    To avoid that you can do:
    use strict; use warnings; { no warnings; <<'COMMENT'; $foo = 'bar'; COMMENT }
    But that is a lot of work.

    --

    flounder

Re: Re: Re: Block commenting
by Roger (Parson) on Nov 04, 2003 at 19:09 UTC
    Thanks++ for pointing out that the comment is interpolated. However to fix this, I would simply add single quotes around the COMMENT to prevent the HEREDOC to be interpolated.

    use strict; <<'COMMENT' $foo = 'bar'; COMMENT ;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://304484]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.