r8249 - in /branches/upstream/libnet-cups-perl/current: CUPS.xs Changes MANIFEST README examples/ examples/list_dests.pl examples/print_file.pl lib/Net/CUPS.pm lib/Net/CUPS/Destination.pm lib/Net/CUPS/IPP.pm lib/Net/CUPS/PPD.pm

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Sat Oct 13 20:53:32 UTC 2007


Author: tincho-guest
Date: Sat Oct 13 20:53:32 2007
New Revision: 8249

URL: http://svn.debian.org/wsvn/?sc=1&rev=8249
Log:
[svn-upgrade] Integrating new upstream version, libnet-cups-perl (0.55)

Added:
    branches/upstream/libnet-cups-perl/current/examples/
    branches/upstream/libnet-cups-perl/current/examples/list_dests.pl   (with props)
    branches/upstream/libnet-cups-perl/current/examples/print_file.pl   (with props)
Modified:
    branches/upstream/libnet-cups-perl/current/CUPS.xs
    branches/upstream/libnet-cups-perl/current/Changes
    branches/upstream/libnet-cups-perl/current/MANIFEST
    branches/upstream/libnet-cups-perl/current/README
    branches/upstream/libnet-cups-perl/current/lib/Net/CUPS.pm
    branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/Destination.pm
    branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/IPP.pm
    branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/PPD.pm

Modified: branches/upstream/libnet-cups-perl/current/CUPS.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/CUPS.xs?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/CUPS.xs (original)
+++ branches/upstream/libnet-cups-perl/current/CUPS.xs Sat Oct 13 20:53:32 2007
@@ -105,13 +105,19 @@
 
 void
 NETCUPS_getDestination( name )
-		const char* name;
+		char* name;
 	PPCODE:
 		cups_dest_t * destinations = NULL;
 		cups_dest_t * destination = NULL;
 		int count = 0;
 		SV* rv = NULL;
 		count = cupsGetDests( &destinations );
+		/* If we have a NULL for destination name, then we are going 
+           to assume we want the default. */
+		if( !strlen( name ) )
+		{
+			name = cupsGetDefault();
+		}
 		destination = cupsGetDest( name, NULL, count, destinations );
 		rv = sv_newmortal();
 		sv_setref_pv( rv, "Net::CUPS::Destination", destination );
@@ -253,7 +259,7 @@
 		}
 		XSRETURN( count );
 
-HV*
+SV*
 NETCUPS_getJob( dest, jobid )
 		const char* dest;
 		int jobid;
@@ -262,7 +268,8 @@
 		int count = 0;
 		HV* hv = NULL;
 		cups_job_t* jobs = NULL;
-		RETVAL = NULL;
+		char *tstate = NULL;
+		RETVAL = &PL_sv_undef;
 		count = cupsGetJobs( &jobs, dest, 0, -1 );
 		for( loop = 0; loop < count; loop++ )
 		{
@@ -302,10 +309,13 @@
 						  strlen( "processing_time" ),
 						  newSVnv( jobs[loop].processing_time ), 0 );
 
-
 				hv_store( hv, "size",
 						  strlen( "size" ),
 						  newSViv( jobs[loop].size ), 0 );
+
+				hv_store( hv, "state",
+						  strlen( "state" ),
+						  newSViv( jobs[loop].state ), 0 );
 
 				hv_store( hv, "title",
 						  strlen( "title" ),
@@ -317,7 +327,58 @@
 						  newSVpv( jobs[loop].user, 
 								   strlen( jobs[loop].user ) ), 0 );
 
-				RETVAL = hv;
+				switch( jobs[loop].state ) 
+				{
+					case IPP_JOB_PENDING:
+					{
+							tstate = "pending";
+							break;
+					}
+					case IPP_JOB_HELD:
+					{
+							tstate = "held";
+							break;
+					}
+					case IPP_JOB_PROCESSING:
+					{
+							tstate = "processing";
+							break;
+					}
+					case IPP_JOB_STOPPED:
+					{
+							tstate = "stopped";
+							break;
+					}
+					/* CANCELLED is not a TYPO! (Well, it is, but it
+ 					   is not my fault! */
+					case IPP_JOB_CANCELLED:
+					{
+							tstate = "canceled";
+							break;
+					}
+					case IPP_JOB_ABORTED: 
+					{
+							tstate = "aborted";
+							break;
+					}
+					case IPP_JOB_COMPLETED: 
+					{
+							tstate = "completed";
+							break;
+					}
+					default: 
+					{
+							tstate = "unknown";
+							break;
+					}
+				}
+
+				hv_store( hv, "state_text",
+						  strlen( "state_text" ),
+						  newSVpv( tstate, 
+								   strlen( tstate ) ), 0 );
+
+				RETVAL = newRV((SV*)hv);
 			}
 		}
 	OUTPUT:

Modified: branches/upstream/libnet-cups-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/Changes?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/Changes (original)
+++ branches/upstream/libnet-cups-perl/current/Changes Sat Oct 13 20:53:32 2007
@@ -1,4 +1,13 @@
 Revision history for Perl extension Net::CUPS.
+
+0.55 Tue Oct 09 20:46:58 2007
+	- Fixed a segfault in getJobs [Sven-Haegar Koch]
+	- The job hash from getJobs now returns the state!
+	- Added a human readable state to the job hash [Sven-Haegar Koch]
+	- Added basic examples of Net::CUPS operations.
+	- The method getDestination() will attempt to get the default
+	  destination on the server if a destination is not provided.
+
 0.51 Wed Mar 14 10:35:16 2007
 	- Attempt to rework the DESTROY method for Net::CUPS::Destination for
       a bug reported by Graham Jenkins <graham at vpac.org>

