Commits

Shlomi Fish committed 30fd8f6

Add the select(FILEHANDLE) item.

  • Participants
  • Parent commits 362d4ba

Comments (0)

Files changed (2)

File lib/sgml/shlomif-docbook/xsl-5-stylesheets/shlomif-db5-xhtml-mydocbook.xsl

 <xsl:template match="d:article" priority="1">
     <xsl:call-template name="id.warning"/>
 
-    <xsl:element name="{$div.element}" namespace="http://www.w3.org/1999/xhtml">
+    <div>
         <xsl:call-template name="common.html.attributes">
             <xsl:with-param name="inherit" select="1"/>
         </xsl:call-template>
-        <xsl:call-template name="id.attribute">
-            <xsl:with-param name="conditional" select="0"/>
-        </xsl:call-template>
+        <xsl:if test="$generate.id.attributes != 0">
+            <xsl:attribute name="id">
+                <xsl:call-template name="object.id"/>
+            </xsl:attribute>
+        </xsl:if>
 
         <xsl:call-template name="article.titlepage"/>
 
 
         <xsl:apply-templates select="*[not(@role = 'introduction')]"/>
         <xsl:call-template name="process.footnotes"/>
-    </xsl:element>
+    </div>
 </xsl:template>
-
 </xsl:stylesheet>
 

File src/tutorials/bad-elements/perl-elements-to-avoid.xml-grammar-vered.xml

 </p>
 
 </item>
+<item xml:id="select_filehandle">
+<info>
+<title>Using select($file_handle)</title>
+</info>
+<p>
+One should not use <pdoc_f f="select" />’s <code>select($file_handle)</code>
+syntax to set the “currently selected filehandle” because this will affect
+all subsequent uses by such functions as <pdoc_f f="print" /> and is a
+sure-fire way to confuse the maintenance programmer. Instead, use
+<cpan_self_mod m="IO::Handle" /> and its methods. For example:
+</p>
+
+<bad_code syntax="perl">
+my $old_fh = select(STDERR);
+$| = 1; # Set -&gt;autoflush()
+select($old_fh);
+</bad_code>
+
+<p>
+should be instead written as:
+</p>
+
+<code_blk syntax="perl">
+use IO::Handle;
+STDERR->autoflush(1);
+</code_blk>
+
+<p>
+The second syntax of <code>select()</code> which tries to see which file
+handles or sockets are active is of more valid use, but note that for a
+simple delay, one should use <cpan_self_mod m="Time::HiRes" /> and otherwise,
+there are some more efficient platform-specific methods to do that such as
+<cpan_self_mod m="IO::Epoll" /> for Linux or kqueue for FreeBSD, which are
+abstracted by event-driven programming frameworks on CPAN.
+</p>
+
+</item>
 <item xml:id="non_recommended_regex_vars">
 <info>
 <title>Non-Recommended Regular Expression-related Variables</title>