--- nfo/perl/libs/Data/Rap.pm 2003/02/18 16:02:04 1.2 +++ nfo/perl/libs/Data/Rap.pm 2003/02/20 18:44:26 1.3 @@ -1,7 +1,12 @@ ## ------------------------------------------------------------------------- -## $Id: Rap.pm,v 1.2 2003/02/18 16:02:04 joko Exp $ +## $Id: Rap.pm,v 1.3 2003/02/20 18:44:26 joko Exp $ ## ------------------------------------------------------------------------- ## $Log: Rap.pm,v $ +## Revision 1.3 2003/02/20 18:44:26 joko +## renamed modules +## + sub find_rules: attempts to find 'rap.xml' +## + updated documentation: added SYNOPSIS +## ## Revision 1.2 2003/02/18 16:02:04 joko ## +- renamed module ## @@ -38,6 +43,23 @@ And then: +=head1 SYNOPSIS + + my $rap = Data::Rap->new( target => 'sync-core' ); + $rap->start(); + + print Dumper($rap); + + print Dumper($rap->get_property('/')); + + print Dumper($rap->get_property('.')); + print Dumper($rap->get_property('global')); + print Dumper($rap->get_property('app')); + print Dumper($rap->get_property('app.config')); + print Dumper($rap->get_property('app.config.preboot')); + print Dumper($rap->get_property('app.config.databases.oefcore')); + + =head1 Overview =head2 Rap - Request And Process @@ -55,6 +77,10 @@ - OEF::Component::Task - make "old" shortcut programs like "feed.pl", "tell.pl" and such obsolete - add more targets in order to make "setup.pl" & Co. obsolete as well + - some new concepts (perly): + - namespaces + - plugins + - contexts =head3 It's using these fine modules from CPAN @@ -73,14 +99,17 @@ =head3 Rap does networking - - It's a client. (cli program, standalone) - - It's a server/daemon as well. (cli interacts with daemon via tcp-socket) + x It's a client. (cli program, standalone) + (->Command-Frontends: rap.pl) + o It's a server/daemon as well. (cli interacts with daemonized engine via tcp-socket) + (->Command-Frontends: rap.pl --remote|--host=) =head3 Rap is open for enhancements and/or integration into/with other stuff =head4 Command-Frontends (local and/or remote) + x rap.pl o Commands can be sent via psh (The Perl Shell) or similar frontends (via rap.pl or Rap.pm) o Commands can be issued from a php-frontend (via RPC using Rap::) @@ -121,16 +150,29 @@ use base qw( DesignPattern::Object DesignPattern::Bridge - Log::Dispatch::Config::Object + DesignPattern::Logger + DesignPattern::Exception ); use Data::Dumper; +use Cwd; +use File::Spec::Functions qw( splitpath splitdir catpath catdir ); sub constructor { my $self = shift; - $self->load([qw( Metadata Engine Property Command )]); + + # patch + $self->{__rap}->{filename} = $self->{filename}; + delete $self->{filename}; + + # check + if (!$self->{__rap}->{filename}) { + $self->{__rap}->{filename} = $self->find_rules(); + } + + $self->load([qw( Metadata Engine Command Context Property )]); #$self->load("Command"); #$self->load("Metadata"); #$self->load("Engine"); @@ -149,8 +191,18 @@ $self->log("target: $target", 'info'); $self->performTarget($target); } else { - my $meta_raw = $self->readXmlOverview(); - #print Dumper($meta_raw); + my $meta_raw = $self->getTargetList(); + + foreach my $entry (@$meta_raw) { + print " - rap.pl $entry->{name}", "\n"; + print $entry->{description}, "\n" if $entry->{description}; + } + + return; + + print Dumper($meta_raw); + exit; + foreach my $key (keys %{$meta_raw->{target}}) { my $target = $meta_raw->{target}->{$key}; print " - rap.pl $key", "\n"; @@ -168,5 +220,20 @@ } +sub find_rules { + my $self = shift; + my $cwd = cwd(); + + (my $volume, my $directory, my $file) = splitpath( $cwd ); + my @dir = splitdir($directory); + pop @dir; + #pop @dir; + my $base = catpath($volume, catdir(@dir)); + + my $rap_xml = "$base/etc/rap.xml"; + return $rap_xml; +} + + 1; __END__