November 2002 Archives

MacPerl Source Sync

| | Comments (0)
I've synched up the MacPerl sources with perforce and CVS, including only one core patch (to disable SA_RESTART for singal handling, in util.c).

So for 5.6.1r2, I have left to clean up the docs, build Shuck 1.7.0 (which has some really nice new additions, along with some significant improvements and bug fixes in parsing and rendering of the POD text), release new versions of a few of my modules (e.g., Mac::Glue) with recent modifications, and that's about it. use.perl.org

Thankful Thanksgiving!

| | Comments (0)
Most of us have a lot to be thankful about. So be thankful about those things. IT IS SO ORDERED. slashdot.org

Moz 1.2 Upgrade

| | Comments (0)
I upgraded to Mozilla 1.2 this morning, on Mac OS X. It hung on startup, trying to create the first window.

I duplicated ~/Library/Mozilla/ in case I broke something, then deleted the Application Registry file inside that folder, and then started Mozilla. It asked me to create a new profile; I obliged. New profile, I want my old prefs back. I quit Mozilla, copied the contents of my old profile into the new one, and then started Mozilla again. Everything back to normal.

Although, I cannot tab in between form elements anymore. I used to be able to select form elements with tab. What gives?

Now Playing: Bound To Come Some Trouble - Rich Mullins (Never Picture Perfect)

use.perl.org

Stupid Mac::Carbon Tricks: Volumes

| | Comments (0)
brian d foy has some code to convert Mac OS paths to Mac OS X paths, and vice versa. To do this, he needs to know the startup volume (because on Mac OS X the startup volume is /, while other mounted volumes are normally under /Volumes/$name/, and in Mac OS all volumes are $name:). He was getting it via AppleScript. Blech.

I sent him some code I think others might find interesting and/or useful.

The MacPerl module (which runs in a limited fashion under Mac OS X perl, in Mac::Carbon) has a function called Volumes(), which returns all mounted volumes in list context, and the startup volume in scalar context. The paths returned text representations of FSSpec data structures, which can be converted to native paths (with slashes in Mac OS X, and colons in Mac OS) with MacPerl::MakePath():

$ perl -MMacPerl=all -le 'print join "\n", map { MakePath($_) } Volumes()'
/
/Volumes/Bourque
/Volumes/Bird
/V olumes/Diablo II Play Disc
/Volumes/Diablo II Cinematics

But that is not too helpful for getting the startup volume name under Mac OS X. You can, however, merely strip off everything up to the ":" in the FSSpec to get the volume name:

$ perl -MMacPerl -le 's/^.+://, print for MacPerl::Volumes()'
Orr
Bourque
Bird
Diablo II Play Disc
Diablo II Cinematics

Now Playing: Growing Young - Rich Mullins (The World As Best As I Remember It, Vol. 2)

use.perl.org

DIE DIABLO DIE

| | Comments (0)
I take awhile to play the hot new video games, usually. I just finished Diablo 2. I've been playing it on and off since shortly after it was released for Mac OS, and finally killed Diablo to win the game. Woooo. It is tense work, because I play a single player game, and at the end if you die, you're kinda screwed. I copy my character data in case I totally blow it, but still, it is a lot of work to go back after dying, especially in the last part where you need to clear out all these undead things to break the seals to free Diablo so you can kill him.

Next up: STA Vice City! If only I had a PS2 ...

Now Playing: Where You Are - Rich Mullins (The World As Best As I Remember It, Vol. 1)



Update: BTW, yes, this means I didn't do much work on MacPerl tonight. I needed a pre-break break. I might do some over Thanksgiving, at night when the family is asleep. As usual. use.perl.org

Mac Stuff Progress

| | Comments (0)
After taking a short break since the release of Mac::Carbon 0.01, I am this week going to try to work toward finishing up MacPerl 5.6.1r2. All the bugs for this release have been fixed, I just need to clean up things, commit them, sync up changes with various perforce branches and module distributions, prepare some docs, etc. Then I'll release Mac::Carbon 0.02 and begin work on Mac::AppleEvents.