Modified: branches/upstream/libnet-cups-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/MANIFEST?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-cups-perl/current/MANIFEST Sat Oct 13 20:53:32 2007
@@ -1,17 +1,19 @@
-t/02_cups.t
-t/01_use.t
+Changes
+CUPS.xs
+examples/list_dests.pl
+examples/print_file.pl
+fallback/const-c.inc
+fallback/const-xs.inc
+lib/Net/CUPS/Destination.pm
+lib/Net/CUPS/IPP.pm
 lib/Net/CUPS.pm
 lib/Net/CUPS/PPD.pm
-lib/Net/CUPS/Destination.pm
-lib/Net/CUPS/IPP.pm
+Makefile.PL
+MANIFEST
+packer.c
+ppport.h
+README
+t/01_use.t
+t/02_cups.t
+TODO
 typemap
-TODO
-CUPS.xs
-README
-fallback/const-xs.inc
-fallback/const-c.inc
-ppport.h
-Changes
-Makefile.PL
-packer.c
-MANIFEST

Modified: branches/upstream/libnet-cups-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/README?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/README (original)
+++ branches/upstream/libnet-cups-perl/current/README Sat Oct 13 20:53:32 2007
@@ -36,6 +36,11 @@
 Copyright (C) 2003-2005 D. Hageman <dhageman at dracken.com>
 Copyright (C) 2006-2007 Dracken Technology, Inc. (http://www.dracken.com/)
 
+SPECIAL THANKS
+
+Sven-Haegar Koch <haegar at sdinet.de> has graciously provided patches
+to fix issues and make improvements to Net::CUPS.
+
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself. 
 

Added: branches/upstream/libnet-cups-perl/current/examples/list_dests.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/examples/list_dests.pl?rev=8249&op=file
==============================================================================
--- branches/upstream/libnet-cups-perl/current/examples/list_dests.pl (added)
+++ branches/upstream/libnet-cups-perl/current/examples/list_dests.pl Sat Oct 13 20:53:32 2007
@@ -1,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+##
+##  This is an example of how to get all of the destinations on
+##  the default server.
+##
+
+use Net::CUPS;
+use Net::CUPS::Destination;
+
+{
+	my $cups = Net::CUPS->new();
+
+	my @destinations = $cups->getDestinations();
+
+	foreach( @destinations )
+	{
+		print $_->getName() ."\n";
+	}
+
+	exit( 0 );
+}

Propchange: branches/upstream/libnet-cups-perl/current/examples/list_dests.pl
------------------------------------------------------------------------------
    svn:executable = *

Added: branches/upstream/libnet-cups-perl/current/examples/print_file.pl
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/examples/print_file.pl?rev=8249&op=file
==============================================================================
--- branches/upstream/libnet-cups-perl/current/examples/print_file.pl (added)
+++ branches/upstream/libnet-cups-perl/current/examples/print_file.pl Sat Oct 13 20:53:32 2007
@@ -1,0 +1,30 @@
+#!/usr/bin/perl
+
+##
+## This is a *simple* example with minimal error checking of how to 
+## print a file.
+##
+
+use strict;
+use warnings;
+
+use Net::CUPS;
+use Net::CUPS::Destination;
+
+{
+	die( "Please give me the name of a file to print!\n" ) if ( @ARGV < 1 );
+	
+	my $filename = $ARGV[0];
+
+	my $cups = Net::CUPS->new();
+
+	my $dest = $cups->getDestination();
+
+	die( "You don't have a default printer setup!\n" ) if( !defined( $dest ) );
+
+	print "I am attempting to print $filename to " . $dest->getName() . ".\n";
+
+	$dest->printFile( $filename, "Net::CUPS Test Print!" );
+
+	exit( 0 );
+}

Propchange: branches/upstream/libnet-cups-perl/current/examples/print_file.pl
------------------------------------------------------------------------------
    svn:executable = *

Modified: branches/upstream/libnet-cups-perl/current/lib/Net/CUPS.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/lib/Net/CUPS.pm?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/lib/Net/CUPS.pm (original)
+++ branches/upstream/libnet-cups-perl/current/lib/Net/CUPS.pm Sat Oct 13 20:53:32 2007
@@ -959,7 +959,7 @@
 	PPD_VERSION
 );
 
-our $VERSION = '0.51';
+our $VERSION = '0.55';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()
@@ -1028,6 +1028,8 @@
 {
 	my( $self, $name ) = @_;
 
+	$name = "" if( !defined( $name ) );
+
 	return( NETCUPS_getDestination( $name ) );
 }
 

Modified: branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/Destination.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/Destination.pm?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/Destination.pm (original)
+++ branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/Destination.pm Sat Oct 13 20:53:32 2007
@@ -961,7 +961,7 @@
 	PPD_VERSION
 );
 
-our $VERSION = '0.51';
+our $VERSION = '0.55';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()

Modified: branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/IPP.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/IPP.pm?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/IPP.pm (original)
+++ branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/IPP.pm Sat Oct 13 20:53:32 2007
@@ -961,7 +961,7 @@
 	PPD_VERSION
 );
 
-our $VERSION = '0.51';
+our $VERSION = '0.55';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()

Modified: branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/PPD.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/PPD.pm?rev=8249&op=diff
==============================================================================
--- branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/PPD.pm (original)
+++ branches/upstream/libnet-cups-perl/current/lib/Net/CUPS/PPD.pm Sat Oct 13 20:53:32 2007
@@ -964,7 +964,7 @@
 	PPD_VERSION
 );
 
-our $VERSION = '0.51';
+our $VERSION = '0.55';
 
 sub AUTOLOAD {
     # This AUTOLOAD is used to 'autoload' constants from the constant()




More information about the Pkg-perl-cvs-commits mailing list