Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl and packge

Reply
Thread Tools

Perl and packge

 
 
cvrčak
Guest
Posts: n/a
 
      10-07-2009
Hy,

Can somebody explain me when use *.pm files and when uses *.pl?

must be classes in *.pm files?



 
Reply With Quote
 
 
 
 
Bart Lateur
Guest
Posts: n/a
 
      10-08-2009
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.
 
Reply With Quote
 
 
 
 
cvrčak
Guest
Posts: n/a
 
      10-09-2009
thanks


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveState Perl and MinGW [was: Perl 5.14 Windows Strawberry Perl 64 bits] Dilbert Perl Misc 0 11-10-2011 02:20 PM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 02-27-2011 11:00 PM
FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org? PerlFAQ Server Perl Misc 0 02-03-2011 11:00 AM
FAQ 1.4 What are Perl 4, Perl 5, or Perl 6? PerlFAQ Server Perl Misc 0 01-23-2011 05:00 AM
Perl Help - Windows Perl script accessing a Unix perl Script dpackwood Perl 3 09-30-2003 02:56 AM



Advertisments