App-Context

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

configure_requires:
    ExtUtils::MakeMaker:  0
build_requires:
    ExtUtils::MakeMaker:  0
requires:
    App::Options:         0.01
    CGI:                  0.01
    CGI::Carp:            0.01
    Class::Data::Inheritable:  0.01
    Compress::Zlib:       0.01
    Data::Dumper:         0.01
    Date::Format:         0.01
    Date::Parse:          0.01
    Devel::StackTrace:    0.01
    Digest::SHA:          0.01
    Exception::Class:     0.01
    HTTP::Status:         0.01
    IO::Handle:           0.01
    IO::Socket:           0.01
    IO::Socket::INET:     0.01
    MIME::Base64:         2.1

Makefile.PL  view on Meta::CPAN

    "DISTNAME"    => "App-Context",
    "VERSION"     => "0.968",
    "EXE_FILES"   => [ @programs ],
    "PREREQ_PM"   => {
        # "Apache"                             => "0.01",  # used for mod_perl integration
        "App::Options"                       => "0.01",  # for loading a startup configuration file
        "CGI"                                => "0.01",  # tbd
        "CGI::Carp"                          => "0.01",  # tbd
        "Class::Data::Inheritable"           => "0.01",  # [prereq for Exception::Class]
        "Compress::Zlib"                     => "0.01",  # for compressed serialization and browser responses
        "Data::Dumper"                       => "0.01",  # used for debugging
        "Date::Parse"                        => "0.01",  # date support
        "Date::Format"                       => "0.01",  # date support
        "Devel::StackTrace"                  => "0.01",  # [prereq for Exception::Class]
        "Digest::SHA"                        => "0.01",  # tbd
        "Exception::Class"                   => "0.01",  # allows exception hierarchies
        "HTTP::Status"                       => "0.01",  # tbd
        "IO::Handle"                         => "0.01",  # tbd
        "IO::Socket"                         => "0.01",  # tbd
        "IO::Socket::INET"                   => "0.01",  # tbd
        "MIME::Base64"                       => "2.1",   # used for turning binary (serialized?) data into text (Sessions)

lib/App/Conf.pm  view on Meta::CPAN

    * Throws:    App::Exception
    * Since:     0.01

    Sample Usage: 

    $conf = $context->conf();
    print $conf->dump(), "\n";

=cut

use Data::Dumper;

sub dump {
    my ($self) = @_;
    my %copy = %$self;
    delete $copy{context};   # don't dump the reference to the context itself
    my $d = Data::Dumper->new([ \%copy ], [ "conf" ]);
    $d->Indent(1);
    return $d->Dump();
}

1;

lib/App/Conf.pod  view on Meta::CPAN


App::Conf - Load and access configuration data

=head1 SYNOPSIS

   use App::Conf;

   $config = App::Conf->new();
   $config = App::Conf->new("file" => $file);
   $config = App::Conf->new("file" => $file, "configClass" => "App::Conf::XML");
   print $config->dump(), "\n";       # use Data::Dumper to spit out the Perl representation

   # accessors
   $property_value = $config->get($property_name);
   $branch = $config->get_branch($branch_name);  # get hashref of properties

   # on-demand loading helper methods (private methods)
   $config->overlay($config2);        # merge the two config structures using overlay rules
   $config->overlay($config1, $config2);  # merge $config2 onto $config1
   $config->graft($branch_name, $config2);  # graft new config structure onto branch

lib/App/Conf.pod  view on Meta::CPAN


=head2 Requirements

The following are enumerated requirements for the Conf Class Group.
It forms a high-level feature list. 
The requirements which have been satisfied
(or features implemented) have an "x" by them, whereas the requirements
which have yet-to-be satisfied have an "o" by them.

    x Read from many different file formats including...
        x Pure perl (Data::Dumper format)
        o Unvalidated XML
        o Validated XML
        o Validated RDF
        o Windows ini file
        o Java-style properties
        o customized
    x Support fetching configuration from completely customized source
    o Allow config to be split into multiple files/sources
        o Load various portions of the config tree on-demand
        o Overlay configs on top of each other

lib/App/Conf/File.pod  view on Meta::CPAN

=head1 NAME

App::Conf::File - Load and access configuration data

=head1 SYNOPSIS

   use App::Conf;

   $config = App::Conf->new();
   $config = App::Conf->new(configFile => $file);
   print $config->dump(), "\n";       # use Data::Dumper to spit out the Perl representation

   # accessors
   $property_value = $config->get($property_name);
   $branch = $config->get_branch($branch_name);  # get hashref of properties

   # on-demand loading helper methods (private methods)
   $config->overlay($config2);        # merge the two config structures using overlay rules
   $config->overlay($config1, $config2);  # merge $config2 onto $config1
   $config->graft($branch_name, $config2);  # graft new config structure onto branch

lib/App/Context.pm  view on Meta::CPAN

    * Return:    $perl      text
    * Throws:    App::Exception
    * Since:     0.01

    Sample Usage: 

    print $self->dump(), "\n";

=cut

use Data::Dumper;

sub dump {
    my ($self) = @_;
    my $d = Data::Dumper->new([ $self ], [ "context" ]);
    $d->Indent(1);
    return $d->Dump();
}

#############################################################################
# PROTECTED METHODS
#############################################################################

=head1 Protected Methods

lib/App/Reference.pm  view on Meta::CPAN

=head1 NAME

App::Reference - a Perl reference, blessed so it can be accessed with methods

=head1 SYNOPSIS

   use App::Reference;

   $ref = App::Reference->new();
   $ref = App::Reference->new("file" => $file);
   print $ref->dump(), "\n";   # use Data::Dumper to spit out the Perl representation

   # accessors
   $property_value = $ref->get($property_name);
   $branch = $ref->get_branch($branch_name,$create_flag);  # get hashref
   $ref->set($property_name, $property_value);

   # on-demand loading helper methods (private methods)
   $ref->overlay($ref2);        # merge the two structures using overlay rules
   $ref->overlay($ref1, $ref2);  # merge $ref2 onto $ref1
   $ref->graft($branch_name, $ref2);  # graft new structure onto branch

lib/App/Reference.pm  view on Meta::CPAN

    * Throws:    App::Exception
    * Since:     0.01

    Sample Usage: 

    $ref = $context->config();
    print $ref->dump(), "\n";

=cut

use Data::Dumper;

sub dump {
    my ($self, $ref) = @_;
    $ref = $self if (!$ref);
    my $d = Data::Dumper->new([ $ref ], [ "ref" ]);
    $d->Indent(1);
    return $d->Dump();
}

#############################################################################
# print()
#############################################################################

=head2 print()

lib/App/Serializer.pm  view on Meta::CPAN

## $Id: Serializer.pm 6783 2006-08-11 17:43:28Z spadkins $
#############################################################################

package App::Serializer;
$VERSION = (q$Revision: 6783 $ =~ /(\d[\d\.]*)/)[0];  # VERSION numbers generated by svn

use App;
use App::Service;
@ISA = ( "App::Service" );

use Data::Dumper;
# use Compress::Zlib;
# use MIME::Base64;
# use Digest::HMAC_MD5;
# use Crypt::CBC;

use strict;

=head1 NAME

App::Serializer - Interface for serialization and deserialization

lib/App/Serializer.pm  view on Meta::CPAN

=cut

#############################################################################
# CLASS
#############################################################################

=head1 Class: App::Serializer

A Serializer serves to serialize and deserialize perl data structures
of arbitrary depth.
The base class serializes the data as Perl code using Data::Dumper.
(This behavior is overridden with customized serialization techniques
by the derived subclasses.)

 * Throws: App::Exception::Serializer
 * Since:  0.01

=head2 Class Design

The class is entirely made up of static (class) methods.
However, they are each intended to be

lib/App/Serializer.pm  view on Meta::CPAN

    $context = App->context();
    $serializer = $context->service("Serializer");  # or ...
    $serializer = $context->serializer();
    $data = $serializer->deserialize($serialized_data);
    print $serializer->dump($data), "\n";

=cut

sub dump {
    my ($self, $data) = @_;
    my $d = Data::Dumper->new([ $data ], [ "data" ]);
    $d->Indent(1);
    return $d->Dump();
}

#############################################################################
# PROTECTED METHODS
#############################################################################

=head1 Protected Methods:

lib/App/Serializer/Html.pm  view on Meta::CPAN

    $data = $serializer->deserialize($html);
    print $serializer->dump($data), "\n";

=head1 DESCRIPTION

A Serializer allows you to serialize a structure of data
of arbitrary depth to a scalar and deserialize it back to the
structure.

The Html serializer uses HTML data structure syntax as the serialized
form of the data.  It uses the Data::Dumper module from CPAN to perform
the deserialization and serialization.

=cut

sub serialize {
    &App::sub_entry if ($App::trace);
    my ($self, $perl_scalar) = @_;
    my $html = <<EOF;
<html>
<head>

lib/App/Serializer/Perl.pm  view on Meta::CPAN

    $data = $serializer->deserialize($perl);
    print $serializer->dump($data), "\n";

=head1 DESCRIPTION

A Serializer allows you to serialize a structure of data
of arbitrary depth to a scalar and deserialize it back to the
structure.

The Perl serializer uses perl data structure syntax as the serialized
form of the data.  It uses the Data::Dumper module from CPAN to perform
the deserialization and serialization.

=cut

use Data::Dumper;

sub serialize {
    my ($self, $data) = @_;
    my ($d, $perl);
    
    $d = Data::Dumper->new([ $data ], [ "data" ]);
    my $indent = $self->{indent};
    $indent = 1 if (!defined $indent);
    $d->Indent($indent);
    $perl = $d->Dump();

    return $perl;
}

sub deserialize {
    my ($self, $perl) = @_;

lib/App/Service.pm  view on Meta::CPAN

    * Return:    $guts     {}
    * Throws:    App::Exception
    * Since:     0.01

    $guts = $so->internals();
    App::Reference->print($guts);
    print App::Reference->dump($guts), "\n";

Copy the internals of the current SessionObject to a new hash and return
a reference to that hash for debugging purposes.  The resulting hash
reference may be printed using Data::Dumper (or App::Reference).
The refe

=cut

sub internals {
    &App::sub_entry if ($App::trace);
    my ($self) = @_;
    my %copy = %$self;
    delete $copy{context};
    delete $copy{dict};

lib/App/Service.pm  view on Meta::CPAN

    * Throws:    App::Exception
    * Since:     0.01

    Sample Usage: 

    $service = $context->repository();
    print $service->dump(), "\n";

=cut

use Data::Dumper;

sub dump {
    my ($self, $ref) = @_;
    my ($copy, $data, $name);
    if ($ref) {
        if (!ref($ref)) {
            $data = $ref;
            $name = "scalar";
        }
        elsif (ref($ref) eq "ARRAY") {

lib/App/Service.pm  view on Meta::CPAN

            $name = "hash";
        }
    }
    else {
        $copy = { %$self };
        $copy->{context} = "<removed>" if ($copy->{context});         # don't dump the reference to the context itself (Services)
        $copy->{_repository} = "<removed>" if ($copy->{_repository}); # don't dump the reference to the repository (RepositoryObjects)
        $data = [ $copy ];
        $name = $self->service_type() . "__" . $self->{name};
    }
    my $d = Data::Dumper->new($data, [ $name ]);
    $d->Indent(1);
    return $d->Dump();
}

#############################################################################
# print()
#############################################################################

=head2 print()

lib/App/Session.pm  view on Meta::CPAN

    * Throws:    App::Exception
    * Since:     0.01

    Sample Usage: 

    $session = $context->session();
    print $session->dump(), "\n";

=cut

use Data::Dumper;

sub dump {
    &App::sub_entry if ($App::trace);
    my ($self, $ref) = @_;
    $ref = $self if (!$ref);
    my %copy = %$ref;
    delete $copy{context};   # don't dump the reference to the context itself
    my $d = Data::Dumper->new([ \%copy ], [ "session" ]);
    $d->Indent(1);
    &App::sub_exit($d->Dump()) if ($App::trace);
    return $d->Dump();
}

sub print {
    my $self = shift;
    print $self->dump(@_);
}

lib/App/Session/Cookie.pm  view on Meta::CPAN


package App::Session::Cookie;
$VERSION = (q$Revision: 3666 $ =~ /(\d[\d\.]*)/)[0];  # VERSION numbers generated by svn

use App;
use App::Session;
@ISA = ( "App::Session" );

use strict;

use Data::Dumper;
use Storable qw(freeze thaw);
use Compress::Zlib;
use MIME::Base64 ();

# note: We may want to apply an HMAC (hashed message authentication code)
#       so that users cannot fiddle with the values.
#       We may also want to add IP address and timeout for security.
#       We may also want to add encryption so they can't even decode the data.
# use Digest::HMAC_MD5;
# use Crypt::CBC;

lib/App/Session/Cookie.pm  view on Meta::CPAN

            $endidx = $startidx+$maxvarlines-1;
            $endidx = $#sessiontext if ($endidx > $#sessiontext-1);
            $textchunk = join("",@sessiontext[$startidx .. $endidx]);
            $headers .= "Set-Cookie: app_sessiondata${i}=$textchunk$cookieoptions\n";
        }
        $self->{context}->set_header($headers);
    }

    if ($options && $options->{show_session}) {
        # Debugging Only
        my $d = Data::Dumper->new([ $sessiondata ], [ "sessiondata" ]);
        $d->Indent(1);
        $html .= "<!-- Contents of the session. (For debugging only. Should be turned off in production.)\n";
        $html .= $sessiontemp;
        $html .= $d->Dump();
        $html .= "-->\n";
    }

    $html;
}

lib/App/Session/HTMLHidden.pm  view on Meta::CPAN


package App::Session::HTMLHidden;
$VERSION = (q$Revision: 13887 $ =~ /(\d[\d\.]*)/)[0];  # VERSION numbers generated by svn

use App;
use App::Session;
@ISA = ( "App::Session" );

use strict;

use Data::Dumper;
use Storable qw(freeze thaw);
use Compress::Zlib;
use MIME::Base64;

# note: We may want to apply an HMAC (hashed message authentication code)
#       so that users cannot fiddle with the values.
#       We may also want to add IP address and timeout for security.
#       We may also want to add encryption so they can't even decode the data.
# use Digest::HMAC_MD5;
# use Crypt::CBC;

lib/App/Session/HTMLHidden.pm  view on Meta::CPAN

            $endidx = $#sessiontext if ($endidx > $#sessiontext-1);
            $textchunk = join("\n",@sessiontext[$startidx .. $endidx]);
            $html .= "\n<input type=\"hidden\" name=\"app.sessiondata${i}\" value=\"\n$textchunk\n\">";
        }
    }
    $html .= "\n";

    $options = $self->{context}->options();
    if ($options && $options->{show_session}) {
        # Debugging Only
        my $d = Data::Dumper->new([ $sessiondata ], [ "session_store" ]);
        $d->Indent(1);
        $html .= "<!-- Contents of the session. (For debugging only. Should be turned off in production.)\n";
        $html .= $d->Dump();
        $html .= "-->\n";
    }

    my $app = $options->{"app"};
    my $cookie_attribs = $options->{"app.Session.cookie_attribs"};
    if ($cookie_attribs) {
        my $cookiedata = {};

lib/App/installguide.pod  view on Meta::CPAN


See L<App::installguide::win32>.

=head1 INSTALL DEPENDENT SOFTWARE

=head2 Install Dependent Modules from CPAN

  perl -MCPAN -e shell
  cpan> install Date::Parse
  cpan> install Date::Format
  cpan> install Data::Dumper
  cpan> install Compress::Zlib
  cpan> install MIME::Base64
  cpan> install Storable
  cpan> install Exception::Class
  cpan> install Class::MethodMaker
  cpan> install Hook::LexWrap
  cpan> install Aspect
  cpan> exit

If anyone finds other dependent modules, please let me know.

lib/App/installguide.pod.ota  view on Meta::CPAN


Install it as appropriate.  Then become root ("su - root") and use the CPAN
shell to install a bunch of distributions that Business-Travel-OTA depends on.
Then install the Business-Travel-OTA distribution itself.

   perl -MCPAN -e shell
   cpan> install Module::Build
   cpan> install App::Build
   cpan> install App::Options
   cpan> install XML::Simple
   cpan> install Data::Dumper
   cpan> install LWP::UserAgent
   cpan> install SOAP::Lite
   cpan> install MIME::Entity
   cpan> install XML::XPath
   cpan> install Crypt::SSLeay
   cpan> install Business::Travel::OTA
   cpan> exit

Presumably you have Apache running on your machine.  If not, start it up or
install it.  You cannot run the OTA demo server without a web server.



( run in 0.639 second using v1.01-cache-2.11-cpan-4d50c553e7e )