[svn:PHP-Sandwich] rev 1423 - in PHP-Sandwich/trunk: lib/PHP lib/PHP/Interpreter t

[email protected] 29 Jul 2005 23:17:42 -0000
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
Author: theory
Date: Fri Jul 29 16:17:42 2005
New Revision: 1423

Added:
   PHP-Sandwich/trunk/t/pod.t
   PHP-Sandwich/trunk/t/pod_coverage.t
Modified:
   PHP-Sandwich/trunk/lib/PHP/Interpreter.pm
   PHP-Sandwich/trunk/lib/PHP/Interpreter/Class.pm
Log:
Doc tweaks. Gave George credit. Added POD tests. Does PHP::Interpreter::Class need documentation?

Modified: PHP-Sandwich/trunk/lib/PHP/Interpreter.pm
==============================================================================
--- PHP-Sandwich/trunk/lib/PHP/Interpreter.pm	(original)
+++ PHP-Sandwich/trunk/lib/PHP/Interpreter.pm	Fri Jul 29 16:17:42 2005
@@ -4,18 +4,10 @@ package PHP::Interpreter;
 
 PHP::Interpreter - An embedded PHP5 interpreter
 
-=head1 VERSION
-
-1.0
-
-=head1 DATE
-
-$LastChangedDate$
-
 =head1 SYNOPSIS
 
   use PHP::Interpreter;
-  
+
   my $p = PHP::Interpreter->new();
   $p->include("some_php_include.php");
 
@@ -23,7 +15,7 @@ $LastChangedDate$
 
 =head1 DESCRIPTION
 
-This class encapsulates an embedded PHP5 intepreter.  It provides 
+This class encapsulates an embedded PHP5 intepreter.  It provides
 proxy methods (via AUTOLOAD) to all the functions declared in the
 PHP interpreter, transparent conversion of Perl datatypes to PHP
 (and vice-versa), and the ability for PHP to similarly call Perl
@@ -34,8 +26,6 @@ running PHP code and Perl code side-by-s
 
 =cut
 
-
-
 require DynaLoader;
 
 use strict;
