---
name: "Zoidberg::Fish"
section: "3pm"
platform: "linux"
package: "zoidberg"
version: "0.96-1"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Zoidberg::Fish"
---

# Zoidberg::Fish(3pm)

Base class for loadable Zoidberg plugins

## NAME

Zoidberg::Fish - Base class for loadable Zoidberg plugins

## SYNOPSIS

```
  package My_Zoid_Plugin;
  use base 'Zoidberg::Fish';
```

```
  FIXME some example code
```

## DESCRIPTION

Once this base class is used your module smells like fish -- Zoidberg WILL eat it. It supplies stub methods for hooks and has some routines to simplefy the interface to Zoidberg. One should realize that the bases of a plugin is not the module but the config file. Any module can be used as plugin as long as it's properly configged. The **developer manual** should describe this in more detail.

FIXME update the above text

## METHODS

- "new($shell, $zoidname)"

  Simple constructor that bootstraps same attributes. When your module smells like fish Zoidberg will give it's constructor two arguments, a reference to itself and the name by which your module is identified. From this all other config can be deducted.

  ```
          # Default attributes created by this constructor:
  ```

  ```
          $self->{shell}     # a reference to the parent Zoidberg object
          $self->{zoidname}  # name by which your module is identified
          $self->{settings}  # reference to hash with global settings
          $self->{config}    # hash with plugin specific config
  ```

- "init()"

  To be overloaded, will be called directly after the constructor.  Do things you normally do in the constructor like loading files, opening sockets  or setting defaults here.

- "config()"

  - "shell()"

  These methods return a reference to the attributes by the same name.

- "plug()"

  A stub doing absolutely nothing, but by calling it from a dispatch table the plugin is loaded.

- "unplug()"

  Removes this plugin from the various dispatchtables, and deletes the object.

- "broadcast($event\_name, @\_)"

  Broadcast an event to whoever might be listening.

- "add\_events({ event =\> sub { .. } })"

  - "add\_events(qw/event1 event2/)"

  Used to add new event hooks. In the second form the events are hooked to call the likely named subroutine in the current object.

- "wipe\_events(qw/event1 event2/)"

  Removes an event. Wipes the stacks for the named events of all routines belonging to this plugin.

- "add\_commands({ command =\> sub { .. } })"

  - "add\_commands(qw/command1 command2/)"

  Used to add new builtin commands. In the second form the commands are hooked to call the likely named subroutine in the current object.

- "wipe\_commands(qw/command1 command2/)"

  Removes a command. Wipes the stacks for the named commands of all routines belonging to this plugin.

- "add\_expansion(regex\_ref =" sub { ... })\>

  TODO

- "wipe\_expansions()"

  TODO

- "add\_context(%config)"

  See man zoiddevel(1) for the context configuration details.

- "ask($question, $default)"

  Get interactive input. The default is optional. If the default is either 'Y' or 'N' a boolean value is returned.

- "round\_up()"

  Is called when the plugin is unloaded or when a sudden DESTROY occurs. To be overloaded, do things like saving files or closing sockets here.

## AUTHOR

R.L. Zwart, \<rlzwart@cpan.org\>

Jaap Karssenberg ⎪⎪ Pardus \[Larus\] \<pardus@cpan.org\>

Copyright (c) 2002 Raoul L. Zwart. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

## SEE ALSO

Zoidberg, Zoidberg::Shell, Zoidberg::Utils, \<http://zoidberg.sourceforge.net\>
