[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Mounting an AppleShare volume using MacPerl?



At 20.09 -0500 1998.06.23, Peter Scherbring wrote:
>Does anyone know if you can mount an AppleShare volume using MacPerl? The
>volume needs to be accessible on the desktop like any volume you mount
>using the Chooser. I have looked through the reasonable pods in the
>standard MacPerl distribution as well as on-line and in the new MacPerl
>book with no luck. Also, the Chooser does not seem to like AppleScript so
>that is not an option. Did I overlook something?

>From David Turley's MacPerl list archives
(http://www.binary.net/dturley/macperl/search.html).

Date: Tue, 16 Sep 1997 10:20:29 -0400
To: lolo@ipbs.fr
From: pudge@pobox.com (Chris Nandor)
Subject: Re: [MacPerl] question about appleevent
Cc: mac-perl@iis.ee.ethz.ch
Sender: owner-mac-perl@iis.ee.ethz.ch
Precedence: bulk

At 08.06 9/16/97, Laurent Bardi wrote:
>the goal is to have a mount/umount sub under macperl
>sub mount
>{
>        local($zone,$machine,$share,$user,$password)=@_
>}
>sub unmount
>{
>        local($zone,$machine,$share)=@_
>}

Well, I couldn't figure out today how to unmount (anyone else have this?),
but here is the mounting version.

Requires the Mount Volume OSAX (Laurent has it if you can't find it online).


#!perl -wl
use strict;
use Mac::AppleEvents;

mount('PowerPudge','PowerPudge','Pudge','passwd');
sub mount {
    my($evt,@evt,%evt,$be,$rp,$er);
    die 'usage: mount(VOLUME,SERVER,USER,PASSWORD,ZONE)' if (!$_[0] || !$_[1]);
    %evt = (
        VOLM=>shift,    #required
        SRVR=>shift,    #required
        USER=>shift,    #optional
        PASS=>shift,    #optional
        ZONE=>shift,    #optional
    );
    foreach (keys %evt) {
        if ($evt{$_}) {
            $evt .= ",$_:TEXT(@)";
            push @evt,$evt{$_};
        }
    }
    substr($evt,0,1) = '';

    $be =
AEBuildAppleEvent('aevt','mvol',typeApplSignature,'MACS',0,0,$evt,@evt) ||
die $^E;
    $rp = AESend($be, kAEWaitReply) or die $^E;
    if (defined($er = AEGetParamDesc($rp,'errn'))) {
        warn 'Mount Volume error ', AEPrint($er);
    }
}

__END__

--
Chris Nandor             pudge@pobox.com             http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch