cvs: peardoc /en/core/pear/pear intro.xml

From: Date: Fri, 27 Aug 2004 10:17:43 +0000
Subject: cvs: peardoc /en/core/pear/pear intro.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-4788@lists.php.net to get a copy of this message
aidan Fri Aug 27 06:17:43 2004 EDT Modified files: /peardoc/en/core/pear/pear intro.xml Log: Fixed typos and added cdata tags http://cvs.php.net/diff.php/peardoc/en/core/pear/pear/intro.xml?r1=1.6&r2=1.7&ty=u Index: peardoc/en/core/pear/pear/intro.xml diff -u peardoc/en/core/pear/pear/intro.xml:1.6 peardoc/en/core/pear/pear/intro.xml:1.7 --- peardoc/en/core/pear/pear/intro.xml:1.6 Tue Jun 1 03:19:55 2004 +++ peardoc/en/core/pear/pear/intro.xml Fri Aug 27 06:17:43 2004 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry id="core.pear.pear.intro"> <refnamediv> <refname>Introduction</refname> @@ -50,8 +50,10 @@ instantiate your class with the "=&amp; new" operator like this: <programlisting role="php"> +<![CDATA[ $obj =&amp; new MyClass(); -</programlisting> +]]> + </programlisting> </para> <simpara> If you only use "= new", the object registered in PEAR's @@ -75,7 +77,7 @@ One of the design criteria of PEAR's errors is that it should not force a particular type of output on the user, it should be possible to handle errors without any output at all if that is - desirable. This makes it possible to handle errors gracefully, + desirable. This makes it possible to handle errors gracefully, also when your output format is different from HTML (for example WML or some other XML format). </simpara> @@ -88,7 +90,7 @@ <classname>PEAR_Error</classname>'s constructor, but all of the parameters are optional, and you can set up defaults for errors generated from each object based on the - <classname>PEAR</classname> class. See the <link + <classname>PEAR</classname> class. See the <link linkend="example.error1">PEAR error examples</link> for how to use it and the <classname>PEAR_Error</classname> reference for the full details. @@ -104,6 +106,7 @@ <example id="example.destructors"> <title>PEAR: emulated destructors</title> <programlisting role="php"> +<![CDATA[ require_once "PEAR.php"; class FileContainer extends PEAR @@ -152,8 +155,8 @@ // When the request is done and PHP shuts down, $fileobj's // "destructor" is called and updates the file on disk. - -</programlisting> +]]> + </programlisting> </example> <note> <simpara> @@ -180,6 +183,7 @@ <example id="example.error1"> <title>PEAR error example (1)</title> <programlisting role="php"> +<![CDATA[ function mysockopen($host = "localhost", $port = 8090) { $fp = fsockopen($host, $port, $errno, $errstr); @@ -191,9 +195,10 @@ $sock = mysockopen(); if (PEAR::isError($sock)) { - print "mysockopen error: ".$sock->getMessage()."&lt;BR>\n" + print "mysockopen error: ".$sock->getMessage()."\n"; } -</programlisting> +]]> + </programlisting> </example> </para> <simpara> @@ -215,6 +220,7 @@ <example id="example.error2"> <title>PEAR error example (2)</title> <programlisting role="php"> +<![CDATA[ class TCP_Socket extends PEAR { var $sock; @@ -235,9 +241,10 @@ $sock = new TCP_Socket; $sock->setErrorHandling(PEAR_ERROR_DIE); -$sock->connect("localhost", 8090); -print "still alive&lt;BR>\n"; -</programlisting> +$sock->connect('localhost', 8090); +print "still alive\n"; +]]> + </programlisting> </example> </para> <simpara> @@ -276,8 +283,10 @@ method like this: <informalexample> <programlisting role="php"> +<![CDATA[ PEAR::setErrorHandling(PEAR_ERROR_DIE); -</programlisting> +]]> + </programlisting> </informalexample> </para> </listitem> @@ -298,8 +307,10 @@ method like this: <informalexample> <programlisting role="php"> +<![CDATA[ PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_ERROR); -</programlisting> +]]> + </programlisting> </informalexample> </para> </listitem> @@ -324,8 +335,10 @@ method like this: <informalexample> <programlisting role="php"> +<![CDATA[ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "my_error_handler"); -</programlisting> +]]> + </programlisting> </informalexample> </para> <para> @@ -333,12 +346,14 @@ without specifying the callback function again: <informalexample> <programlisting role="php"> +<![CDATA[ PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "my_function_handler"); do_some_stuff(); PEAR::setErrorHandling(PEAR_ERROR_DIE); do_some_critical_stuff(); PEAR::setErrorHandling(PEAR_ERROR_CALLBACK); // now we're back to using my_function_handler again +]]> </programlisting> </informalexample> </para>

« previous php.pear.doc (#4788) next »