AMF-Perl

 view release on metacpan or  search on metacpan

lib/AMF/Perl/App/Executive.pm  view on Meta::CPAN

=head2 Sun Mar 23 13:27:00 EST 2003

=over 4

=item Synching with AMF-PHP:

=item Replaced packagepath, packagename, packageConstruct with classpath, classname, classConstruct.

=item Added _instanceName, _origClassPath and _headerFilter.

=item Added subs setHeaderFilter(), setInstanceName()

=item Renamed setClassPath to setTarget and removed extra junk from that function.

=item Eliminated _getPackage() and _getMethod().

=item Removed safeExecution().

=back

=head2 Tue Mar 11 21:59:27 EST 2003

=item Passing @$a instead of $a to user functions. $a always is an array.

=cut


use strict;
use AMF::Perl::Util::RemotingService;


#The above variable declarations are not needed, as hash keys are used. They are useful just for the comments.
# the directory which should be used for the basic packages default "../"
# my $_basecp = "../";
# the classpath which is the path of the file from $_basecp
#my $_classpath;
# the string name of the package derived from the classpath
#my $_classname;
# the object we build from the package
#my $_classConstruct;
# the method to execute in the construct
#my $_methodname;
# the defined return type
#my $_returnType;
# the instance name to use for this gateway executive
#my $_instanceName;
# the list with registered service-packagees
#my $services = {};
# The original incoming classpath
#my $_target;
# The original classpath
#my $_origClassPath;
# switch to take different actions based on the header
#my $_headerFilter;
        
# constructor
sub new
{
    my ($proto)=@_;
    my $self={};
    bless $self, $proto;
    return $self;
    # nothing really to do here yet?
}


# setter for the _headerFilter
sub setHeaderFilter 
{
    my ($self, $header) = @_;
    $self->{_headerFilter} = $header;
}

# Set the base classpath. This is the path from which will be search for the packagees and functions
# $basecp should end with a "/";
sub setBaseClassPath
{
    my ($self, $basecp) = @_; 
    $self->{_basecp} = $basecp; 
}

sub setInstanceName
{  
    my ($self, $name) = @_; 
    $self->{_instanceName} = $name;
}

# you pass directory.script.method to this and it will build
# the classpath, classname and methodname values
sub setTarget
{
    my ($self, $target)=@_;
    $self->{target} = $target;
    # grab the position of the last . char
    my $lpos = strrpos($target, ".");
    # there were none
    unless ($lpos) 
    {
        print STDERR "Service name $target does not contain a dot.\n";
        # throw an error because there has to be atleast 1
    } 
    else
    {
        # the method name is the very last part
        $self->{_methodname} = substr($target, $lpos+1);
    }
    # truncate the method name from the string
    my $trunced = substr($target, 0, $lpos);
    
    $self->{_classname} = $trunced;
}

sub registerService
{
    my ($self, $package, $servicepackage) = @_;
    $self->{services}->{$package} = $servicepackage;
}

# returns the return type for this method
sub getReturnType
{



( run in 1.181 second using v1.01-cache-2.11-cpan-39bf76dae61 )