@@ -61,185 +51,147 @@ sub AUTOLOAD {
 
 __END__
 
-=head1 METHODS
+=head1 INTERFACE
 
 =head2 Constructor
 
-=over 4
+=head3 new
 
-=item my $php = PHP::Interpreter->new( $init );
+  my $php = PHP::Interpreter->new( $init );
 
-Instantiates a PHP::Interpreter object, and creates an associated PHP interpreter instance.  An 
-anonymous hash of initial values may be passed.  The supported initial value keys are:
+Instantiates a PHP::Interpreter object, and creates an associated PHP
+interpreter instance. An anonymous hash of initial values may be passed. The
+supported initial value keys are:
 
 =over 4
 
-=item *
+=item * GET
 
-GET - An array ref that will be installed in the PHP $_GET autoglobal array.
+An array ref that will be installed in the PHP $_GET autoglobal array.
 
-=item *
+=item * POST
 
-POST - An array ref that will be installed in the PHP $_POST autoglobal array.
+An array ref that will be installed in the PHP $_POST autoglobal array.
 
-=item *
+=item * COOKIE
 
-COOKIE - An array ref that will be installed in the PHP $_COOKIE autoglobal array.
+An array ref that will be installed in the PHP $_COOKIE autoglobal array.
 
-=item *
+=item * SERVER
 
-SERVER - An array ref that will be installed in the PHP $_SERVER autoglobal array.
+An array ref that will be installed in the PHP $_SERVER autoglobal array.
 
-=item *
+=item * ENV
 
-ENV - An array ref that will be installed in the PHP $_ENV autoglobal array.
+An array ref that will be installed in the PHP $_ENV autoglobal array.
 
-=item *
+=item * FILES
 
-FILES - An array ref that will be installed in the PHP $_FILES autoglobal array.
+An array ref that will be installed in the PHP $_FILES autoglobal array.
 
-=item *
+=item * OUTPUT
 
-OUTPUT - Change the output handler.  By default, any data sent to STDOUT in PHP will be
-redirected to STDOUT in Perl.  If OUTPUT is a scalar reference, then instead output
-will be appended to that scalar reference.  If OUTPUT is a coderef, then whenever PHP
-emits data, that coderef will be called with the output fragment as its argument. 
+Change the output handler. By default, any data sent to STDOUT in PHP will be
+redirected to STDOUT in Perl. If OUTPUT is a scalar reference, then instead
+output will be appended to that scalar reference. If OUTPUT is a coderef, then
+whenever PHP emits data, that coderef will be called with the output fragment
+as its argument.
 
-=item *
+=item * INCLUDE_PATH
 
-INCLUDE_PATH - A string that overides PHP's include_path ini setting.
+A string that overides PHP's include_path ini setting.
 
 =item *
 
-Any other data that is passed will be installed in the PHP global symbol table.  So for instance
-if you set:
+Any other data that is passed will be installed in the PHP global symbol
+table. So for instance if you set:
 
-  $php = PHP::Interpreter( BRIC => { 'element' => $e, 'session' => $s } );
+  $php = PHP::Interpreter( BRIC => { element => $e, session => $s } );
 
-Then PHP will create the globally scoped $BRIC array with the keys 'element' and 'session', pointing
-at the appropriately converted or wrapped Perl variables $e and $s.
+Then PHP will create the globally scoped $BRIC array with the keys 'element'
+and 'session', pointing at the appropriately converted or wrapped Perl
+variables $e and $s.
 
 =back
 
-=head2 Public Class Methods
+=head2 Instance Methods
 
 =head3 eval()
 
-=over
- 
-=item $php->eval(q^ echo "hello world!\n"; ^);
+  $php->eval(q^ echo "hello world!\n"; ^);
+  my $rv = $php->eval("return file_get_contents($some_url);");
 
-=item my $rv = $php->eval("return file_get_contents($some_url);");
-
-Executes the PHP code passed to it, returning any value returned from the script, or true.  
-
-B<Throws:>
-
-=over 4
- 
-=item *
-
-PHP Error in eval
-
-=back 4
-
-=back 
+Executes the PHP code passed to it, returning any value returned from the
+script, or true. Throw an exception on failure.
 
 =head3 include()
 
-=over
-
-=item $php->include("somePhpFile.php");
-
-Calls the PHP construct include on the specified file (similar to Perl's 'use').  
-
-B<Throws:>
-
-=over 4
-
-=item * 
-
-Error including (...)
+  $php->include("somePhpFile.php");
 
-=back 4
-
-=back
+Calls the PHP construct include on the specified file (similar to Perl's
+C<use> keyword). Throws an exception on failure.
 
 =head3 call()
 
-=over
-
-=item $rv = $php->call('stroupper', $perlVar);
-
-Calls the PHP function specified by the first argument, passing the remaining arguments as
-parameters.  Returns the converted return value of the function back into Perl.
-
-B<Throws:>
-
-=over 4
-
-=item *
-
-A PHP error occured
-
-=back 4
-
-=back
-
-=head3 set_output_hander()
-
-=over
+  $rv = $php->call(stroupper => $perlVar);
 
-=item my $old_hander = $php->set_output_handler(\$scalar);
+Calls the PHP function specified by the first argument, passing the remaining
+arguments as parameters. Returns the converted return value of the function
+back into Perl. Throws an exception if an error is encountered.
 
-=item my $old_hander = $php->set_output_handler(\&func);
+=head3 set_output_handler()
 
+  my $old_hander = $php->set_output_handler(\$scalar);
+  $old_hander = $php->set_output_handler(\&func);
 
-Set a new output handler, either a scalar reference or a coderef.
-
-=back
+Sets a new output handler, either a scalar reference or a coderef.
 
 =head3 get_output()
 
-=over
-
-=item my $outbuf = $php->get_output();
-
+  my $outbuf = $php->get_output;
 
-If the output buffer is a scalar reference, this will return it's current contents.
-
-=back
+If the output buffer is a scalar reference, this method will return it's
+current contents.
 
 =head3 clear_output()
 
-=over
+  my $outbuf = $php->clear_output;
 
-=item my $outbuf = $php->clear_output();
+If the output buffer is a scalar reference, this method will set it to an
+empty string.
 
+=head3 instantiate()
 
-If the output buffer is a scalar reference, this will set it to an empty string.
+  my $instance = $php->instantiate('stdClass', @args);
 
-=back
+Creates and returns an instance of the specified PHP class. Any additional
+arguments are passed to the object's constructor.
 
-=head3 instantiate()
+=head3 AUTOLOAD
 
-=over
+  my $retval = $php->strtoupper($string);
 
-=item my $instance = $php->instantiate('stdClass', @args);
+An C<AUTOLOAD> method allows PHP::Interpreter to call arbitrary PHP functions
+without using call(). Internally, this is identical to
 
+  $php->call('method', @args);
 
-Create and return an instance of the specified PHP class.  Any additional args are passed to the object''s constructor.
+The C<AUTOLOAD>-generated method will be cached for future calls to the
+same PHP method.
 
-=back
+=head1 BUGS
 
-=head3 AUTOLOAD
+Please send bug reports to <[email protected]>.
 
-=over
+=head1 AUTHORS
 
-=item my $retval = $php->strtoupper($string);
+George Schlossnagle <[email protected]>
 
-An AUTOLOAD function is provided to allow PHP::Interpreter to call arbitrary PHP functions without using call().  Internally, this is identical to 
+=head1 COPYRIGHT AND LICENSE
 
-$php->call('method', @args);
+Copyright (c) 2005 Kineticode, Inc. All Rights Reserved.
 
-=back
+This module is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut

Modified: PHP-Sandwich/trunk/lib/PHP/Interpreter/Class.pm
==============================================================================
--- PHP-Sandwich/trunk/lib/PHP/Interpreter/Class.pm	(original)
+++ PHP-Sandwich/trunk/lib/PHP/Interpreter/Class.pm	Fri Jul 29 16:17:42 2005
@@ -16,3 +16,42 @@ sub AUTOLOAD {
 1;
 
 __END__
+
+=head1 NAME
+
+PHP::Interpreter::Class - PHP interpreter classes
+
+=head1 DESCRIPTION
+
+See L<PHP::Interpreter|PHP::Interpreter>.
+
+=begin comment
+
+=head1 INTERFACE
+
+=head2 Constructors
+
+=head3 create
+
+Should there be any documentation of this module or its methods?
+
+=end comment
+
+=head1 BUGS
+
+Please send bug reports to <[email protected]>.
+
+=head1 AUTHORS
+
+George Schlossnagle <[email protected]>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (c) 2005 Kineticode, Inc. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
+
+

Added: PHP-Sandwich/trunk/t/pod.t
==============================================================================
--- (empty file)
+++ PHP-Sandwich/trunk/t/pod.t	Fri Jul 29 16:17:42 2005
@@ -0,0 +1,7 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Test::More;
+eval "use Test::Pod 1.20";
+plan skip_all => "Test::Pod 1.20 required for testing POD" if $@;
+all_pod_files_ok();

Added: PHP-Sandwich/trunk/t/pod_coverage.t
==============================================================================
--- (empty file)
+++ PHP-Sandwich/trunk/t/pod_coverage.t	Fri Jul 29 16:17:42 2005
@@ -0,0 +1,11 @@
+#!perl -w
+
+# $Id: pod-coverage.t 977 2004-12-17 17:30:37Z theory $
+
+use strict;
+use Test::More;
+eval "use Test::Pod::Coverage 1.06";
+plan skip_all => "Test::Pod::Coverage 1.06 required for testing POD coverage"
+  if $@;
+
+all_pod_coverage_ok();