It's sortof a pain sometimes to deal with the MacPerl sources, because I have the source in CVS, and across three branches in perforce (maint-5.6/macperl, maint-5.8/macperl, macperl). I've not touched them in awhile, so I will need to sync them with what is current in maint-5.6/perl, maint-5.8/perl, and perl. I really only have one change to the perl core, a couple of lines for signals in util.c.

Last time I left a bunch of docs and sample code out of the MacPerl distribution, and I need to add them back in.

I've made a few changes to a few module distributions that are separate (like Mac::Glue), plus Mac::Carbon, so I need to sync those up and release them.

Mac::AppleEvents doesn't look too hard, just a lot of work going over what is still good or not in the API, and making changes to a few changed portions of the API (hopefully, this won't be too difficult, but some of the API has subtly changed, in part because direct memory access is now a no-no, and in part because some of the API used to be in a separate third-party library and Apple changed it when they swallowed it up).

I also need to come up with the AE idle procedure, which I have no real idea how to do. ;-) MacPerl's SubLaunch.c has SubLaunchIdle(), which uses a global called gMacPerl_HandleEvent. Now, SubLaunchIdle() and gMacPerl_HandleEvent are only used in Mac::AppleEvents (outside of the application, which is not being used here), so I can probably make it "global" to AppleEvents.xs, if I even need it; it looks to me like gMacPerl_HandleEvent itself is only used by the app, so I can modify SubLaunchIdle() to work without it (the procedure first checks to see if there is a MacPerl event, and if not, it checks to see if there is an Apple event waiting). OK, fine. Looks pretty straightforward (especially compared to the API changes).

I am still not sure how well AEs will work, coming from perl instead of an application. In a week or three, I imagine I'll find out. :-) I suppose if the AppleScript code works, and it does, then there shouldn't be a problem. I am optimistic that I will have something working before the end of December. Look for it in Mac::Carbon 0.03!

Now Playing: My Ship - Miles Davis (Love Songs)

use.perl.org

I'm not drunk, I'm always like this

| | Comments (0)
Massachusetts is second-to-worst in drunk driving, according to MADD. The only worse state is Montana, with an F. Alaska is tied for worst at D-.

The scores are achieved by ranking many different parameters, including existing laws, support from political bodies, deaths, etc. The governor's office got a D, while the nationwide average is a C. I wonder if having a teetotaling Mormon -- the very antithesis of what it means to be a Masshole -- in the corner office will make a difference for next year's grade. :)

Now Playing: Just Like You - Jacob's Trouble (...Let The Truth Run Wild)

use.perl.org

LotR DVDs

| | Comments (0)
The special collector's edition of the LotR DVDs comes with an additional National Geographic "Beyond the Movie" DVD. TiVo recorded a one-hour Beyond the Movie: LotR special off the National Geographic channel. I assume it is (mostly) the same as what is on the DVD, but I wonder if that DVD has anything else of interest.

Now Playing: Little Red Words - Jacob's Trouble (Knock Breathe Shine)

use.perl.org

I Love This Song

| | Comments (0)
The band is kickin' too. Well, they used to be, when they existed.

Now Playing: Days That Passed Me By - Jacob's Trouble (...Let The Truth Run Wild)

use.perl.org

Big Cat

| | Comments (0)
Ranchero Software has Big Cat, which allows you to call scripts from a contextual menu, on files in the Finder, or on text in many applications. You can process with compiled AppleScripts, or shell scripts (including Perl scripts).

Here's a perl script I keep in the Big Cat folder called "Set Type - BBEdit".

#!/usr/bin/perl
use MacPerl 'SetFileInfo';
SetFileInfo('R*ch', 'TEXT', @ARGV);

Ahhhhhhhh.

Now Playing: Henry Kissinger - Monty Python (Sings)

use.perl.org

Signed, Epstein's Mother

| | Comments (0)
On SNL this weekend they had a commercial for a new show this fall on the WB. Harry Potter comes back to Hogwarts Academy, as a teacher. It is now rundown and in a bad neighborhood. Cue music and title: "Welcome Back, Potter."

