Agent-TCLI

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Control.pm  view on Meta::CPAN

#					? $self->parameters->{ $attr }->show_method
#					: '';
#				$self->Verbose("show attr($attr) ref($ref) show($show)",1);
#				# simple scalar
#				if ( not $ref)
#				{
#					$txt .= "$attr: ".$self->$attr." \n";
#					$code = 200;
#				}
#				# is it an object and show_method is defined?.
#				elsif ( $ref =~ qr(::) && blessed( $self->$attr )
#					&& $show )
#				{
#					$txt .= "$attr: ".$self->$attr->$show."\n";
#					$code = 200;
#				}
#				# is it an object with dump? Probably OIO.
#				elsif ( $ref =~ qr(::) && blessed($self->$attr)
#					&& $self->$attr->can( 'dump') )
#				{
#					$var = $self->$attr->dump(0);
#					$txt .= Dump($var)."\n";
#					$code = 200;
#				}
#				elsif ( $ref =~ qr(HASH) )
#				{
#					foreach my $key ( sort keys %{$self->$attr} )
#					{
#						my $subref = ref($self->$attr->{ $key }   );
#						$self->Verbose("show key($key) subref($subref)",0);
#						# simple scalar
#						if ( not $subref )
#						{
#							$txt .= "$attr ->{ $key }: ".$self->$attr->{$key}." \n";
#							$code = 200;
#						}
#						# is it an object and show_method is defined?.
#						elsif ( $subref =~ qr(::) &&
#							blessed($self->$attr->{ $key }) &&
#							defined($show) )
#						{
#							$txt .= "$attr: ".$self->$attr->{$key}->$show."\n";
#							$code = 200;
#						}
#						# is it an object with dump? Probably OIO.
#						elsif ( $subref =~ qr(::) &&
#							blessed($self->$attr->{ $key }) &&
#							$self->$attr->{ $key }->can( 'dump') )
#						{
#							$var = $self->$attr->{$key}->dump(0);
#							$txt .= Dump($var)."\n";
#							$code = 200;
#						}
#						# some other object, array or hash
#						else
#						{
#							$var = $self->$attr->{$key};

lib/Agent/TCLI/Control.pm  view on Meta::CPAN

#					{
#						my $subref = ref( $val );
#						# simple scalar
#						if ( not $subref )
#						{
#							$txt .= "$attr ->[ $i ]: ".$val." \n";
#							$code = 200;
#						}
#						# is it an object and show_method is defined?.
#						elsif ( $subref =~ qr(::) &&
#							blessed($val) &&
#							defined($show) )
#						{
#							$txt .= "$attr: ".$val->$show."\n";
#							$code = 200;
#						}
#						# is it an object with dump? Probably OIO.
#						elsif ( $subref =~ qr(::) &&
#							blessed($val) &&
#							$val->can( 'dump') )
#						{
#							$var = $val->dump(0);
#							$txt .= Dump($var)."\n";
#							$code = 200;
#						}
#						# some other object, array or hash
#						else
#						{
#							$txt .= Dump($val)."\n";

lib/Agent/TCLI/Package/Base.pm  view on Meta::CPAN

=head1 INTERFACE

=cut

use warnings;
use strict;
use Carp;
use Object::InsideOut qw(Agent::TCLI::Base);

use POE;
use Scalar::Util  qw(blessed looks_like_number);
use Getopt::Lucid;
use YAML::Syck;
use XML::Simple;
use File::ShareDir;
#use FormValidator::Simple;

$YAML::Syck::Headless = 1;
$YAML::Syck::SortKeys = 1;

our $VERSION = '0.030.'.sprintf "%04d", (qw($Id: Base.pm 62 2007-05-03 15:55:17Z hacker $))[2];

