Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8513/OpenInteract2
Modified Files:
Observer.pm
Log Message:
cosmetic
Index: Observer.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Observer.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Observer.pm 18 Mar 2005 04:09:48 -0000 1.4
--- Observer.pm 21 Sep 2005 04:08:53 -0000 1.5
***************
*** 33,36 ****
--- 33,38 ----
}
}
+
+ # barely documented: Allow registration of objects...
elsif ( my $observer_obj = $observer_info->{object} ) {
my $error = $class->_require_module( $observer_obj );
***************
*** 48,51 ****
--- 50,55 ----
}
}
+
+ # barely documented: Allow registration of coderefs...
elsif ( my $observer_sub = $observer_info->{sub} ) {
$observer_sub =~ /^(.*)::(.*)$/;
***************
*** 229,238 ****
# You can also declare the observer in your package's package.conf
# file; it's mapped the same no matter where it's declared
! # File: pkg/mypackage-2.00/package.conf
! name mypackage
! version 2.00
! author Kilroy (ki...@wa...)
! observer allcaps OpenInteract2::Filter::AllCaps
# Create the filter -- see OpenInteract2::Filter::AllCaps shipped
--- 233,247 ----
# You can also declare the observer in your package's package.conf
# file; it's mapped the same no matter where it's declared
! # File: pkg/mypackage-2.00/package.ini
! [package]
! name = mypackage
! version = 2.00
! author = Kilroy (ki...@wa...)
!
! [package observer]
! allcaps = OpenInteract2::Filter::AllCaps
!
! ...
# Create the filter -- see OpenInteract2::Filter::AllCaps shipped
***************
*** 264,269 ****
Most observers react to one or two types of events. For instance, if
! you're using the C<delicious_tags> package there's an observer that
! looks like this:
sub update {
--- 273,278 ----
Most observers react to one or two types of events. For instance, if
! you're using the C<object_tags> package there's an observer that looks
! like this:
sub update {
***************
*** 390,415 ****
Most of the time you'll register an observer name with a class. The
following registers two observers to classes under the names 'wiki'
! and 'delicious_tag':
[observer]
wiki = OpenInteract2::Observer::Wikify
! delicious_tag = OpenInteract2::Observer::AddDeliciousTags
!
! This standard usage is actually a shortcut for:
!
! [observer wiki]
! class = OpenInteract2::Observer::Wikify
!
! [observer delicious_tag]
! class = OpenInteract2::Observer::AddDeliciousTags
!
! Or more generically:
!
! [observer observer-name]
! observation-type = value
! In addition to assigning class observers register a particular
! subroutine or object instance. The three observation types are
! 'class', 'object' and 'sub' (see
L<Class::Observable|Class::Observable> for what these mean and how
they are setup), so you could have:
--- 399,411 ----
Most of the time you'll register an observer name with a class. The
following registers two observers to classes under the names 'wiki'
! and 'object_tag':
[observer]
wiki = OpenInteract2::Observer::Wikify
! object_tag = OpenInteract2::Observer::AddObjectTags
! In addition to assigning class observers you can also register a
! particular subroutine or object instance. The three observation types
! are 'class', 'object' and 'sub' (see
L<Class::Observable|Class::Observable> for what these mean and how
they are setup), so you could have:
***************
*** 421,426 ****
sub = OpenInteract2::FooFilter::other_sub
! Using the object is fairly rare and you should probably use the class observer for
! its simplicity.
=head2 Configuration: Mapping the Observer to an Action
--- 417,422 ----
sub = OpenInteract2::FooFilter::other_sub
! Using the object is fairly rare and you should probably use the class
! observer for its simplicity.
=head2 Configuration: Mapping the Observer to an Action
***************
*** 429,438 ****
C<$WEBSITE_DIR/conf/observer.ini>. Under the 'map' section you assign
an observer to one or more actions. Here as assign the observer 'wiki'
! to 'news' and 'page' and 'delicious_tag' to 'news':
[map]
wiki = news
wiki = page
! delicious_tag = news
Note that the mapping is ignorant of:
--- 425,440 ----
C<$WEBSITE_DIR/conf/observer.ini>. Under the 'map' section you assign
an observer to one or more actions. Here as assign the observer 'wiki'
! to 'news' and 'page' and 'object_tag' to 'news':
[map]
wiki = news
wiki = page
! object_tag = news
!
! You could also use the standard INI-shortcuts for lists:
!
! [map]
! @,wiki = news,page
! object_tag = news
Note that the mapping is ignorant of:
***************
*** 456,459 ****
--- 458,463 ----
L<Class::Observable>
+ L<OpenInteract2::Setup::InitializeObservers>
+
=head1 COPYRIGHT
|