Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

The quest for pure perl

by rinceWind (Monsignor)
on Feb 19, 2003 at 14:21 UTC ( [id://236635]=perlquestion: print w/replies, xml ) Need Help??

rinceWind has asked for the wisdom of the Perl Monks concerning the following question:

In my present work situation, I find myself in the position that I can only use CPAN modules which are pure perl. I am not in a position to be able to build any perl extensions.

I can see that this might occur as a result of several things:

  • Lack of a C compiler
  • Lack of a C compiler that is capable of building perl (several Unixes ship with a non-ANSI ucb flavour of cc, MSVC on Win32 requires some setting up to make it usable)
  • Perl was built on a different machine, with a config which is not available on the target machine

So, why not build a new perl from scratch – and use this as a basis? Well, this raises the issues of deploying a new build of perl – change management or the ISP may not agree (the change management issue is what is stopping me).

What I am really after is a way of filtering the CPAN search, so that it only selects modules which are pure perl, requiring no extensions to be built for installation. In my case, I am building modules by hand.

I am also interested in a way of determining up-front, whether building of extensions is required, so as to save me the hassle and waste of time of attempted and failed builds, when a vital component is XS.

Replies are listed 'Best First'.
Re: The quest for pure perl
by diotalevi (Canon) on Feb 19, 2003 at 14:46 UTC

    You can check the module's MANIFEST file for .xs, .c and .h files. You won't be able to catch Inline::C modules this way though. How about turning this into a 'fetch from CPAN and check the MANIFEST' script?


    Seeking Green geeks in Minnesota

Re: The quest for pure perl
by BrowserUk (Patriarch) on Feb 19, 2003 at 15:05 UTC

    Having had similar problems, I sympathise.

    Perhaps, we could set up a single thread in say categeriszed answers under a question of "What pure perl modules are available" and everytime a conciencious Monk pull a module, they could post a one-line answer with a link to the module they found to be perl only, having checked that it hadn't already been listed 27,000 times:)

    Seems like a simple machanism that would be of great reference value and need no infra-structure changes to set up?

    As far as the Win32 stuff is concerned, it is possible to build XS modules to be compatible with AS. PodMaster seems to have the wherewithall for doing it, but it does seem like an imposition to have to ask someone else to do it for you. I'm not sure what loops PodMaster has to jump through to make this happen, but it seems a shame that AS themselves can't set up some sort of post-the-url-to-a-CPAN-style-tarball and-our-auto-build-robot-will-attempt-to-build-it-for-you page at their website. It could report back the results/errors from the attempt and if successful, add it to the appropriate PPM directory on their download site. Hmmm. Anyone got an AS support contract fancy forwarding that as a suggestion? I doubt it would make it past the small-round filing cabinet if it came from anyone without one.


    Examine what is said, not who speaks.

    The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

      but it seems a shame that AS themselves can't set up some sort of post-the-url-to-a-CPAN-style-tarball and-our-auto-build-robot-will-attempt-to-build-it-for-you page at their website.

      Unfortunately, that would require allowing arbitrary code (Makefile.PL) to be executed on that server, by anyone. I think that would be too large of a security risk for them to want to maintain that machine.

      bbfu
      Black flowers blossum
      Fearless on my breath

        Your probably right.

        I keep thinking to myself that given the right set of limited permissions for a specifically set up userid with no read/write/execute access outside a download/build directory created specifically for each given download and destroyed immediately after the PPM is built, it ought not be a security risk. That said, the only time I set up anything similar (under NT, I wouldn't have a clue under *nix) the aim was prevention of accidents rather protection from deliberate attack.

        Oh well. Another transient thought bites the dust:)


        Examine what is said, not who speaks.

        The 7th Rule of perl club is -- pearl clubs are easily damaged. Use a diamond club instead.

Re: The quest for pure perl
by Abigail-II (Bishop) on Feb 19, 2003 at 23:54 UTC
    Assume you want to know whether Regexp::Common is pure perl. Fire up the CPAN shell, and issue the following command:
    cpan> m Regexp::Common CPAN: Storable loaded ok Going to read /opt/perl/.cpan/Metadata Database was generated on Wed, 29 Jan 2003 22:19:32 GMT Module id = Regexp::Common DESCRIPTION Provide commonly requested regular expr. CPAN_USERID ABIGAIL (Abigail <abigail@foad.org>) CPAN_VERSION 2.104 CPAN_FILE A/AB/ABIGAIL/Regexp-Common-2.104.tar.gz DSLI_STATUS RdpO (released,developer,perl,object-oriented) MANPAGE Regexp::Common - Provide commonly requested regular e +xpressions INST_FILE /opt/perl/lib/site_perl/5.8.0/Regexp/Common.pm INST_VERSION 1.20 cpan>

    It's the DSLI_STATUS line that we are interested in. The third letter is p, meaning it's a pure Perl module.

    Abigail

Re: The quest for pure perl
by PodMaster (Abbot) on Feb 19, 2003 at 14:53 UTC
    What about PPM? (you ain't building it)

    MSVC on Win32 requires some setting up to make it usable -- not true.

    Mirror CPAN, and build the a database containing such metainfo (you'll have to figure out how to determine what's what on your own, but it should be easy, scan for *.c, *.xs, *.h files, check the registered module list, since all registered modules have this info, but beware of dependencies ).


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      In my case, the required platform is Solaris. OK, I know that ActiveState provide builds for this platform, but the underlying perl build on my target machine is not one that AS supplied, but one that came with Solaris, hence PPM is not an option. The siteperl directories exist, but are empty.

      I only mentioned Win32 because of some difficulties I have been having at home.

      (...beware of dependencies)
      I couldn't agree more. Just because module A is pure perl, if it calls module B which needs XS, this is no good. Ideally, I am looking for something that can build a prerequisite requirements tree, flagging any modules that require an XS build.
        Head over to http://www.sunfreeware.com/, grab a binary of GCC, install it in your home directory, edit your PATH, INCLUDE, and LD_LIBRARY_PATH shell variables and get cracking.

        There's also a tutorial around somewhere that gives you instructions on how to install Perl modules into your home directory.

        Finally, don't forget that most Sun machines are binary compatible, so you can compile modules on your dinky Ultra workstation and upload them to your enterprise servers, where they will work just fine.

        ____________________
        Jeremy
        I didn't believe in evil until I dated it.

        OK, I know that ActiveState provide builds for this platform, but the underlying perl build on my target machine is not one that AS supplied, but one that came with Solaris, hence PPM is not an option
        How so? Sure, AS might not make binaires for you, so all that means is that you have to make binaries for you. You know how your perl was built, so duplicate the build environment, and build the extensions, and make the PPM packages. Many-a-monk do this.

        As for dependencies, the question has come up a few times here on perlmonks, so do a search. The following modules should be of interest: Module::Dependency, Module::ScanDeps, Module::CoreList, Module::Info, ExtUtils::Installed, ExtUtils::Install


        MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
        I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
        ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: The quest for pure perl
by dragonchild (Archbishop) on Feb 19, 2003 at 14:56 UTC
    Have you asked the maintainers of CPAN if there's a way to do this? Maybe there isn't right now, but it might be a common enough request that your request will put them over the top and include that as an option. (Hey, you never know!)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Re: The quest for pure perl
by jasonk (Parson) on Feb 19, 2003 at 14:25 UTC

    I doubt you will be able to filter the CPAN results without a lot of work on the server side to have it determine which modules contain XS extensions. There isn't anything I'm aware of in the module information that tells you that, the only way to determine it is to download the module, unpack it, and see if there are any .xs files in the directory.

Re: The quest for pure perl
by dash2 (Hermit) on Feb 19, 2003 at 22:19 UTC
    I've been in a similar position myself, a lot.

    In theory, CPANPLUS should help: you could do a regex against

    $module->dslip

    However, in practice it doesn't WFM - you tend to get a lot of blanks. So the only way I have found is doing it manually, from this page.

    Look for the 3rd letter of the dslip code: for pure perl it should be "p". A full explanation of the codes is on the same page, here.

    dave hj~

Re: The quest for pure perl
by jonadab (Parson) on Feb 20, 2003 at 16:26 UTC

    The solution that would solve this problem once and for all would be to clone gcc in pure perl.


    -- jonadab
Re: The quest for pure perl
by gmpassos (Priest) on Feb 20, 2003 at 07:52 UTC
    Well, the compile problem exist on Win32, and other OS that doesn't come with C/C++ compilers.

    You say that for Win32 we need MSVC. Well, it compiles fine with MSVC++ 6, but it's not free! Take a look on MingW (http://mingw.sourceforge.net). Now it's very stable, and don't need much sets to compile Perl (just read the compile notes first!).

    Pure Perl modules are good things. But XS modules exist not only to get speed. Some times the code only can be in C/C++, specially GUI modules.

    I think that CPAN can introduce this option to filer XS modules too. And is not a hard thing to do, but they need to reindex all the modules, to filter MANIFEST, and update the PAUSE script to index new modules.

    Graciliano M. P.
    "The creativity is the expression of the liberty".

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://236635]
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found