CPM

 view release on metacpan or  search on metacpan

lib/CPM.pm  view on Meta::CPAN

sub auto
{
   my $self=shift;
   my %properties=@_; # rest of params by hash
   my $verbose=0;
   $verbose=$properties{'-verbose'} if defined $properties{'-verbose'};
   if($self->{xml}->{id}->{comm} eq 'call')
   {
	print "Using CALL" if $verbose;
	if($self->{xml}->{id}->{mode} eq 'list')      
	{
		print " with a LIST\n" if $verbose;
		return $self->listandcall(-verbose=>$verbose);
	}
	else
	{
		print " and DISCOVERING\n" if $verbose;
		return $self->discoverandcall(-verbose=>$verbose);
	}
    }
    else
    {
	if($self->{xml}->{id}->{mode} ne 'list')
	{
		print "Discover and Email\n" if $verbose;
                return $self->discoverandmail(-verbose=>$verbose);
	}
	else
	{
                print "Using SMTP-auth from a fixed list and OIDs\n" if $verbose;	
	        return $self->listandmail(-verbose=>$verbose);
	}
    }
}


1;

__END__

=head1 NAME

CPM - Complete module to work with MyPrinterCloud System

=head1 SYNOPSIS

 use CPM;
 my $env=CPM->new();
 $env->auto(-verbose=>1);

=head1 DESCRIPTION

The CPM module manages the API of MyPrinterCloud, providing the subroutines to collect the information from the networked printers and to transmit it to CPS (Cloud Printing Server). It offers several options to accomplish key design criteria such as ...

=head1 FUNCTIONALITY

The CPM functionality is completely defined by its configuration file (config.xml) that acts also, as firmware of the module.

=head1 Configuration sample

The CPM needs a default configuration file that must be adjusted by the user, at least, including his credentials (valid user in MyPrinterCloud).

<?xml version="1.0" encoding="UTF-8"?>
  <opt call="http://myprintercloud.nubeprint.com/np/selector.pl" proxy="" >
    <id comm="call" 
        date="2010-09-10"
        mode="discover"
        pass="xxx"
        type="soft-public"
        user="demo@nubeprint.com"
    />
    <range from="105" to="115" lan=""/>
  </opt>

=head2 ID section

=over 3
 
=item comm [email,call]: it defines the communication method

=item mode [discover,list]: set if the CPM must discover the network or only collect data from the printers previously identified in a list

=item user: email account valid on the CPS or MyPrinterCloud

=item pass: password of a valid user of the CPS or MyPrinterCloud

=item type: optional

=item date: date when the configuration file was built by the CPS.

=back

=head2 Communication channel 

Communication with the CPS accepts two different forms depending on the needs of the destination network. Also, note that although there are two mechanisms you can activate only one per CPM.

=head3 Call

This method is based on the HTTP standard, which operates in real time and is bidirectional. That allows the CPM apply the latest set of OIDs to be queried for a particular machine. Although an HTTP connection is needed, it is a very efficient soluti...

<call="http://myprintercloud.nubeprint.com/np/selector.pl"/>

=head3 Email

This method is based on the SMTP standard with Auth support. When it's activated, the CPM collects all the information from the networked printers, composes a summary email, and sends it to the CPS. Obviously it is not bidirectional, nor in real-time...

<mail pass="yyy" smtp="myprintercloud.com" user="aaa@myprintercloud.com"/>

=head2 Modes

=head3 Discover

If this method is enabled, the CPM discovers all the networked printers and for each one, it will request information to the CPS (if it's already registered, its model, the set of OIDs, ...). The CPM auto-detects the local net in order to make a scan...

=head4 Range

The default discover behaviour can be modified specifying the local range and the subnet in where the CPM should scan. By default the CPM assumes the local net and from 1 to 254.

<range from="105" to="110" lan="192.168.2.0"/>

=head3 List

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.799 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )