in reply to HWXperl - The place for GUI apps in Perl
Why did you decide to limit this to perl5.8?
Why'd you decide you had to mess with toke.c ? ( sounds dangerous, especially just for dot syntaxt... )
Does it break perl as we have come to know it? (i cannot imagine how it could not ).
Have you added any tests to the distribution?
Do you still use Mattia's wxPerl stuff, or do you define your own bindings? (how dependent is HWX really on your custom perl binary , and should it be?)
Have you had any thoughts about abstracting PerlBin (real cool) away from HWXPerl, so it can work with many perl versions?
Does it work on different platforms other than win32?
I modified hello.pl to use some modules, and I created the binary without issues. Adding a 'lib' with those modules to where my hello.exe was worked like a charm. I gotta say I'm real interested in this PerlBin thing.
In fact I was so interested in this idea (an open source alternative to perl2exe or PerlApp), that one night after some cb banter The Perl Compiler (turning perl scripts into binary executables) and created http://perlcompiler.sf.net. The project kind of died, since the one person who knew enough c/c++ and perl internals to get us started got stuck behind a NDA (non-disclosure agreement), but it'd be hella cool to resurrect it.
I'm doing the CVS dance as we speak.
How difficult would it be to make PerlBin work on earlier versions of perl (reading the description, I imagine it wouldn't be too much work)?
The demo did look impressive, and PerlBin especially, but I can't get over modifying toke.c for the dot syntaxt ... ;)
nice job ++
update: I know it's alpha stage, but documentation could use improvement, at least in aiding developers (like project direction and such), and we could probably do better than "*** empty log message ***" for the cvs commits.
update: Here goess a diff, if anyone qualified can comment:
--- toke.c 2002-09-04 10:16:22.000000000 -0700 +++ toke.c.org 2002-09-04 10:16:22.000000000 -0700 @@ -4,17 +4,7 @@ * * You may distribute under the terms of either the GNU General Pu +blic * License or the Artistic License, as specified in the README fil +e. - * - * Modified by: Graciliano M. P. (gm@virtuasites.com.br) - * Change date: 28/08/2002 - * Changes: Added dot (.) class call: foo.bar() or foo.bar - * When you call 'foo.bar()' the interpreter transla +te - * to 'main::foo::bar()'. Can't use &foo.bar, is the + same - * as: &foo . "bar" * - * Lexer: When the lexer find 'foo.bar' in the source it tr +anslate to - * '_CORE_::foo_0__0_bar' and the package Class/DotR +ef.pm do - * the rest using AUTOLOAD. */ /* @@ -3875,16 +3865,12 @@ just_a_word: { SV *sv; int pkgname = 0; - int pkgdot = 0; - int pkgI , pkgJ , strSize ; - char *str_tmp ; char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL +_bufptr[-1]); /* Get the rest if it looks like a package qualifier * +/ - if (*s == '\'' || *s == '.' || (*s == ':' && s[1] == ' +:')) { + if (*s == '\'' || (*s == ':' && s[1] == ':')) { STRLEN morelen; - if (*s == '.') { pkgdot = 1;} s = scan_word(s, PL_tokenbuf + len, sizeof PL_toke +nbuf - len, TRUE, &morelen); if (!morelen) @@ -3921,30 +3907,6 @@ gvp = 0; } else { - if ( pkgdot ) { - str_tmp = malloc(sizeof(char) * (strlen(PL_tokenbuf)*3) ++6 ) ; - pkgJ = 0 ; - for (pkgI = 0; pkgI < len ; pkgI++) { - if ( PL_tokenbuf[pkgI] == ':' ) { - str_tmp[pkgJ] = '_' ; pkgJ++ ; - str_tmp[pkgJ] = '0' ; pkgJ++ ; - str_tmp[pkgJ] = '_' ; pkgJ++ ; - } - else { str_tmp[pkgJ] = PL_tokenbuf[pkgI] ; pkgJ++ ;} - } - - if ( *s != '(' ) { - str_tmp[pkgJ] = '_' ; pkgJ++ ; - str_tmp[pkgJ] = '0' ; pkgJ++ ; - str_tmp[pkgJ] = '_' ; pkgJ++ ; - str_tmp[pkgJ] = '_' ; pkgJ++ ; - str_tmp[pkgJ] = '0' ; pkgJ++ ; - str_tmp[pkgJ] = '_' ; pkgJ++ ; - } - - str_tmp[pkgJ] = '\0' ; - sprintf(PL_tokenbuf,"_CORE_::%s",str_tmp); - } len = 0; if (!gv) gv = gv_fetchpv(PL_tokenbuf, FALSE, SVt_PVCV); @@ -4008,15 +3970,7 @@ } PL_expect = XOPERATOR; - s = skipspace(s) ; - - if ( pkgdot && *s != '(') { - s[-2] = '(' ; - s[-1] = ')' ; - s-=2 ; - } - - pkgdot = 0 ; + s = skipspace(s); /* Is this a word before a => operator? */ if (*s == '=' && s[1] == '>' && !pkgname) { @@ -6133,7 +6087,7 @@ Perl_croak(aTHX_ ident_too_long); if (isALNUM(*s)) /* UTF handled below */ *d++ = *s++; - else if ( (*s == '\'' || *s == '.') && allow_package && isIDFI +RST_lazy_if(s+1,UTF)) { + else if (*s == '\'' && allow_package && isIDFIRST_lazy_if(s+1, +UTF)) { *d++ = ':'; *d++ = ':'; s++;
UPDATE: Ooooh, the binary thingamajigger doesn't look too complicated, Yay! (although only windoze seems to have runperl.c, which is the bulk of it ~ well on the C side ;)). Ooooh, gives me goosebumps -- excited;D!
--- miniperlmain.c 2002-09-22 05:31:56.000000000 -0700 +++ miniperlmain.c.org 2002-09-22 05:31:56.000000000 -0700 @@ -27,8 +25,6 @@ #define PERL_IN_MINIPERLMAIN_C #include "perl.h" -#include <string.h> - static void xs_init (pTHX); static PerlInterpreter *my_perl; @@ -42,52 +38,6 @@ main(int argc, char **argv, char **env) { int exitstatus; - char HWXmain[300] ; - char HWXopt[] = "-e"; - char HWXsize[] = "##[HWXZ]##"; - char HWXsize2[] = "##[HWXS]##"; - int HWXrun=1 ; - char *arg0=NULL ; - char *arg1=NULL ; - int n, i, j ; - char HWXrunA[] = "my%HWX_BIN;eval{my%HWX=(z=>'" ; - char HWXrunB[] = "',s=>'" ; - char HWXrunC[] = "',x=>$^X);if((!-s$HWX{x})||-d$HWX{x}){if($^O=~ +/(msw|win|dos)/i){$HWX{x}.='.exe'}}open(HWX,$HWX{x });binmode(HWX);seek(HWX,$HWX{z},0);read(HWX,$_,$HWX{s});close(HWX);%H +WX_BIN=%HWX};eval($_);if($@){print STDERR$@}" ; - - arg1 = malloc(sizeof(char) * strlen(HWXsize) + 1) ; - strcpy (arg1, HWXsize); - if ( arg1[0] == '#' ) { HWXrun = 0 ;} - - if (argc > 1 && HWXrun == 1) { - arg1 = malloc(sizeof(char) * strlen(argv[1]) + 1) ; - strcpy (arg1, argv[1]); - if ( arg1[0] == '-' && arg1[1] != '-' ) { HWXrun = 0 ;} - } - - if ( HWXrun == 1 ) { - sprintf(HWXmain,"%s%s%s%s%s\0",HWXrunA,HWXsize,HWXrunB,HWXsize2 +,HWXrunC); - - arg0 = malloc(sizeof(char) * strlen(argv[0]) + 1) ; - strcpy (arg0, argv[0]); - - n = argc ; - argc = argc + 2 ; - i = n - 1 ; - j = 1 ; - - while (i > 0) { - j = i + 2 ; - argv[j] = argv[i] ; - i-- ; - } - - argv[0] = arg0 ; - argv[1] = HWXopt ; - argv[2] = HWXmain ; - - //fprintf(stdout,">> %s\n",HWXmain); - } - #ifdef PERL_GLOBAL_STRUCT #define PERLVAR(var,type) /**/ --- runperl.c 2002-09-22 05:32:01.000000000 -0700 +++ runperl.c.orig 2002-09-22 05:32:01.000000000 -0700 #include "EXTERN.h" #include "perl.h" -#include <string.h> - #ifdef __GNUC__ /* Mingw32 defaults to globing command line @@ -27,52 +15,6 @@ int main(int argc, char **argv, char **env) { - char HWXmain[300] ; - char HWXopt[] = "-e"; - char HWXsize[] = "##[HWXZ]##"; - char HWXsize2[] = "##[HWXS]##"; - int HWXrun=1 ; - char *arg0=NULL ; - char *arg1=NULL ; - int n, i, j ; - char HWXrunA[] = "my%HWX_BIN;eval{my%HWX=(z=>'" ; - char HWXrunB[] = "',s=>'" ; - char HWXrunC[] = "',x=>$^X);if((!-s$HWX{x})||-d$HWX{x}){if($^O=~ +/(msw|win|dos)/i){$HWX{x}.='.exe'}}open(HWX,$HWX{x });binmode(HWX);seek(HWX,$HWX{z},0);read(HWX,$_,$HWX{s});close(HWX);%H +WX_BIN=%HWX};eval($_);if($@){print STDERR$@}" ; - - arg1 = malloc(sizeof(char) * strlen(HWXsize) + 1) ; - strcpy (arg1, HWXsize); - if ( arg1[0] == '#' ) { HWXrun = 0 ;} - - if (argc > 1 && HWXrun == 1) { - arg1 = malloc(sizeof(char) * strlen(argv[1]) + 1) ; - strcpy (arg1, argv[1]); - if ( arg1[0] == '-' && arg1[1] != '-' ) { HWXrun = 0 ;} - } - - if ( HWXrun == 1 ) { - sprintf(HWXmain,"%s%s%s%s%s\0",HWXrunA,HWXsize,HWXrunB,HWXsize2 +,HWXrunC); - - arg0 = malloc(sizeof(char) * strlen(argv[0]) + 1) ; - strcpy (arg0, argv[0]); - - n = argc ; - argc = argc + 2 ; - i = n - 1 ; - j = 1 ; - - while (i > 0) { - j = i + 2 ; - argv[j] = argv[i] ; - i-- ; - } - - argv[0] = arg0 ; - argv[1] = HWXopt ; - argv[2] = HWXmain ; - - //fprintf(stdout,">> %s\n",HWXmain); - } - return RunPerl(argc, argv, env); }
____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (more questions) Re: HWXperl - The place for GUI apps in Perl
by gmpassos (Priest) on Sep 22, 2002 at 13:45 UTC |