cvrčak wrote:
>Can somebody explain me when use *.pm files and when uses *.pl?
Will this do?
http://perldoc.perl.org/perlmod.html
In short: there are two ways to specify files to load (require): the
special package syntax (Foo::Bar), and the plain (Unix) file path
format: "Foo/Bar.pm". The former is a special syntax that is recognized
as syntactic sugar for the latter, but only in source code. If you
specify the file as a string, or in a (scalar) variable, you *must* use
the file path format.
That's one way in which ".pm" special as a file extension. The second is
that with "use", Perl will treat Foo::Bar both as a file name (after
conversion), and as a package/class name, for which it will try to do a
"import" class method call. That's the main reason for which module
names and package names are commonly the same.
>must be classes in *.pm files?
No.
Classes are defined as packages, and package declarations can be in any
type of source files. See above as to why package and file name are
usually the same. But it's not uncommon to have extra (utility) packages
in the same source file.
--
Bart.