So, I've been playing around with using Chris' glue module to interface with my favorite Mac administration program - NetOctopus. If you're in charge of more than 5 macs, you really should use this program! It's great, if a little expensive for the home user. The new version will let you execute remote applescripts - like tell application "MacPerl" to do script "unlink <*>;" ... :-) One of the very simple things that I want to do with NetO is parse it's log to get some very specific kinds of reporting. So, I started with how to bring the log into perl. There are a bunch of ways I could do this, but I wanted to do it "live" - so I thought of MacPerl & glue. NetO is highly scriptable (nay, recordable even), and will let me do tell application "NetOctopus" get lines of log window end tell This is the perl script I ended up with use Mac::Glue ':glue'; my $netOGlue = Mac::Glue->new('NetOctopus'); $logContents = $netOGlue->obj(lines => glueAll,property => 'log_window'); @lines = $netOGlue->get($logContents); die $^E if $^E; A *little* more verbose than the AppleScript - but I'll have much better capabilites to parse the log than I would in AS (and can use fun stuff like hashes much easier too). In the process of working with Chris to translate from the AppleScript to the glue, there are a few tips we thought should get passed on: 1) use Mac::Glue ':glue'; It's not obvious from a *casual* reading of the pods for Mac::Glue that the 'glueFirst', 'glueAll' and etc. constants are not available without adding the ':glue' to the use statement. So, make sure you do. If I'd found this on my own, I'd have saved Chris a lot of time. (So, that's the usual meta-tip... RTFM. Twice.) 2) die $^E if $^E; This is kind of like doing an open or die - when troubleshooting and in general always check your error status. This will tell you what's going wrong with your glue statements, which might help you find out how to fix them. 3) use Data::Dumper; If it's not very obvious from $^E what's wrong with your glue code - why the apple events are failing - you can print out the objects that are resulting with Data::Dumper. In my case, I was trying to get the lines of the log as text - which they are sent as by default, but I was trying to get them wrong. So, I did this: use Data::Dumper; print Dumper $netOGlue->get($logContents,as => 'string', _retobj => 1); Note that the _retobj => 1 is important to get the reply object that you are trying to print out. This didn't help me, particularly, but it confirmed that I wasn't doing something right. 4) Capture AE If none of this is doing what you think it is, you should go back to looking at the raw Apple Events that you are trying to generate. Capture AE is a freeware control panel available here: ftp://ftp.WestCodeSoft.com/OneClick_Scripting_Tools/CaptureAE.sit.hqx It will log to it's window the apple events being sent while the control panel is open. It's pretty neat, actually. You can then get a picture of the AppleEvents you are *trying* to send, and play around with your glue code until you send the right stuff. If none of these end up helping you - bug Chris! He's got *plenty* of spare time to help out! ;-) Or at least read the glue pod again a few more times. -Jeff Lowrey ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-modules-request@macperl.org