lib/Agent/TCLI/Package/Base.pm  view on Meta::CPAN

					? $self->parameters->{ $attr }->show_method
					: '';
				$self->Verbose("show attr($attr) ref($ref) show($show)",1);
				# simple scalar
				if ( not $ref)
				{
					$txt .= "$attr: ".$self->$attr." \n";
					$code = 200;
				}
				# is it an object and show_method is defined?.
				elsif ( $ref =~ qr(::) && blessed( $self->$attr )
					&& $show )
				{
					$txt .= "$attr: ".$self->$attr->$show."\n";
					$code = 200;
				}
				# is it an object with dump? Probably OIO.
				elsif ( $ref =~ qr(::) && blessed($self->$attr)
					&& $self->$attr->can( 'dump') )
				{
					$var = $self->$attr->dump(0);
					$txt .= Dump($var)."\n";
					$code = 200;
				}
				elsif ( $ref =~ qr(HASH) )
				{
					foreach my $key ( sort keys %{$self->$attr} )
					{
						my $subref = ref($self->$attr->{ $key }   );
						$self->Verbose("show key($key) subref($subref)",0);
						# simple scalar
						if ( not $subref )
						{
							$txt .= "$attr ->{ $key }: ".$self->$attr->{$key}." \n";
							$code = 200;
						}
						# is it an object and show_method is defined?.
						elsif ( $subref =~ qr(::) &&
							blessed($self->$attr->{ $key }) &&
							defined($show) )
						{
							$txt .= "$attr: ".$self->$attr->{$key}->$show."\n";
							$code = 200;
						}
						# is it an object with dump? Probably OIO.
						elsif ( $subref =~ qr(::) &&
							blessed($self->$attr->{ $key }) &&
							$self->$attr->{ $key }->can( 'dump') )
						{
							$var = $self->$attr->{$key}->dump(0);
							$txt .= Dump($var)."\n";
							$code = 200;
						}
						# some other object, array or hash
						else
						{
							$var = $self->$attr->{$key};

lib/Agent/TCLI/Package/Base.pm  view on Meta::CPAN

					{
						my $subref = ref( $val );
						# simple scalar
						if ( not $subref )
						{
							$txt .= "$attr ->[ $i ]: ".$val." \n";
							$code = 200;
						}
						# is it an object and show_method is defined?.
						elsif ( $subref =~ qr(::) &&
							blessed($val) &&
							defined($show) )
						{
							$txt .= "$attr: ".$val->$show."\n";
							$code = 200;
						}
						# is it an object with dump? Probably OIO.
						elsif ( $subref =~ qr(::) &&
							blessed($val) &&
							$val->can( 'dump') )
						{
							$var = $val->dump(0);
							$txt .= Dump($var)."\n";
							$code = 200;
						}
						# some other object, array or hash
						else
						{
							$txt .= Dump($val)."\n";

lib/Agent/TCLI/Package/Base.pm  view on Meta::CPAN

    	);

	$self->Verbose("AddCommand: adding $name command dump ".$commands[$$self]{ $name }->dump(1),3);

	# Parameters were just stubs. Put in proper references.
	if ( defined( $commands[$$self]{ $name }->parameters ) )
	{
		foreach my $paramkey ( keys %{ $commands[$$self]{ $name }->parameters } )
		{
			if ( exists( $parameters[$$self]->{ $paramkey } ) &&
				blessed($parameters[$$self]->{ $paramkey }) =~ qr(Parameter) )
			{
				$commands[$$self]{ $name }->parameters->{ $paramkey } =
					$parameters[$$self]->{ $paramkey };
			}
			else # All this is just for helping to debug problems easier
			{
				$self->Verbose("AssCommand: $name Parameter '$paramkey' not defined. Dumping",0 );
				foreach my $parameter ( %{$parameters[$$self]} )
				{
					if ( blessed($parameter) )
					{
						$self->Verbose( $parameter->dump(1),0 );
					}
					else
					{
						$self->Verbose( $parameter,0 );
					}
				}

				croak("AddCommand: $name Parameter '$paramkey' not defined")



( run in 0.424 second using v1.01-cache-2.11-cpan-de7293f3b23 )