in reply to Re: Regarding Perl Class Object
in thread Regarding Perl Class Object

Sorry, but that reply is a little misleading.

editi's class isn't anonymous, it's established in the default package main. While that is unusual, there's nothing wrong with it in principle. I do share the concern that it looks like the Author is not familiar with the standard way of establishing classes in dedicated packages.

But to do that, it is by no means necessary to put the class code in an extra file. You can very well define a named class inside the main program. For tests and experiments you save a bit of potential hassle that way (in exchange for a smaller bit of different hassle).

Thirdly, you are right that #!/path/to/perl -w isn't effective in a module file. But that isn't the modern way of switching on warnings anyway. use warnings works in main programs as well as in module files (and is needed in both, because its scope is lexical).

Anno

[update: corrected attribution]

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.