Sure, put it on CPAN. But also turn it into a patch against Perl.
| [reply] [Watch: Dir/Any] |
Thanks, tobyink++!So much of your stuff has either ended up in my code and/or taught me new things I never knew about Perl, I feel I owe you a *case* of beer. Seriously, if we ever meet at a YAPC or Hackathon, I will honor that!
While your module doesn't *quite* solve the problem I came here to research, it points me in the right direction. I've spent some time today groveling in the perl source and found a few more useful variables like that, for example PL_origenviron
I'm working on a means of bootstrapping perl applications using a new perl installation on systems stuck with an old perl, but without needing to run or install external CPAN modules as root. In trying to make this as simple as possible, I have code that, if run with too old a version of perl, attempts to find a new-enough one, and re-execs the original command using the found perl. (Additionally, it will update a perl-version-specific local::lib using cpanm if one of {Makefile,Build}.PL are present, and add it to @INC). Unfortunately, it's a nasty combination of bash and perl, and I'd *love* to dispense with the bash all together.
Now, I know this sort of thing can be "solved" using perlbrew, but unfortunately perlbrew has not worked out very well for the users & devs I am supporting. Also, they dislike having to keep a new installation of perl around for every project. (several are new to perl, and are giving me their time to help me deliver several projects for their groups. I feel I owe it to them to make using and hacking on on my code as comfortable as possible... so far, it's working - two have now expressed that they never knew Perl could be such a nice language to use!)
Once I feel like I have good general solution, I will release whatever I can :)
| [reply] [Watch: Dir/Any] |
FWIW, you should not use Inline inside a module, you end up with
./Devel-PL_origargv-0.003/_Inline/lib/auto/Devel/PL_origargv_a77c/PL_o
+rigargv_a77c.dll
which doesn't get installed, and and an empty ./Devel-PL_origargv-0.003/blib/lib/auto/Devel/PL_origargv/.exists
and then every time someone uses the module, in the current directory, an _Inline/lib/auto/Devel/PL_origargv_a77c/PL_origargv_a77c.dll is built, every single time, instead of once during installation | [reply] [Watch: Dir/Any] [d/l] [select] |
It's not built every single time. It's only rebuilt if it's missing or if there have been modifications to the .pm file since the last build. If you don't like it being built in the current working directory, then create a ~/.Inline directory.
I'd happily accept a patch to XSify the module, but I'm not going to write that myself. It seems more effort than would be deserved by this silly little module.
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
| [reply] [Watch: Dir/Any] |
package Devel::PL_origargv;
use strict;
use warnings;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.004';
require DynaLoader;
@Devel::PL_origargv::ISA = qw( Exporter DynaLoader);
bootstrap Devel::PL_origargv;
sub get {
return _my_argc() unless wantarray;
map _my_argv($_), 1 .. _my_argc();
}
1;
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
MODULE = Devel::PL_origargv PACKAGE = Devel::PL_origargv
PROTOTYPES: DISABLE
int
_my_argc ()
CODE:
RETVAL = PL_origargc;
OUTPUT:
RETVAL
char *
_my_argv (x)
int x
CODE:
RETVAL = PL_origargv[x - 1];
OUTPUT:
RETVAL
| [reply] [Watch: Dir/Any] [d/l] [select] |
I'd happily accept a patch to XSify the module, but I'm not going to write that myself. It seems more effort than would be deserved by this silly little module.
Um, when you build it on your machine, copy the .xs files it generates, the end
| [reply] [Watch: Dir/Any] |