Re: Pashua Aqua Dialogue GUI

2003-11-07 Thread Chris Nandor
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Gary Blackburn) wrote:

 I've downloaded it and checked out the Perl example; there's two parts, 
 a Pashua binary and a Pashua.pm module. Put Pashua.pm in @INC somewhere 
 and the Pashua binary in your OS X Applications folder and you're in 
 business. Data from the dialogue box appears in a Perl hash as a return 
 value from the module's run method. Nifty.
 
 The topic of creating Aqua interfaces comes up on this list all the 
 time, and I know there's Camelbones and TK, but this seems like it'd be 
 a good choice for small programs because it's just stupid-simple.
 
 Oh yeah, and it's freeware.
 
 Disclaimer: I have no connection with the product or the programmer. I 
 just think it's cool! :-) Enjoy!

I have no connection either, but I did a quick review of the Perl code in 
Pashua.pm on this list a couple of weeks ago:

[EMAIL PROTECTED]

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/


Re: Newcomer with a few questions

2003-11-07 Thread Jay Young
Hi Chris,

Thanks very much for your example below.  It works very well on my 
machine!  :-)

Also, thanks for maintaining MacPerl.  It's an excellent application 
and I find it very convenient for testing code quickly and easily.  Is 
there any chance that MacPerl will ever be written as an OS X Native 
app?

Jay

--

On Nov 7, 2003, at 7:12 PM, Chris Nandor wrote:

In MacPerl, you can do MacPerl::Ask() to bring up a dialog with OK and
Cancel, and in Mac::Carbon -- a port of many of the MacPerl modules to 
Mac
OS X -- on Mac OS X, you can do the exact same thing.

% perl -le 'use MacPerl Answer; print Answer(Can you click OK?, 
OK,
Cancel) ? yes : no;'

The same code works under MacPerl and, if you have Mac::Carbon 
installed,
Mac OS X.  You don't need Tk for basic GUI things like this.  See man
MacPerl for more information (or cmd-click MacPerl in the MacPerl 
editor
if you are running that app).

--
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/



Re: Newcomer with a few questions

2003-11-07 Thread Paul McCann
John wrote...

 The trouble is that it takes an age for the libraries to be loaded, the 
 events to be compiled and for the dialog to appear:
 
 #!/usr/bin/perl
 use MacPerl;
 $phone = MacPerl::Ask(Enter your phone number:);

Hmm, must depend crucially on the machine: on this dual 1G thing
I'm driving at the moment it's about half a second from pressing
return until the dialog's staring me in the face:

perl -e 'use Macperl;$phone = MacPerl::Ask(Enter your phone number:); '

Pretty much the same as Pashua, for example (or applescript dialogs,
for another). In other words: your mileage may vary...

Cheers,
Paul



Re: Newcomer with a few questions

2003-11-07 Thread Chris Nandor
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (John Delacour) 
wrote:

 The trouble is that it takes an age for the libraries to be loaded, the 
 events to be compiled and for the dialog to appear:
 
 #!/usr/bin/perl
 use MacPerl;
 $phone = MacPerl::Ask(Enter your phone number:);
 
 
 I don't use Tk but I imagine the response with Tk would be immediate.

I imagine it might be similar, as Tk also has a lot of overhead.  I don't 
know, though.  And yeah, as Paul notes, my machine does it quite quickly.  
As he says, YMMV.


 Is there any way to avoid this delay?  If there were, I might start 
 using the Mac stuff -- as it is I prefer the speed of other methods.

While the MacPerl module loads quickly for me, some others have additional 
delay.  There probably are ways to speed them up, and I wish I had the time 
and expertise to work on it.  I've had some offers to get some help, which I 
may accept (if they are still open), but I haven't had the time to do that 
yet.

However, if you are asking about execution and not load times, well, the 
Mac:: modules all execute very quickly, in my experience.

Of course, MacPerl::Ask() and friends must compile the AppleScript each 
time, which is indeed slow, but Mac::Glue and other raw Apple events methods 
execute quickly, and Mac::OSA::Simple allows for precompilation (including 
saving, loading, and executing compiled scripts), which can be quite speedy.

So, for example, you could precompile an AppleScript with Script Editor, and 
then do:

   use Mac::OSA::Simple;
   my $script = load_osa_script($path);
   my $result = $script-execute;

Again, apart from module load times -- which are mostly fine on my computer, 
but perhaps not so much on slower ones -- you shouldn't see any speed 
problems with that code.  Of course, if all you are doing is running an 
AppleScript, there's no point to the above wrapper.  :-)

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/


Re: Newcomer with a few questions

2003-11-07 Thread Chris Nandor
In article [EMAIL PROTECTED],
 [EMAIL PROTECTED] (Jay Young) wrote:

 Also, thanks for maintaining MacPerl.  It's an excellent application 
 and I find it very convenient for testing code quickly and easily.  Is 
 there any chance that MacPerl will ever be written as an OS X Native 
 app?

No, there's honestly very little point to it.  The UI itself is easily 
replacable (I use BBEdit to edit and run Perl scripts, some people use 
DropScript to make droplets, etc.), and the modules have been largely 
ported.  There are other modules left unported, the GUI modules, but they do 
not require the MacPerl app.

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/