Re: What defines "Pure Perl"?
by Corion (Patriarch) on Sep 08, 2008 at 13:48 UTC
|
"Pure Perl" refers to not using the C-extensions ("XS") and thus, not requiring a working C compiler setup. This is often preferred because in many environments, you don't have the luxury of having a C compiler that works with the version of Perl supplied by your vendor. Having a pure Perl module also makes it easy to include the code in your program by copying the source code of the module into your program directly.
| [reply] |
|
An example of such a platform is Solaris, since Sun wants big bucks for the native compiler. While there are hacks for using gcc to build XS modules, they are just that: hacks. Pure perl is vastly preferred.
| [reply] |
|
Actually, for all the perl work I've done on Solaris, I've used the gcc-built perl and the gcc suite from sunfreeware. Much easier to get real work done with that.
| [reply] |
|
|
gcc works well (and is even shipped) with Solaris 9 and later. Before that gcc worked well for xs, but you needed to get it from sunfreeware or some other packager.
-Waswas
| [reply] |
|
| [reply] |
|
| [reply] |
|
| [reply] |
Re: What defines "Pure Perl"?
by betterworld (Curate) on Sep 08, 2008 at 13:52 UTC
|
The point is that it's possible to write Perl modules in C, which means that you can use the module like any other Perl module via "use", but it's actually implemented in C, and most often through the interface of XS.
The motivations for this are that you can do nasty low-level system things in C; and that some things are faster. For instance, many modules like List::Util have a Pure Perl implementation as well as an XS implementation. If the latter has been compiled, List::Util is supposed to be faster.
The downside is that you need a working C compiler to install these modules; and that's why some modules are advertised as "Pure Perl", i.e. easy to install.
| [reply] |
|
Thanks for the quick response! I understand now that a Pure Perl module is one that doesn't require a C compiler resident on the system in order to be able to install it, and a Pure Perl solution is one that does not include any references to other modules that are not themselves Pure Perl.
-DaveH (dh1760)
| [reply] |
Re: What defines "Pure Perl"?
by Anonymous Monk on Sep 08, 2008 at 13:56 UTC
|
http://search.cpan.org/dlsip
- L - Language Used
-
p |
- |
Perl-only, no compiler needed, should be platform independent |
c |
- |
C and perl, a C compiler will be needed |
h |
- |
Hybrid, written in perl with optional C code, no compiler needed |
+ |
- |
C++ and perl, a C++ compiler will be needed |
o |
- |
perl and another language other than C or C++ |
| [reply] |
|
DLSIP ! How terribly '90s!
The usefulness of the DLSIP categorisation is predicated on packages appearing in The Module List. I think the current statistics are something like less than one in three distributions. The more recent the first release of the dist., the more likely the author has never even heard about it, nor knows what to do about it. META.yml is shaping up as the way to store metadata about a distribution.
• another intruder with the mooring in the heart of the Perl
| [reply] |
|
It's not that the distributions appear in the Module List, which is unmaintained and dead, but that people have registered their namespaces in PAUSE so they can more PAUSE maintenance features and can set some meta-data in PAUSE. Most of the meta-data should probably be in the distribution itself, but most of them don't have that.
THE DLSIP categorization is still useful though, because it doesn't matter how many other modules use it for it to matter for one distribution. The categorization itself is not useful because of its source, and the same categorization would be useful in META.yml. Now that META.yml 1.4 is the current version, maybe we could add more categorization stuff to the spec for the next version. :)
| [reply] |
Re: What defines "Pure Perl"?
by Tanktalus (Canon) on Sep 08, 2008 at 17:48 UTC
|
I've also noticed that some people consider "pure perl" to be the same as "core perl" - that is, just the modules that come with perl itself. This definition has annoyed me, but I thought it worth pointing out. This definition, which is closer to your guess, still allows for "use" directives - as long as what you're using comes with perl itself, such as File::Copy or File::Spec or even, on Windows, Win32.
| [reply] |