<?xml version="1.0" encoding="windows-1252"?>
<node id="199880" title="(more questions) Re: HWXperl - The place for GUI apps in Perl" created="2002-09-22 08:11:44" updated="2005-08-09 10:17:33">
<type id="11">
note</type>
<author id="107642">
PodMaster</author>
<data>
<field name="doctext">
Where can I find discussions on the design of this thing?
&lt;p&gt;
Why did you decide to limit this to perl5.8?
&lt;p&gt;
Why'd you decide you had to mess with toke.c ?
( sounds dangerous, especially just for dot syntaxt... )
&lt;p&gt;
Does it break perl as we have come to know it? (i cannot imagine how it could not ).
&lt;p&gt;
Have you added any tests to the distribution?
&lt;p&gt;
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?)
&lt;p&gt;
Have you had any thoughts about abstracting PerlBin (real cool) away from HWXPerl, so it can work with many perl versions?
&lt;p&gt;
Does it work on different platforms other than win32?
&lt;p&gt;
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.
&lt;p&gt;
In fact I was so interested in this idea (an open source alternative to perl2exe or PerlApp), that one night after some cb banter [id://95246] 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.
&lt;p&gt;
I'm doing the CVS dance as we speak.
&lt;p&gt;
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)?
&lt;p&gt;
The demo did look impressive, and PerlBin especially, but I can't get over modifying toke.c for the dot syntaxt ... ;)
&lt;p&gt;
nice job ++
&lt;p&gt;
&lt;b&gt;update:&lt;/b&gt; 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.
&lt;P&gt;
&lt;B&gt;update:&lt;/b&gt; Here goess a diff, if anyone qualified can comment:
&lt;READMORE&gt;
&lt;CODE&gt;
--- 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 Public
  *    License or the Artistic License, as specified in the README file.
- *
- *    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 translate
- *                  to 'main::foo::bar()'. Can't use &amp;foo.bar, is the same
- *                  as: &amp;foo . "bar"
  *
- *    Lexer:        When the lexer find 'foo.bar' in the source it translate to
- *                  '_CORE_::foo_0__0_bar' and the package Class/DotRef.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 == ':' &amp;&amp; s[1] == ':')) {
+               if (*s == '\'' || (*s == ':' &amp;&amp; s[1] == ':')) {
                    STRLEN morelen;
-            if (*s == '.') { pkgdot = 1;}
                    s = scan_word(s, PL_tokenbuf + len, sizeof PL_tokenbuf - len,
                                  TRUE, &amp;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 &lt; 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 &amp;&amp; *s != '(') {
-          s[-2] = '(' ;
-          s[-1] = ')' ;
-          s-=2 ;
-        }
-
-        pkgdot = 0 ;
+               s = skipspace(s);

                /* Is this a word before a =&gt; operator? */
                if (*s == '=' &amp;&amp; s[1] == '&gt;' &amp;&amp; !pkgname) {
@@ -6133,7 +6087,7 @@
            Perl_croak(aTHX_ ident_too_long);
        if (isALNUM(*s))        /* UTF handled below */
            *d++ = *s++;
-       else if ( (*s == '\'' || *s == '.') &amp;&amp; allow_package &amp;&amp; isIDFIRST_lazy_if(s+1,UTF)) {
+       else if (*s == '\'' &amp;&amp; allow_package &amp;&amp; isIDFIRST_lazy_if(s+1,UTF)) {
            *d++ = ':';
            *d++ = ':';
            s++;
&lt;/CODE&gt;
&lt;/READMORE&gt;
&lt;B&gt;update:&lt;/b&gt; I d/led the source, and apparently there aren't any tests (not even the ones that come with perl).  Not good (even though I did compile it successfully).
&lt;p&gt;
&lt;b&gt;UPDATE:&lt;/B&gt;
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 [http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/hwx/source/tools/perlbin/perlbin.pl?rev=1.1&amp;content-type=text/vnd.viewcvs-markup|C side ;)]).  Ooooh, gives me goosebumps -- &lt;B&gt;excited;D&lt;/B&gt;!&lt;READMORE&gt;
&lt;CODE&gt;
--- 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 &lt;string.h&gt;
-
 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=&gt;'" ;
-    char  HWXrunB[] = "',s=&gt;'" ;
-    char  HWXrunC[] = "',x=&gt;$^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);%HWX_BIN=%HWX};eval($_);if($@){print STDERR$@}" ;
-
-    arg1 = malloc(sizeof(char) * strlen(HWXsize) + 1) ;
-    strcpy (arg1, HWXsize);
-    if ( arg1[0] == '#' ) { HWXrun = 0 ;}
-
-    if (argc &gt; 1 &amp;&amp; HWXrun == 1) {
-       arg1 = malloc(sizeof(char) * strlen(argv[1]) + 1) ;
-       strcpy (arg1, argv[1]);
-       if ( arg1[0] == '-' &amp;&amp; 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 &gt; 0) {
-        j = i + 2 ;
-        argv[j] = argv[i] ;
-        i-- ;
-      }
-
-      argv[0] = arg0 ;
-      argv[1] = HWXopt ;
-      argv[2] = HWXmain ;
-
-      //fprintf(stdout,"&gt;&gt; %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 &lt;string.h&gt;
-
 #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=&gt;'" ;
-    char  HWXrunB[] = "',s=&gt;'" ;
-    char  HWXrunC[] = "',x=&gt;$^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);%HWX_BIN=%HWX};eval($_);if($@){print STDERR$@}" ;
-
-    arg1 = malloc(sizeof(char) * strlen(HWXsize) + 1) ;
-    strcpy (arg1, HWXsize);
-    if ( arg1[0] == '#' ) { HWXrun = 0 ;}
-
-    if (argc &gt; 1 &amp;&amp; HWXrun == 1) {
-       arg1 = malloc(sizeof(char) * strlen(argv[1]) + 1) ;
-       strcpy (arg1, argv[1]);
-       if ( arg1[0] == '-' &amp;&amp; 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 &gt; 0) {
-        j = i + 2 ;
-        argv[j] = argv[i] ;
-        i-- ;
-      }
-
-      argv[0] = arg0 ;
-      argv[1] = HWXopt ;
-      argv[2] = HWXmain ;
-
-      //fprintf(stdout,"&gt;&gt; %s\n",HWXmain);
-    }
-
     return RunPerl(argc, argv, env);
 }

&lt;/CODE&gt;&lt;/READMORE&gt;
&lt;p&gt;
&lt;font size=1&gt;&lt;TT&gt;____________________________________________________&lt;/TT&gt;&lt;BR&gt;** The Third rule of perl club is a statement of fact: pod &lt;I&gt;is&lt;/I&gt; sexy.&lt;/font&gt;</field>
<field name="root_node">
199840</field>
<field name="parent_node">
199840</field>
</data>
</node>
