bowei_99 has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I'm writing a script to create and update a list of appletalk names of printers on our network. I know, it's an old protocol and has problems, but people like here like it for its convenience and ease of use. I found out I can gather a lot of information via snmp (e.g. using the SNMP module), but the appletalk information via snmp isn't always there.

As a result, I need some way to query the network for printers via appletalk, preferably a pure perl solution.

Has anybody done this kind of thing before? Is there a module I can use? I didn't find anything on cpan.

Replies are listed 'Best First'.
Re: Listing Appletalk printers in perl
by Aristotle (Chancellor) on Nov 09, 2005 at 01:54 UTC

    I googled appletalk client linux and found Linux Netatalk-HOWTO: Utilities, which mentions a couple utilities, some of which appear to be ones that are bundled with netatalk, and which look like they’ll do the job you need – though some appear not to be included? I can’t tell, and since I don’t have any use for netatalk and thus won’t install it, I can’t really check. Is that information outdated or does it help?

    Makeshifts last the longest.

      Yeah, that (nbplkup) seems to work. Would be nice to have a module that I could plug in, but since appletalk isn't used as much, it makes sense that I haven't found anything. Thanks.
Re: Listing Appletalk printers in perl
by bill_mcgonigle (Acolyte) on Nov 09, 2005 at 19:37 UTC
    Netatalk should have all the parts you need. Your kernel will need the ddp module loaded. In AppleTalk land, DDP is similar to UDP and most applications use it. ADSP came along later which is more like TCP but it wasn't entirely popular. But I digress....

    You're looking to do a NBP (Name Binding Protocol) lookup, the nomenclature will be something like "=:LaserWriter" and if you have EtherTalk Phase II Zones, "=:LaserWriter@*" or put your Zone names in by hand.

    Then once you know where the LaserWriters are, you can use PAP (Printer Access Protocol), pap(1), to send some PostScript commands at the printers to retrieve printer information.

    Last decade I wrote a perl script using the above tools to rename all the printers in a department for April Fool's. The names were exchanged so the prints came out, but not at the expected printer. Hilarity ensued. A dbm database was used to store the changes for easy reversion.
Re: Listing Appletalk printers in perl
by gain (Beadle) on Nov 10, 2005 at 14:50 UTC
    I haven't switched to Netatalk 2, but have been using Netatalk 1.x for years. I did something like this where I just wanted to count all the Appletalk devices on the network. I used the binary nbplkup from the Netatalk distribution to do it. Example from man page:
    example% nbplkup :LaserWriter Petoskey:LaserWriter 7942.129:218 Gloucester:LaserWriter 8200.188:186 Rahway:LaserWriter 7942.2:138 517 Center:LaserWriter 7942.2:132 ionia:LaserWriter 7942.2:136 Evil DEC from Hell:LaserWriter 7942.2:130 Hamtramck:LaserWriter 7942.2:134 Iron Mountain :LaserWriter 7942.128:250

    wagner (\@) bluegrassbox\.com