I got a good chuckle, but then I started noticing other similarities. Sweathogs at Hogwarts? Horshack's scarf on Harry Potter? I am sure if I had ever seen a movie or read a book from the Harry Potter series I could come up with more similarities.

Please excuse Chris from having to watch Harry Potter. He has an inner ear problem: he hates to hear himself scream. Signed, Epstein's Mother.

Now Playing: Robinson In His Cadallac Dream - Counting Crows (This Desert Life)

use.perl.org

Homeland Alert

| | Comments (0)
Homeland Alert is a Mac OS X program to display the current Homeland Secutiy Alert Status in your menu bar. Right now it's yellow! And ... it's still yellow! I hope yellow is good ... use.perl.org

Interarchy, Mac::Glue, SFTP

| | Comments (0)
One of my favorite examples of Mac::Glue is a program I use to compare my local and remote copies of Slash. My development box is a Linux box under my desk, but I do most of my editing of code on the Mac OS X box, via Interarchy. It opens the selected file in BBEdit for editing, and automatically uploads it when I hit Save.

So my program uses Mac::Glue to tell Interarchy to fetch certain directory listings and files, and opens them in BBEdit; then BBEdit is told to compare that file to the local copy. If they don't match, I look at the differences side-by-side in BBEdit's differences windows.

One problem with this setup is that it makes it hard when I am on the road. But Interarchy now has both SSH/FTP and SFTP. And all I need to do is change the $host parameter to include ";ssh" after it, or add sftp => 1 to the edit() method:

# username/password retrieved from Keychain; sftp for extra security
my $err = $interarchy->edit(path => $r_path, host => $host, sftp => $sftp);
 
if ($err) {
    $interarchy->close($i_window); # clean up
} else {
    my $result = $bbedit->compare($b_window, against => $l_path);
 
    if ($result->{differences_found}) {
        print "Hit Return when done comparing:\n  $lpath";
        $bbedit->activate;
        exit if <> =~ /^q/i;
    } else {
        $bbedit->close($b_window);
    }
}

I just need to get Mac::AppleEvents (a future part of Mac::Carbon) ported to Mac OS X so I can run the script from Mac OS X instead of MacPerl under Classic (though it works fine under Classic, controlling Interarchy and BBEdit under Mac OS X, it is still ... Classic).

Now Playing: Like A Diamond - Tom Petty & The Heartbreakers (The Last DJ)

use.perl.org

Making brian d foy's computer speak

| | Comments (0)
brian d foy wrote a program to make his computer talk. Here's a more efficient version using Mac::Speech (from Mac::Carbon), instead of RunAppleScript/DoAppleScript.

#!/usr/bin/perl
use Mac::Speech;
 
my $voice   = $Mac::Speech::Voice{Victoria};
my $channel = NewSpeechChannel($voice);
for ( reverse ('blast off!', 1 .. 10 ) ) {
    SpeakText($channel, $_);
    print "$_\n";
    sleep 1;
}
sleep 1 while SpeechBusy();
DisposeSpeechChannel($channel);

Now Playing: Blue Sunday - Tom Petty & The Heartbreakers (The Last DJ)

use.perl.org

EyeTV

| | Comments (0)
I posted a review of EyeTV on Slashdot, and in it, included a command-line utility that searches your EyeTV folder. It is written using the new Mac::Carbon (using Mac::Files and Mac::Memory, specifically, to find your preferences file, and convert the alias data in it to a POSIX path). use.perl.org

Mac::Carbon 0.01

| | Comments (0)
From a post on use Perl:

Mac::Carbon is a Carbon/Mac OS X port of the Mac:: modules included with MacPerl. It's in development, but a lot of it works, and it is available, on the CPAN (soon) and on SourceForge.net (now). To discuss Mac::Carbon, check out the macosx@perl mailing list.

NAME
    README - Carbon API for perl on Mac OS X
 
