CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Why we need to complie perl modules

 



hacksics
Novice

Jan 4, 2009, 7:55 PM

Post #1 of 5 (370 views)
Why we need to complie perl modules Can't Post

Can anyone please tell me, why do we need to compile Perl modules from CPAN to used in our Perl scripts.

Can we just use those Perl modules without compiling (Is it possible to copy those *.pm files to one of Perl's LIBS path and use directly)


FishMonger
Veteran / Moderator

Jan 4, 2009, 8:02 PM

Post #2 of 5 (368 views)
Re: [hacksics] Why we need to complie perl modules [In reply to] Can't Post

It all depends on the module in question. If it's pure Perl code, then in can simple be copied and used as is. However, if some of its source is xs code, then it needs to be compiled.


hacksics
Novice

Jan 4, 2009, 8:39 PM

Post #3 of 5 (366 views)
Re: [FishMonger] Why we need to complie perl modules [In reply to] Can't Post

Thanks for the quick reply. I'm new to this perl modules. Can you please tell me how to identify whether a module contains xs code or pure perl code?


FishMonger
Veteran / Moderator

Jan 5, 2009, 9:25 AM

Post #4 of 5 (358 views)
Re: [hacksics] Why we need to complie perl modules [In reply to] Can't Post

You need to look at its source code.

You'll also want to read this:
http://perldoc.perl.org/perlxs.html


shawnhcorey
Enthusiast


Jan 5, 2009, 12:27 PM

Post #5 of 5 (356 views)
Re: [hacksics] Why we need to complie perl modules [In reply to] Can't Post


In Reply To
Can anyone please tell me, why do we need to compile Perl modules from CPAN to used in our Perl scripts.

Can we just use those Perl modules without compiling (Is it possible to copy those *.pm files to one of Perl's LIBS path and use directly)


The modules in CPAN may have to be adapted to your system. By "compiling" them, the adaption can be made.

The first step is usually:

Code
perl Makefile.PL

Which creates a Makefile for make(1). You can change some configuration parameters, like where the module will be installed, with options when creating the Makefile. See the README* file that comes with the module.

By "compiling" rather than simply copying, a great deal of flexibility and control is added.

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives