Changeset 1a64de6
- Timestamp:
- Jan 10, 2008, 5:22:46 PM (17 years ago)
- Branches:
- master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 65fea01
- Parents:
- 214b790
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perlwrap.pm
r74fc22a r1a64de6 558 558 package BarnOwl::Hook; 559 559 560 =head1 BarnOwl::Hook 561 562 =head1 DESCRIPTION 563 564 A C<BarnOwl::Hook> represents a list of functions to be triggered on 565 some event. C<BarnOwl> exports a default set of these (see 566 C<BarnOwl::Hooks>), but can also be created and used by module code. 567 568 =head2 new 569 570 Creates a new Hook object 571 572 =cut 573 560 574 sub new { 561 575 my $class = shift; 562 576 return bless [], $class; 563 577 } 578 579 =head2 run [ARGS] 580 581 Calls each of the functions registered with this hook with the given 582 arguments. 583 584 =cut 564 585 565 586 sub run { … … 568 589 return map {$_->(@args)} @$self; 569 590 } 591 592 =head2 add SUBREF 593 594 Registers a given subroutine with this hook 595 596 =cut 570 597 571 598 sub add { … … 576 603 } 577 604 605 =head2 clear 606 607 Remove all functions registered with this hook. 608 609 =cut 610 578 611 sub clear { 579 612 my $self = shift; … … 582 615 583 616 package BarnOwl::Hooks; 617 618 =head1 BarnOwl::Hooks 619 620 =head1 DESCRIPTION 621 622 C<BarnOwl::Hooks> exports a set of C<BarnOwl::Hook> objects made 623 available by BarnOwl internally. 624 625 =head2 USAGE 626 627 Modules wishing to respond to events in BarnOwl should register 628 functions with these hooks. 629 630 =head2 EXPORTS 631 632 None by default. Either import the hooks you need explicitly, or refer 633 to them with fully-qualified names. Available hooks are: 634 635 =over 4 636 637 =item $startup 638 639 Called on BarnOwl startup, and whenever modules are 640 reloaded. Functions registered with the C<$startup> hook get a true 641 argument if this is a reload, and false if this is a true startup 642 643 =item $shutdown 644 645 Called before BarnOwl shutdown 646 647 =item $receiveMessage 648 649 Called with a C<BarnOwl::Message> object every time BarnOwl appends a 650 new message to its message list 651 652 =item $mainLoop 653 654 Called on B<every pass> through the C<BarnOwl> main loop. Any 655 functions with this hook should be very cheap, as they are very 656 frequently by the runtime. 657 658 =item $getBuddyList 659 660 Called to display buddy lists for all protocol handlers. The result 661 from every function registered with this hook will be appended and 662 displayed in a popup window, with zephyr formatting parsed. 663 664 =back 665 666 =cut 584 667 585 668 use Exporter;
Note: See TracChangeset
for help on using the changeset viewer.