SYNOPSIS
    This is not release-quality software. It is still in development,
    and not recommend for use in a production environment.
 
    Mac::Carbon is a collection of perl modules for accessing the Carbon
    API under Mac OS X. It is a port of the Toolbox modules written by
    Matthias Neeracher for MacPerl.
 
    Part of the current strategy is to make Mac::Carbon the intersection
    of the old and new Mac OS APIs. We will not be adding new function-
    ality from Carbon, except as needed, for now. This may change over
    time as Mac::Carbon stabilizes.
 
    See the documentation in the Mac::Carbon manpage for more
    implementation details, bugs, etc.
 
HELP ME
    There are probably a lot of bugs, especially in Carbon.h. Bugs are
    listed in the section on "Known Bugs" in the Mac::Carbon manpage;
    please feel free to report them on the MacPerl bug reporting page,
    in the "Mac Toolbox" category. Patches are welcome, too, of course.
    For large patches, such as stuff for test suites and building,
    please do coordinate with me before spending much time on it.
 
            http://sf.net/projects/macperl/
 
REQUIREMENTS
  Mac OS
 
    These modules all build under Mac OS, but it is recommended you build
    them as a part of MacPerl itself, or at least under the MacPerl
    source.  See http://dev.macperl.org/ for more information.
 
    Under Mac OS, the full Mac OS API is available, not just the
    Carbon-compatible routines.
 
  Mac OS X
 
    To build these modules on Mac OS X, the Developer Tools are required.
 
    The Test::More module is required for running tests.
 
    The separate Mac::Errors module is not required, but is highly
    recommended.
 
    These modules have only been tested with perl 5.6.0 on Mac OS X. See
    the note in the BUILDING manpage.
 
    The modules will compile and test remotely (such as via ssh, instead
    of via the Terminal), but some of the tests might not run properly,
    and one of the tests (for Mac::Notification) wants user feedback
    (though will work without it).
 
