Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Smalltalk-like browser for perl

by awwaiid (Friar)
on Apr 06, 2001 at 10:51 UTC ( #70415=CUFP: print w/replies, xml ) Need Help??

This seems like the right section for this...

So have any of you played with smalltalk? I have... and one of the things I loved the most was the code browser. In fact, I've always thought the environment was one of the best things about the language (smalltalk, that is).

So I thought to myself, why can't perl have that too? Then I thought, it can! A bit of hacking later got me to this point.

What I have is a barely-bootstrapped browser. Barely meaning that it is just barely self-sufficient (but it is self sufficient).

In other words, I have created a mini programming environment, and the code for that environment is inside the environment, and due to the lovely interpreted nature of perl, changes to the code take place immediately. This is not a new idea... like I said, the whole smalltalk thing. It is self-sufficient in that any other features you could ever want can be added from within the system (with the exception of the startup script which loads the system in the first place... but whos counting? Besides, I'm sure that could be integrated too...).

Of course, in theory, this could one day be useful. Especially as a sort of teaching tool. You can, for instance, highlight a section of code and hit the "Print It" button on the toolbar, and it will evaluate the code and print the result. Try it on "5+7" or something.

You will need the newest gtk-perl, Gtk-Perl-0.7006 which can be attained from your nearest cpan mirror. (Also see the gtk-perl Homepage.

You can get the source here, and a screenshot. Don't mind the sloppy coding and the (possibly) strange way I structured the whole thing. It is, after all, mostly a proof-of-concept. And don't mind the buggies (but feel free to fix them and send me the results!).

I hope I've explained it well enough. I personally consider this a Cool Use For Perl.

Replies are listed 'Best First'.
Re: Smalltalk-like browser for perl
by dave0 (Friar) on Apr 07, 2001 at 23:21 UTC
    Being an ex-Smalltalk programmer, I've been thinking about something like this for quite some time. It's definitely a good idea, and you're off to a great start.

    One question, though, is there any particular reason you created your new syntax:

    PACKAGE: Goe::Browser INHERIT: Goe::Object USES: Goe::Browser::UI Goe::Browser::Events METHOD initialize
    instead of using standard Perl like so:
    package Goe::Browser; use base qw(Goe::Object); use Goe::Browser::UI; use Goe::Browser::Events; sub initialize
    Or, is being able to handle standard Perl package/subroutine syntax up-and-coming in the next version? =)

      Not really, the main reason was because it was easier :)

      Well... it does keep the files neater. I think that I would prefer making an import mechanism. Most things that are filed-in probably aren't already in nice little packages.

      Then again, the way I have it is still sort of there so that I can see the source code. In theory they should all be stored in a more-binary like image file(s). For instance, someone putting "END METHOD" in their method would be bad :)

      The main reason I haven't done this yet is because I just barely got it bootstrapped, and until now have actually been editing those .goe files by hand.

        Well... it does keep the files neater. I think that I would prefer making an import mechanism. Most things that are filed-in probably aren't already in nice little packages.
        Hmmm... import/export would work, but if there's no real reason to use END METHOD and the like (there seems to be a direct perl equvalent for each of your new keywords) it might make more sense to do away with the .goe format and just spit Perl out the back end. This would make the edit-test-edit cycle a bit easier, as you wouldn't have to convert .goe to pure Perl before doing anything with it outside the browser.
        Then again, the way I have it is still sort of there so that I can see the source code. In theory they should all be stored in a more-binary like image file(s).
        Would a Smalltalk-style binary image really provide any benefit here?
        For instance, someone putting "END METHOD" in their method would be bad :)
        If the need is there for special delimiters, one possibility would be to place them in a comment line. Something like:
        #*# END METHOD
        might work particularly well, as you can check for the special #*# comment characters as well as the specific tag, reducing the chance of false hits. Plus it's fairly nonintrusive, so you might be able to convince a module maintainer to accept patches that make their CPAN module compatible with your browser. =)
Re: Smalltalk-like browser for perl
by beppu (Hermit) on Apr 07, 2001 at 13:35 UTC
    It certainly is impressive. I will go home and try it for kicks. I will also study your GTK code, because I've been meaning to try some GTK/Perl myself... so my thanks to you for writing this. :)
Re: Smalltalk-like browser for perl
by awwaiid (Friar) on Apr 07, 2001 at 12:03 UTC

    What, no comments or thoughts?

      It looks quite promising. I was a Smalltalker before picking up Perl, and miss the Smalltalk browser.

      So, "Install Gtk-Perl" gets added to the ever-growing list.

      So many fun things to do. So little time...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://70415]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-05-17 20:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (162 votes). Check out past polls.

    Notices?