Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Package declaration in code block

by McA (Priest)
on Apr 23, 2014 at 16:29 UTC ( [id://1083385]=note: print w/replies, xml ) Need Help??


in reply to Re: Package declaration in code block
in thread Package declaration in code block

Hi Rolf,

thank you for the fast reply.

Is there an advantage in a classic package, one package per file?

Regards
McA

  • Comment on Re^2: Package declaration in code block

Replies are listed 'Best First'.
Re^3: Package declaration in code block
by tobyink (Canon) on Apr 23, 2014 at 16:49 UTC

    If you're posting example code, it's useful for everything to be in one self-contained example file, so that people can just copy and paste it into their editor and run it, rather than them having to create a directory called Foo and make a file in there called Bar.pm and paste some code in there, and then create another folder called Boo and make a file in there called Far.pm and paste more code in there, and then...

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name

      That's a very good argument. I haven't thought about that.

      But this is the "More-than-one-package-per-file"-case. I was wondering if there is a reason to do so in a package per file.

      Regards
      McA

        I was wondering if there is a reason to do so in a package per file.

        Probably obedience to some style guide :)

        Or proper laziness -- if copy/paste works, why edit to unindent...

Re^3: Package declaration in code block
by dmitri (Priest) on Apr 24, 2014 at 02:46 UTC
    I use this form in my .t files when I need a quick class mock-up: it stands out more.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1083385]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-04-18 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found