BUILDING
    Matthias added some extensions to XS for his Toolbox modules; they
    were never fully embraced by p5p, and as a result, we have a
    separate xsubpp for these additional XS macros. There is currently
    no resolution to this problem. Either we write a pre-preprocessor
    that converts the .xs files to be able to be handled by perl's
    xsubpp, or we modify the .xs so that it can be handled by perl's
    xsubpp, or we distribute a separate xsubpp (which is dangerous, as
    xsubpp changes with versions of perl).
 
    Currently, Mac::Carbon is distributed with the already-processed .c
    files. If you really want to compile with the .xs files, you can use
    the xsubpp programs (either the 5.6 or 5.8 versions) included in the
    distribution. This is only temporary, until we have a permanent
    resolution to these issues.
 
    You might want to run the test suite with `make test TEST_VERBOSE=1'.
    It's cool.
 
SUPPORTED MODULES
    Currently, only a subset of the modules are supported. The ported
    modules are:
 
            Mac::Components
            Mac::Files
            Mac::Gestalt
            Mac::Memory
            Mac::MoreFiles
            Mac::Notification
            Mac::Processes
            Mac::Resources
            Mac::Sound
            Mac::Speech
            Mac::Types
 
    Coming next, hopefully:
 
            Mac::AppleEvents
            Mac::OSA
 
    Mac::AppleEvents is going to take more work than the others, as it
    involves some significant API changes.
 
    Following those, the pure-perl modules, which should not take much
    work, as long as the core XS modules they rely on are working:
 
            Mac::AppleEvents::Simple
            Mac::OSA::Simple
            Mac::Glue
 
    And, possibly:
 
            Mac::InternetConfig
            Mac::SpeechRecognition
 
    There are currently no plans for the other (GUI) modules, including:
 
            Mac::Controls
            Mac::Dialogs
            Mac::Events
            Mac::Fonts
            Mac::Lists
            Mac::Menus
            Mac::Movies
            Mac::Navigation
            Mac::QDOffScreen
            Mac::QuickDraw
            Mac::QuickTimeVR
            Mac::TextEdit
            Mac::Windows
 
    We could do these eventually, if there is enough interest. They don't
    port as easily as some of the others, for many reasons, not the
    least of which is that we need a framework to handle events etc.,
    which for MacPerl is mostly implemented in macish.c / macish.h.
 
AUTHOR
    The Mac Toolbox modules were written by Matthias Neeracher
    <neeracher@mac.com>. They are currently maintained by Chris Nandor
    <pudge@pobox.com>.
 
VERSION
    $Id: README,v 1.1 2002/11/13 02:04:50 pudge Exp $

slashdot.org

Mac::Carbon 0.01

| | Comments (0)
Pleeeease release me, let me gooooooo, for I don't love yoooooou, any mooooooore ... use.perl.org

Making Your CPAN A Whole Lot Lighter

| | Comments (0)
I deleted a bunch of the old binary distributions, allowing them to live on in backPAN. They only work for MacPerl 5.2.0r4, so most people won't need them anyway. And I deleted the Newton book docs, for similar reasons.

Deletions:

$CPAN/authors/id/C/CN/CNANDOR/DBI-1.08-bin-2-MacOS .readme
$CPAN/authors/id/C/CN/CNANDOR/DBI-1.08-bi n-2-MacOS.tar.gz
$CPAN/authors/id/C/CN/CNANDOR/DP rof-19990108-bin-1-Mac.readme
$CPAN/authors/id/C/ CN/CNANDOR/DProf-19990108-bin-1-Mac.tgz
$CPAN/aut hors/id/C/CN/CNANDOR/Data-Dumper-2.101-bin-1-Mac.r eadme
$CPAN/authors/id/C/CN/CNANDOR/Data-Dumper-2 .101-bin-1-Mac.tgz
$CPAN/authors/id/C/CN/CNANDOR/ GD-1.19-bin-2-MacOS.readme
$CPAN/authors/id/C/CN/ CNANDOR/GD-1.19-bin-2-MacOS.tar.gz
$CPAN/authors/ id/C/CN/CNANDOR/MD5-1.7-bin-1-MacOS.readme
$CPAN/ authors/id/C/CN/CNANDOR/MD5-1.7-bin-1-MacOS.tar.gz
$CPAN/authors/id/C/CN/CNANDOR/MIME-Base64-2.11-b in-1-Mac.readme
$CPAN/authors/id/C/CN/CNANDOR/MIM E-Base64-2.11-bin-1-Mac.tgz
$CPAN/authors/id/C/CN /CNANDOR/Math-Random-0.6-bin-1-MacOS.readme
$CPAN /authors/id/C/CN/CNANDOR/Math-Random-0.6-bin-1-Mac OS.tgz
$CPAN/authors/id/C/CN/CNANDOR/SQL-Stmnt-0. 1012-bin-1-Mac.readme
$CPAN/authors/id/C/CN/CNAND OR/SQL-Stmnt-0.1012-bin-1-Mac.tgz
$CPAN/authors/i d/C/CN/CNANDOR/Set-Object-1.00-bin-2-MacOS.readme
  $CPAN/authors/id/C/CN/CNANDOR/Set-Object-1.00-bin -2-MacOS.tgz
$CPAN/authors/id/C/CN/CNANDOR/Storab le-0.6@4-bin-1-Mac.readme
$CPAN/authors/id/C/CN/C NANDOR/Storable-0.6@4-bin-1-Mac.tgz
$CPAN/authors /id/C/CN/CNANDOR/String-CRC-1.0-bin-1-MacOS.readme
$CPAN/authors/id/C/CN/CNANDOR/String-CRC-1.0-bin -1-MacOS.tgz
$CPAN/authors/id/C/CN/CNANDOR/Text-C SV_XS-0.18-bin-2-Mac.readme
$CPAN/authors/id/C/CN /CNANDOR/Text-CSV_XS-0.18-bin-2-Mac.tgz
$CPAN/aut hors/id/C/CN/CNANDOR/Text-Metaphn-1.95-bin-1-Mac.r eadme
$CPAN/authors/id/C/CN/CNANDOR/Text-Metaphn- 1.95-bin-1-Mac.tgz
$CPAN/authors/id/C/CN/CNANDOR/ Text-Soundex-2.20-bin-1-Mac.readme
$CPAN/authors/ id/C/CN/CNANDOR/Text-Soundex-2.20-bin-1-Mac.tgz
$ CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.004.readme
  $CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.004.sit.h qx
$CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.005_02 .readme
$CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.0 05_02.sit.bin

That's 3,762,910 bytes. Enjoy!

Now Playing: Every Grain Of Sand - Bob Dylan (Biograph)

use.perl.org

Stupid DynaLoader Tricks

| | Comments (0)
In MacPerl, there's a neat little hack to make certain functions always available. Essentially, bootstrap is called for the MacPerl, OSA, and XL packages explicitly in runperl.c:

av_push(PL_preambleav, newSVpv("BEGIN { bootstrap MacPerl; bootstrap OSA; bootstrap XL;  }",0));

All three packages are statically linked, and are a "part of" the MacPerl package (that is, they get compiled into the same static library file). When porting this to Mac OS X, it causes problems: in MacPerl.pm, no bootstrap is done because it is not necessary, having already been done.

Normally, one could just do a conditional bootstrap, but this is complicated by the fact that a bootsrap OSA (we skip XL for Mac OS X) will look for a dynamic library named "OSA.$dl_dlext". But we don't have that. So instead, we first bootstrap MacPerl, and then find the file that was used for MacPerl -- don't load the file, it's already been loaded -- and use that to install our OSA::boostrap, before finally calling it.

It's possible I am overcomplicating things or doing something wrong, but hey, it works ...

# bootstrap MacPerl is already implicitly done by your MacPerl binary
unless ($^O eq 'MacOS') {
    # use Config;
    # my $dl_dlext = $Config::Config{'dlext'};
    my $dl_dlext = 'bundle';
 
    require DynaLoader;
    push @ISA, 'DynaLoader';
    bootstrap MacPerl;
 
    # because OSA is in MacPerl.bundle, not OSA.bundle
    my $file = "auto/MacPerl/MacPerl.$dl_dlext";
    foreach (@INC) {
        $dir = "$_/auto/MacPerl";
        next unless -d $dir;
        my $try = "$dir/MacPerl.$dl_dlext";
        last if $file = -f $try && $try;
    }
 
    for my $mod (qw(OSA)) {
        my($xs, $symref);
        for (@DynaLoader::dl_librefs) {
            last if $symref = DynaLoader::dl_find_symbol($_, "boot_$mod");
        }
        next unless $symref;
        $xs = DynaLoader::dl_install_xsub("${mod}::bootstrap", $symref, $file);
        &$xs($mod);
    }
}

Now Playing: Ribbon In The Sky - Stevie Wonder (Original Musiquarium I, Vol I)

use.perl.org

IJLS

| | Comments (0)
8888 (cf. 7777) use.perl.org

Switch It Good

| | Comments (0)
This guy is kinda funny. He "switched" to Canada from the U.S. Although, I am skeptical: at the end he says "I'd never go back" with a clearly Canadian accent, making me think he is from Canada to begin with. :-) use.perl.org

Mac::Carbon Integration

| | Comments (0)
I've integrated the changes for Mac::Carbon into MacPerl, and after a few changes, it all works, and all the tests pass. Well, I still need to modify some of the Makefile.PLs (for modules not ported; I updated all the Makefile.PLs to look essentially the same), and I'll need to build again to make sure those all work, but I am on track for a Mac::Carbon release this week. I just need to do some more cleanup (the other Makefile.PLs, and cleaning up some of the old t/*.t files).

I think I am going to skip the rest of the test suite for now (patches welcome :-) and come back to it later. It's a 0.01 release, after all. use.perl.org

Fellowship of the Ring DVDs

| | Comments (0)
Today my wife found the new FotR special extended edition DVD at BJ's wholesale club. It's not supposed to be released until Tuesday, but they had it up, and she bought it, and we watched it tonight.

It is not just additional scenes: it is a lot of additional shots interspersed in existing scenes. So they had to rerecord a lot of the score to fix the length, and do a lot more to get it to work, and it looks great.

I was happy to see some of the additional footage, such as Galadriel talking about her ring and giving the gifts to the fellowship. All told, it was over 30 minutes of extra footage, including 5-6 new scenes. The running length is now over 3 hours, 45 minutes. However, that's including 20 additional minutes of credits, showing nothing but names of charter members of the LotR fan club. Heh.

The DTS 5.1 was cool; and by cool, I mean totally sweet. Someday I need to get me a digital TV so the picture looks as good. use.perl.org

Mac::Carbon Nearer

| | Comments (0)
I've got most of my minor makefile issues resolved, and I've decided to, for now, release the source with the .c files, generated by xsubpp, because the .xs files use custom XS macros (and a custom xsubpp) that make them incompatible with every other xsubpp. The plan is to probably have an xxsubpp, which will take an .xxs file and create an .xs file, which xsubpp can handle. We'll see.

I did a make dist and copied it to another Mac OS X box and did the old perl Makefile.PL ; make ; make test ; sudo make install, and it all worked, so it's Good Enough for now.

I've added a Mac::Carbon module, which will serve primarily as documentation for the rest of the distribution, but also as a front-end to the rest. See, in Mac OS, you need to #include each individual header file for the Mac API that you want; in Mac OS X, you can just #include . So Mac::Carbon will give you all of the symbols from all of the modules, if you want them.

So what next? I might try to integrate it into the MacPerl source ASAP, and (if I feel up to it) add some Files/MoreFiles/Resources tests, and then ... release. Woop.

Now Playing: Supervixen - Garbage (Garbage)

use.perl.org

Googlism

| | Comments (0)
Top pudge googlism: "pudge is right".

pdcawley asks how many of those quotes were sarcastic. I can't see how it matters. :-) It can have so many meanings, all of them true in their own way.

Now Playing: Rockin' the Suburbs - Ben Folds (Rockin' the Suburbs)

use.perl.org

Mac::Carbon and Testing

| | Comments (0)
I am normally loathe to write tests, but for Mac::Carbon, I am making an exception. So the other night, I started working on a test suite. It is far from exhaustive, but it is a nice beginning. It does things like get a list of your volumes, convert them from FSSpec to paths, make sure the paths exist with -d, runs an AppleScript to get the version of the Finder, gets/sets creator/type of files, displays the amount of RAM in and the clock speed of the machine, displays a notification dialog to tell you to switch various applications to the front/back, plays a sound from a resource file, talks using the speech manager, and more.

I am even using Test::More, which makes life easier. I may need to include it in MacPerl. It's all working really well thus far.

    ok(my $h = Handle->new('xyzzy'),    'new handle');
    is($h->get, 'xyzzy',            'get handle');
    is($h->size, 5,                'handle size');
    is($h->get(2, 2), 'zz',            'get handle portion');

I just need to add some more tests for Mac::Files and Mac::MoreFiles, then clean it up (which includes making it build on machines other than this one and integrating the changes with MacPerl). Then: profit! I mean: release!

Now Playing: Fired - Ben Folds (Rockin' the Suburbs)

use.perl.org

About Time

| | Comments (0)
It's about time. The U.S. government is now dominated by the Republican party on all fronts. Now, maybe some good will get done.

Oh, I have no illusions that the GOP is perfect. I dislike the majority GOP opinion on several important fronts, especially in regard to Microsoft and various speech issues (e.g., copyright). But right now I am more interested in fixing social security, health care, and the economy, and the GOP now has the opportunity and responsibility to fix them. Along the way, they can lower taxes, increase national defense, and get more conservative judges on the bench (the more strictly constructionist, the better).

Of course, if they fail, they will be gone in two years. But I don't think they will fail.

I am also placing bets on when the GOP will take control of the Senate. I am thinking it will be in two weeks. If the new Reform Senator from Minnesota would vote for Lott, then the GOP can take control of the Senate essentially at any time. They might wait for Coleman to arrive, or until the new Congress begins, though.

I think that it would be poetic if Daschle was replaced as Majority Leader as soon as possible, since he's really the one who blew this whole election for the Democrats. Forgetting that It's The Economy, Stupid, the Democrats focused primarily on war and homeland security for the past few months. Stupid. But I am thankful. slashdot.org

mount_webdav authentication

| | Comments (0)
Yesterday I was talking to some guys who had set up a WebDAV server, but noted that under Mac OS X, the keychain was not remembering the authentication for it. Sucks. So I played around with mount/mount_webdav and got it to work.

But man, is it ugly. mount_webdav requires you to write out a file with the username and password in it, then pass the file descriptor to the program as an argument. So I encode the username and password, then make a temp file and unlink it, prepare the file with select() and fcntl(), then print to it and call mount with the appropriate arguments.

And then, it seems Mac OS X's open command won't open the new volume most of the time. I also tried AppleScript, with open location, and that similarly failed. Bug.

#!/usr/bin/perl -w
use strict;
use File::Temp 'tempfile';
use Fcntl 'F_SETFD';
 
my $server = 'dav.example.com';
my $path   = '/Volumes/dav';
my $user   = 'login';
my $pass   = 'password';
 
# encode username and password
(my $ulen = sprintf "%4s", chr length $user) =~ s/ /\0/g;
(my $plen = sprintf "%4s", chr length $pass) =~ s/ /\0/g;
my $data = sprintf "%s%s%s%s", $ulen, $user, $plen, $pass;
 
# create mount point and temp file, and unlink file so no one can see it
mkdir $path;
my $fh = tempfile();
unlink $fh;
 
# autoflush
select( (select($fh), $|++)[0] );
 
# get ready to pass fd
my $fd = fileno($fh);
fcntl($fh, F_SETFD, 0) or die "Can't clear close-on-exec flag on temp fh: $!\n";
 
# finally, write username and password and mount
print $fh $data;
system('mount', '-t', 'webdav', '-o', "-a$fd", $server, $path);
 
# open (first usually fails, don't know why; but you can just open the
# icon in the Volumes folder, which is just as good as opening the icon
# on the Desktop
system('open', $path);
system('open', '/Volumes/');
 
# clean up
close $fh;
 
__END__

Now Playing: What It Takes - Aerosmith (Pump)

use.perl.org

Public Drunkenness

| | Comments (0)
It is hard to watch last night's The Daily Show on your laptop computer when you're on the train going to work, without looking like a crazy person. use.perl.org

Funny Politics

| | Comments (0)
So today, the Minnesota senator candidates from the two major parties had their one and only debate at 11 a.m. ET.

Jesse Ventura, who had previously agreed to appoint the winner of tomorrow's election as the senator to finish out the current session (which ends in January), was miffed at the tone of the memorial service/campaign rally on Tuesday, and so he appointed an independent instead, and he did it shortly after 11 a.m. today, briefly upstaging the debate.

Now, the makeup of the U.S. Senate is 49-49-2, with the President of the Senate holding the tiebreak vote for the Republicans. The Senate could hold new leadership elections now, just as they did in the opening months of the Congress almost two years ago, when a Republican senator became an independent. That independent voted for the Democrats; if this new independent would vote Republican, then Trent Lott would be the Majority Leader for the first few, and last few, months of the Congress, whereas Tom Daschle had all the months in between.

Weird.

In the debate, Mondale was very snippy, while Coleman was quite polite. I don't know which will appeal more to the MN voters, but they both seemed to hold their own on the issues. use.perl.org
We just watched the special edition of Beauty and the Beast on DVD with our daughter, and I was shocked at the end to realize that Jerry Orbach, Law & Order's Detective Lenny Briscoe, played Lumiere, the overamorous candelabra. Freaky.

In less of a leap, David Ogden Stiers played Cogsworth, the clock. use.perl.org
<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Archive

This page is an archive of entries from November 2002 listed from newest to oldest.

October 2002 is the previous archive.

December 2002 is the next archive.

Find recent content on the main index or look in the archives to find all content.