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

[MacPerl] Re: Fwd: app glue alpha online



Cc: to MacPerl list.

At 17.25 -0400 1998.09.21, Christopher Yeh wrote:
>Specifically, If I wanted to call Anarchie Pro and make a call to store,
>how would I pass parameters to the store call such that user, password,
>etc. are filled in? The lack of documentation and my limited experience
>with perl is making this difficult. Could you provide an example?

Well, documentation will be produced along with the code, eventually.  For
now, you need to look at the module.  Anarchie_Pro.pm says about store:

    'store'   => {'class' => 'Arch', 'event' => 'Stor', 'params' => [
                ['----', keyDirectObject(), 'alis', 1, 0, 0, 1],
                ['name', 'pnam', 'TEXT', 0, 0, 0],
                ['via_socks', 'ArGS', 'TEXT', 0, 0, 0],
                ['url', 'ArUR', 'TEXT', 0, 0, 0],
                ['password', 'ArGp', 'TEXT', 0, 0, 0],
                ['binary', 'ArGB', 'bool', 0, 0, 0],
                ['via_firewall', 'ArGF', 'TEXT', 0, 0, 0],
                ['path', 'FTPc', 'TEXT', 0, 0, 0],
                ['host', 'FTPh', 'TEXT', 0, 0, 0],
                ['user', 'ArGU', 'TEXT', 0, 0, 0],
                ]},

If we put in those parameters in order, we get:

  #!perl -wl
  use Mac::Glue::Anarchie_Pro;
  my $a = new Mac::Glue::Anarchie_Pro;

  $a->store('Bourque:Desktop Folder:1.html',
    '1.html', undef, undef, 'pudge@pobox.com',
    0, undef, '/pub/', 'host', 'anonymous');

And it works perfectly on my machine.  I undef'ed the parameters I did not
care about.  I am thinking about offering named parameters:

  $a->store($file, {name=>'file.html', path=>'/pub/', host=>'host'});

In the meantime, one would have to use undef for the parameters you don't
want to deal with, or reorganize the parameters to something more
reasonable, like this:

    'store'   => {'class' => 'Arch', 'event' => 'Stor', 'params' => [
                ['----', keyDirectObject(), 'alis', 1, 0, 0, 1],
                ['host', 'FTPh', 'TEXT', 0, 0, 0],
                ['path', 'FTPc', 'TEXT', 0, 0, 0],
                ['name', 'pnam', 'TEXT', 0, 0, 0],
                ['url', 'ArUR', 'TEXT', 0, 0, 0],
                ['user', 'ArGU', 'TEXT', 0, 0, 0],
                ['password', 'ArGp', 'TEXT', 0, 0, 0],
                ['binary', 'ArGB', 'bool', 0, 0, 0],
                ['via_firewall', 'ArGF', 'TEXT', 0, 0, 0],
                ['via_socks', 'ArGS', 'TEXT', 0, 0, 0],
                ]},

I might be able to put them into a more reasonable order in the first
place; I need to have another look at that.

Anyways, the glue is designed right now so you just pass simple scalar
values in the order the (virtual) method expects them, and then sit back
and watch it go.

Oh, and a BTW/FYI/FWIW: Mac::Apps::Anarchie is a module on CPAN and on my
site which is more stable and tested and works just fine, and in a similar
fashion.  I use it regularly with no problem with Anarchie Pro (for the
past couple weeks, anyway).  So if you have an immediate need for this and
don't want to mess with the glue stuff, you can use that module.


>BTW, there's a bug in glue_me.dp. If the application name has "()"
>characters in it, such as "MacCVSPro 2.1b2 (Fat)" the perl droplet will
>blowaway the app and write the Glue file into the same name. Ooops.

Yikes!  Thanks (and sorry :-),

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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