ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ." ¤‡ú*õ'VŽ|¼´Úgllº¼klz[Æüï÷Aób‡Eÿ dÑ»Xx9ÃÜ£ÁT/`¼¸vI±Ýµ·Ë‚“G³þ*Ÿû´r|*}<¨îºœ @¦mÄ’M¹”.œ«Y–|6ÏU¤jç¥ÕÞqO ˜kDÆÁ¨5ÿ š;ÐЦ¦€GÙk \ –Þ=â¼=SͧµªS°ÚÍpÜãQűÀõ¬?ÃÁ1Ñ•õZà?hóœ€ L¦l{Y*K˜Ù›zc˜–ˆâ ø+¾ ­-Ök¥%ùEÜA'}ˆ><ÊIè“bpÍ/qÞâvoX€w,\úªò6Z[XdÒæ­@Ö—€$òJí#é>'°Ú ôª˜<)4ryÙ£|óAÅn5žêŸyÒäMÝ2{"}‰–¤l÷ûWX\l¾Á¸góÉOÔ /óñB¤f¸çñ[.P˜ZsÊË*ßT܈§QN¢’¡¨§V¼(Üù*eÕ“”5T¨‹Âê¥FŒã½Dü[8'Ò¥a…Ú¶k7a *•›¼'Ò·\8¨ª\@\õ¢¦íq+DÙrmÎ…_ªæ»ŠÓœ¡¯’Ré9MÅ×D™lælffc+ŒÑ,ý™ÿ ¯þǤ=Å’Á7µ÷ÚÛ/“Ü€ñýã¼àí¾ÕÑ+ƒ,uµMâÀÄbm:ÒÎPæ{˜Gz[ƒ¯«® KHà`ߨŠéí¯P8Aq.C‰ à€kòpj´kN¶qô€…Õ,ÜNŠª-­{Zö’æû44‰sŽè‰îVíRœÕm" 6?³D9¡ÇTíÅꋇ`4«¸ÝÁô ï’ýorqКÇZ«x4Žâéþuïf¹µö[P ,Q£éaX±`PÉÍZ ¸äYúg üAx ’6Lê‚xÝÓ*äQ  Ï’¨hÍ =²,6ï#rÃ<¯–£»ƒ‹,–ê•€ aÛsñ'%Æ"®ÛüìBᝠHÚ3ß°©$“XnœÖ’î2ËTeûìxîß ¦å¿çÉ ðK§þ{‘t‚Ϋ¬jéîZ[ ”š7L¥4VÚCE×]m¤Øy”ä4-dz£œ§¸x.*ãÊÊ b÷•h:©‡¦s`BTÁRû¾g⻩‹jø sF¢àJøFl‘È•Xᓁà~*j¯ +(ÚÕ6-£¯÷GŠØy‚<Ç’.F‹Hœw(+)ÜÜâÈzÄäT§FߘãÏ;DmVœ3Àu@mÚüXÝü•3B¨òÌÁÛ<·ÃÜ z,Ì@õÅ·d2]ü8s÷IôÞ¯^Ç9¢u„~ëAŸï4«M? K]­ÅàPl@s_ p:°¬ZR”´›JC[CS.h‹ƒïËœ«Æ]–÷ó‚wR×k7X‰k›‘´ù¦=¡«‰¨¨Â')—71ó’c‡Ðúµ `é.{§p¹ój\Ž{1h{o±Ý=áUÊïGÖŒõ–-BÄm+AZX¶¡ ïHðæ¥JmÙ;…䡟ˆ¦ ° äšiÉg«$üMk5¤L“’çÊvïâï ,=f“"íἊ5ô¬x6{ɏžID0e¸vçmi'︧ºð9$ò¹÷*£’9ÿ ²TÔ…×>JV¥}Œ}$p[bÔ®*[jzS*8 ”·T›Í–ñUîƒwo$áè=LT™ç—~ô·¤ÈÚ$榍q‰„+´kFm)ž‹©i–ËqÞŠ‰à¶ü( ‚•§ •°ò·‡#5ª•µÊ﯅¡X¨šÁ*F#TXJÊ ušJVÍ&=iÄs1‚3•'fý§5Ñ<=[íÞ­ PÚ;ѱÌ_~Ä££8rÞ ²w;’hDT°>ÈG¬8Á²ÚzŽ®ò®qZcqJêäÞ-ö[ܘbň±çb“ж31²n×iƒðÕ;1¶þÉ ªX‰,ßqÏ$>•î íZ¥Z 1{ç൵+ƒÕµ¥°T$§K]á»Ûï*·¤tMI’ÂZbŽÕiÒ˜}bÓ0£ª5›¨ [5Ž^ÝœWøÂÝh° ¢OWun£¤5 a2Z.G2³YL]jåtì”ä ÁÓ‘%"©<Ôúʰsº UZvä‡ÄiÆÒM .÷V·™ø#kèýiíÌ–ª)µT[)BˆõÑ xB¾B€ÖT¨.¥~ð@VĶr#¸ü*åZNDŽH;âi ],©£öØpù(šºãö¼T.uCê•4@ÿ GÕÛ)Cx›®0ø#:ÏðFÒbR\(€€Ä®fã4Þ‰Fä¯HXƒÅ,†öEÑÔÜ]Öv²?tLÃvBY£ú6Êu5ÅAQ³1‘’¬x–HŒÐ‡ ^ ¸KwJôÖŽ5×CÚ¨vÜ«/B0$×k°=ðbÇ(Ï)w±A†Á† 11Í=èQšµ626ŒÜ/`G«µ<}—-Ö7KEHÈÉðóȤmݱû±·ø«Snmá=“䫚mݱŸ¡¶~ó·“äUóJæúòB|E LêŽy´jDÔ$G¢þÐñ7óR8ýÒ…Ç› WVe#·Ÿ p·Fx~•ݤF÷0Èÿ K¯æS<6’¡WШ; ´ÿ ¥Êø\Òuî†åÝ–VNœkÒ7oòX¨Á­Ø÷FÎÑä±g÷ÿ M~Çî=p,X´ ÝÌÚÅ‹’ÃjÖ.ØöÏñ qïQ¤ÓZE†° =6·]܈ s¸>v•Ž^Ý\wq9r‰Î\¸¡kURÒ$­*‹Nq?Þª*!sŠÆ:TU_u±T+øX¡ ®¹¡,ÄâÃBTsÜ$Ø›4m椴zÜK]’’›Pƒ @€#â˜`é¹=I‡fiV•Ôî“nRm+µFPOhÍ0B£ €+¬5c v•:P'ÒyÎ ‰V~‚Ó†ÖuókDoh$å\*ö%Ю=£«…aȼ½÷Û.-½VŒŠ¼'lyî±1¬3ó#ÞE¿ÔS¤gV£m›=§\û"—WU¤ÚǼÿ ÂnÁGŒÃ ‚õN D³õNÚíŒÕ;HôyÄÈ©P¹Ä{:?R‘Ô¨âF÷ø£bÅó® JS|‚R÷ivýáâ€Æé¡è³´IئÑT!§˜•ت‚¬â@q€wnïCWÄ@JU€ê¯m6]Ï:£âx'+ÒðXvÓ¦Úm=–´7œ $ì“B£~p%ÕŸUþ« N@¼üï~w˜ñø5®—'Ôe»¤5ã//€ž~‰Tþ›Å7•#¤× Íö pÄ$ùeåì*«ÓŠEØWEÈsßg ¦ûvžSsLpºÊW–âµEWöˬH; ™!CYõZ ÃÄf æ#1W. \uWâ\,\Çf j’<qTbên›Î[vxx£ë 'ö¨1›˜ÀM¼Pÿ H)ƒêêŒA7s,|F“ 꺸k³9Ìö*ç®;Ö!Ö$Eiž•¹ÒÚ†ýóéÝû¾ÕS®ó$’NÝäŸz¤5r¦ãÄÃD÷Üø!°ø‡Ô&@m™Ì^Ãä­d q5Lnÿ N;.6½·N|#ä"1Nƒx“ã<3('&ñßt  ~ªu”1Tb㫨9ê–›–bìd$ߣ=#ÕãÒmU¯eí$EFù5ýYô櫨æì™Ç—±ssM]·á¿0ÕåJRÓªîiƒ+O58ÖñªŠÒx" \µâá¨i’¤i —Ö ” M+M¤ë9‚‰A¦°Qõ¾ßøK~¼Ã‘g…Ö´~÷Ï[3GUœÒ½#…kàÔ®Ò”‰³·dWV‰IP‰Ú8u¹”E ÖqLj¾êÕCBš{A^Âß;–¨`¯¬ìö ˼ ×tìø.tƐm*n¨y4o&Àx¥n¦×î‡aupáÛj8¿m›è¶ã!o½;ß0y^ý×^EÑ¿ÒjzŒ­)vÚÑnÄL …^ªô× ‡—‚3k Îý­hï]içå–îÏ*÷ñþ»Ô CÒjøjÍznˆ´ ¹#b'Fô‹ ‰v¥'’à'T´ƒHýÍ%M‰ ƒ&ÆÇŒï1 ‘ –Þ ‰i¬s žR-Ÿ kЬá¬7:þ 0ŒÅÒÕ/aÙ¬ÃÝ#Úøœ ©aiVc‰. ¹¦ãµ” ›Yg¦›ÆÎýº°f³7ƒhá·¸­}&D9¡ÂsÉÙÞèŠõØàC™¨ñbFC|´Ü(ŸƒÚÒ-%»'a Ì¿)ËÇn¿úÿ ÞŽX…4ÊÅH^ôΑí@ù¹Eh¶“L8Çjù ¼ÎåVªóR©Ï5uà V4lZß®=€xÖŸ–ÑÈ ÷”¨°¾__yM1tÉ?uÆþIkÄgæ@þ[¢†°XÃJ£j·:nkÅ¢u ‘}âGzö­/IµèЬ¼48q¦F°ŽR¼=ûì{´¯RýicS ÕÛ íNtÍÙï£,w4rêì®»~x(©Uñ§#Ñ&œÕ¤>ÎåÍÓ9’Ö{9eV­[Öjâ²ãu]˜å2›qÑšÕJç0€sÄ|Êëè0튔bÁ>“{×_F`Ø©ºê:µä,v¤ðfc1±"«ÔÍän1#=· Âøv~H½ÐßA¾¿Ü€Óš]Õ; I¾÷ç‚Qi†î¹9ywÔKG˜áñ zQY—§ÃÕZ07§X‚ Áh;ÁM)iÌCH-¯T‘ë|A0{Ò½LÚ–TâÖkÜ’dÀ“rmm»”جPF³ÖcbE§T€ÒxKºû’Ó®7±²(\4ŽÃ¸Uu@j™yĵ;³µ!Á¢b.W¤=mõ´êµK k ¸K^ÜÛ#p*Ü14qkZç5ïë †°5Ï%ÍÛ<Õ¤×Ô¥ê†C Õ´¼ú$ƒÖ“”]Ù¬qÞÚ[4©ý!ûÏ—Áb쳐XµA¬â~`›Çr¸8ìùÝ䫦<>ä÷«?xs´ÇÑ /á;¹øüÊÈÙà{"@Žïzâ¬[âß‚ U_<ÇŸ½4èN˜ú61®qŠu ¦þF£»äJ_ˆÙÎ~ ÞAã–݄ϗrŠD;xTž‘ô`É«…suãO`?³à™ô Lý#Íc5öoæØ‚y´´÷«ZR§<&JÇ+éâô´€i!Àˆ0æAoàðLèÖ-2ŸõW.’t^–(KÁmHµV@xÜÇy®Ñø­â^:Ú3w· 7½¹°ñ¸â¹®:',«Mœ—n­Á+Ãbš LÈ‘ÄnRÓÅœ%¦²‰¨ùQ:¤f‚ "PÕtô¸…cæl…&˜Ú˜Ôkv‹ž+vŠ,=¢v­6—Xy*¥t£«<™:“aîϲ=¦6rO]XI¿Œ÷¤zÚ­›¶ 6÷”w\d ü~v®ˆÌk«^m<ÿ ¢‰Õ\)ùºŽ;… lîÙÅEŠ®cѾ@vnMÏ,¼“ñ•ŽBxðÃzãÇç%3ˆ"}Ù•Åî> BÉú;Ò]V+P˜F_´ßé> Øše|ï‡ÄOmFæÇ ãqÞ$/xÐx­z`ï9"œÜij‚!7.\Td…9M‡•iŽ‹¾‘50ÞŽn¥ß4ÉôO ¹*í^QêËÜÇÌ8=ާs‰'ÂëÙ«á%Pú[O †ÅP¯Vsް.‰,kc¶ ¬A9n˜XÎ-ÞšN["¹QÕ‰ƒMýÁߺXJæÍaLj¾×Ãmã¾ãÚ uñÒþåQô¦¥ /ÄUx:‚ÍÜ’ Đ©ØÝ3V¨‰ÕnÐ6ó*óúK­«…c ¯U òhsý­jóÔj#,ímŒRµ«lbïUTŒÑ8†Ä0œÏr`ð¡¬É Ї ë"À² ™ 6¥ f¶ ¢ÚoܱԷ-<Àî)†a¶ž'Ú»¨TXqØæ¶÷YÄHy˜9ÈIW­YÀuMFë ºÏ’AqÌ4·/Ú †ô'i$øä­=Ä Ý|öK×40è|È6p‘0§)o¥ctî§H+CA-“ xØ|ÐXАç l8íºð3Ø:³¤¬KX¯UÿÙ require 5.006; package Pod::Perldoc::ToMan; use strict; use warnings; use parent qw(Pod::Perldoc::BaseTo); use vars qw($VERSION); $VERSION = '3.28'; use File::Spec::Functions qw(catfile); use Pod::Man 2.18; # This class is unlike ToText.pm et al, because we're NOT paging thru # the output in our particular format -- we make the output and # then we run nroff (or whatever) on it, and then page thru the # (plaintext) output of THAT! sub SUCCESS () { 1 } sub FAILED () { 0 } sub is_pageable { 1 } sub write_with_binmode { 0 } sub output_extension { 'txt' } sub __filter_nroff { shift->_perldoc_elem('__filter_nroff' , @_) } sub __nroffer { shift->_perldoc_elem('__nroffer' , @_) } sub __bindir { shift->_perldoc_elem('__bindir' , @_) } sub __pod2man { shift->_perldoc_elem('__pod2man' , @_) } sub __output_file { shift->_perldoc_elem('__output_file' , @_) } sub center { shift->_perldoc_elem('center' , @_) } sub date { shift->_perldoc_elem('date' , @_) } sub fixed { shift->_perldoc_elem('fixed' , @_) } sub fixedbold { shift->_perldoc_elem('fixedbold' , @_) } sub fixeditalic { shift->_perldoc_elem('fixeditalic' , @_) } sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) } sub name { shift->_perldoc_elem('name' , @_) } sub quotes { shift->_perldoc_elem('quotes' , @_) } sub release { shift->_perldoc_elem('release' , @_) } sub section { shift->_perldoc_elem('section' , @_) } sub new { my( $either ) = shift; my $self = bless {}, ref($either) || $either; $self->init( @_ ); return $self; } sub init { my( $self, @args ) = @_; unless( $self->__nroffer ) { my $roffer = $self->_find_roffer( $self->_roffer_candidates ); $self->debug( "Using $roffer\n" ); $self->__nroffer( $roffer ); } else { $self->debug( "__nroffer is " . $self->__nroffer() . "\n" ); } $self->_check_nroffer; } sub _roffer_candidates { my( $self ) = @_; if( $self->is_openbsd || $self->is_freebsd || $self->is_bitrig ) { qw( mandoc groff nroff ) } else { qw( groff nroff mandoc ) } } sub _find_roffer { my( $self, @candidates ) = @_; my @found = (); foreach my $candidate ( @candidates ) { push @found, $self->_find_executable_in_path( $candidate ); } return wantarray ? @found : $found[0]; } sub _check_nroffer { return 1; # where is it in the PATH? # is it executable? # what is its real name? # what is its version? # does it support the flags we need? # is it good enough for us? } sub _get_stty { `stty -a` } sub _get_columns_from_stty { my $output = $_[0]->_get_stty; if( $output =~ /\bcolumns\s+(\d+)/ ) { return $1 } elsif( $output =~ /;\s*(\d+)\s+columns;/ ) { return $1 } else { return 0 } } sub _get_columns_from_manwidth { my( $self ) = @_; return 0 unless defined $ENV{MANWIDTH}; unless( $ENV{MANWIDTH} =~ m/\A\d+\z/ ) { $self->warn( "Ignoring non-numeric MANWIDTH ($ENV{MANWIDTH})\n" ); return 0; } if( $ENV{MANWIDTH} == 0 ) { $self->warn( "Ignoring MANWIDTH of 0. Really? Why even run the program? :)\n" ); return 0; } if( $ENV{MANWIDTH} =~ m/\A(\d+)\z/ ) { return $1 } return 0; } sub _get_default_width { 73 } sub _get_columns { $_[0]->_get_columns_from_manwidth || $_[0]->_get_columns_from_stty || $_[0]->_get_default_width; } sub _get_podman_switches { my( $self ) = @_; my @switches = map { $_, $self->{$_} } grep !m/^_/s, keys %$self; # There needs to be a cleaner way to handle setting # the UTF-8 flag, but for now, comment out this # line because it often does the wrong thing. # # See RT #77465 # #push @switches, 'utf8' => 1; $self->debug( "Pod::Man switches are [@switches]\n" ); return @switches; } sub _parse_with_pod_man { my( $self, $file ) = @_; #->output_fh and ->output_string from Pod::Simple aren't # working, apparently, so there's this ugly hack: local *STDOUT; open STDOUT, '>', $self->{_text_ref}; my $parser = Pod::Man->new( $self->_get_podman_switches ); $self->debug( "Parsing $file\n" ); $parser->parse_from_file( $file ); $self->debug( "Done parsing $file\n" ); close STDOUT; $self->die( "No output from Pod::Man!\n" ) unless length $self->{_text_ref}; $self->_save_pod_man_output if $self->debugging; return SUCCESS; } sub _save_pod_man_output { my( $self, $fh ) = @_; $fh = do { my $file = "podman.out.$$.txt"; $self->debug( "Writing $file with Pod::Man output\n" ); open my $fh2, '>', $file; $fh2; } unless $fh; print { $fh } ${ $self->{_text_ref} }; } sub _have_groff_with_utf8 { my( $self ) = @_; return 0 unless $self->_is_groff; my $roffer = $self->__nroffer; my $minimum_groff_version = '1.20.1'; my $version_string = `$roffer -v`; my( $version ) = $version_string =~ /\(?groff\)? version (\d+\.\d+(?:\.\d+)?)/; $self->debug( "Found groff $version\n" ); # is a string comparison good enough? if( $version lt $minimum_groff_version ) { $self->warn( "You have an old groff." . " Update to version $minimum_groff_version for good Unicode support.\n" . "If you don't upgrade, wide characters may come out oddly.\n" ); } $version ge $minimum_groff_version; } sub _have_mandoc_with_utf8 { my( $self ) = @_; $self->_is_mandoc and not system 'mandoc -Tlocale -V > /dev/null 2>&1'; } sub _collect_nroff_switches { my( $self ) = shift; my @render_switches = ('-man', $self->_get_device_switches); # Thanks to Brendan O'Dea for contributing the following block if( $self->_is_roff and -t STDOUT and my ($cols) = $self->_get_columns ) { my $c = $cols * 39 / 40; $cols = $c > $cols - 2 ? $c : $cols -2; push @render_switches, '-rLL=' . (int $c) . 'n' if $cols > 80; } # I hear persistent reports that adding a -c switch to $render # solves many people's problems. But I also hear that some mans # don't have a -c switch, so that unconditionally adding it here # would presumably be a Bad Thing -- sburke@cpan.org push @render_switches, '-c' if( $self->_is_roff and $self->is_cygwin ); return @render_switches; } sub _get_device_switches { my( $self ) = @_; if( $self->_is_nroff ) { qw() } elsif( $self->_have_groff_with_utf8 ) { qw(-Kutf8 -Tutf8) } elsif( $self->_is_ebcdic ) { qw(-Tcp1047) } elsif( $self->_have_mandoc_with_utf8 ) { qw(-Tlocale) } elsif( $self->_is_mandoc ) { qw() } else { qw(-Tlatin1) } } sub _is_roff { my( $self ) = @_; $self->_is_nroff or $self->_is_groff; } sub _is_nroff { my( $self ) = @_; $self->__nroffer =~ /\bnroff\b/; } sub _is_groff { my( $self ) = @_; $self->__nroffer =~ /\bgroff\b/; } sub _is_mandoc { my ( $self ) = @_; $self->__nroffer =~ /\bmandoc\b/; } sub _is_ebcdic { my( $self ) = @_; return 0; } sub _filter_through_nroff { my( $self ) = shift; $self->debug( "Filtering through " . $self->__nroffer() . "\n" ); # Maybe someone set rendering switches as part of the opt_n value # Deal with that here. my ($render, $switches) = $self->__nroffer() =~ /\A([\/a-zA-Z0-9_\.-]+)\b(.+)?\z/; $self->die("no nroffer!?") unless $render; my @render_switches = $self->_collect_nroff_switches; if ( $switches ) { # Eliminate whitespace $switches =~ s/\s//g; # Then separate the switches with a zero-width positive # lookahead on the dash. # # See: # http://www.effectiveperlprogramming.com/blog/1411 # for a good discussion of this technique push @render_switches, split(/(?=-)/, $switches); } $self->debug( "render is $render\n" ); $self->debug( "render options are @render_switches\n" ); require Symbol; require IPC::Open3; require IO::Handle; my $pid = IPC::Open3::open3( my $writer, my $reader, my $err = Symbol::gensym(), $render, @render_switches ); $reader->autoflush(1); use IO::Select; my $selector = IO::Select->new( $reader ); $self->debug( "Writing to pipe to $render\n" ); my $offset = 0; my $chunk_size = 4096; my $length = length( ${ $self->{_text_ref} } ); my $chunks = $length / $chunk_size; my $done; my $buffer; while( $offset <= $length ) { $self->debug( "Writing chunk $chunks\n" ); $chunks++; syswrite $writer, ${ $self->{_text_ref} }, $chunk_size, $offset or $self->die( $! ); $offset += $chunk_size; $self->debug( "Checking read\n" ); READ: { last READ unless $selector->can_read( 0.01 ); $self->debug( "Reading\n" ); my $bytes = sysread $reader, $buffer, 4096; $self->debug( "Read $bytes bytes\n" ); $done .= $buffer; $self->debug( sprintf "Output is %d bytes\n", length $done ); next READ; } } close $writer; $self->debug( "Done writing\n" ); # read any leftovers $done .= do { local $/; <$reader> }; $self->debug( sprintf "Done reading. Output is %d bytes\n", length $done ); if( $? ) { $self->warn( "Error from pipe to $render!\n" ); $self->debug( 'Error: ' . do { local $/; <$err> } ); } close $reader; if( my $err = $? ) { $self->debug( "Nonzero exit ($?) while running `$render @render_switches`.\n" . "Falling back to Pod::Perldoc::ToPod\n" ); return $self->_fallback_to_pod( @_ ); } $self->debug( "Output:\n----\n$done\n----\n" ); ${ $self->{_text_ref} } = $done; return length ${ $self->{_text_ref} } ? SUCCESS : FAILED; } sub parse_from_file { my( $self, $file, $outfh) = @_; # We have a pipeline of filters each affecting the reference # in $self->{_text_ref} $self->{_text_ref} = \my $output; $self->_parse_with_pod_man( $file ); # so far, nroff is an external command so we ensure it worked my $result = $self->_filter_through_nroff; return $self->_fallback_to_pod( @_ ) unless $result == SUCCESS; $self->_post_nroff_processing; print { $outfh } $output or $self->die( "Can't print to $$self{__output_file}: $!" ); return; } sub _fallback_to_pod { my( $self, @args ) = @_; $self->warn( "Falling back to Pod because there was a problem!\n" ); require Pod::Perldoc::ToPod; return Pod::Perldoc::ToPod->new->parse_from_file(@_); } # maybe there's a user setting we should check? sub _get_tab_width { 4 } sub _expand_tabs { my( $self ) = @_; my $tab_width = ' ' x $self->_get_tab_width; ${ $self->{_text_ref} } =~ s/\t/$tab_width/g; } sub _post_nroff_processing { my( $self ) = @_; if( $self->is_hpux ) { $self->debug( "On HP-UX, I'm going to expand tabs for you\n" ); # this used to be a pipe to `col -x` for HP-UX $self->_expand_tabs; } if( $self->{'__filter_nroff'} ) { $self->debug( "filter_nroff is set, so filtering\n" ); $self->_remove_nroff_header; $self->_remove_nroff_footer; } else { $self->debug( "filter_nroff is not set, so not filtering\n" ); } $self->_handle_unicode; return 1; } # I don't think this does anything since there aren't two consecutive # newlines in the Pod::Man output sub _remove_nroff_header { my( $self ) = @_; $self->debug( "_remove_nroff_header is still a stub!\n" ); return 1; # my @data = split /\n{2,}/, shift; # shift @data while @data and $data[0] !~ /\S/; # Go to header # shift @data if @data and $data[0] =~ /Contributed\s+Perl/; # Skip header } # I don't think this does anything since there aren't two consecutive # newlines in the Pod::Man output sub _remove_nroff_footer { my( $self ) = @_; $self->debug( "_remove_nroff_footer is still a stub!\n" ); return 1; ${ $self->{_text_ref} } =~ s/\n\n+.*\w.*\Z//m; # my @data = split /\n{2,}/, shift; # pop @data if @data and $data[-1] =~ /^\w/; # Skip footer, like # 28/Jan/99 perl 5.005, patch 53 1 } sub _unicode_already_handled { my( $self ) = @_; $self->_have_groff_with_utf8 || 1 # so, we don't have a case that needs _handle_unicode ; } sub _handle_unicode { # this is the job of preconv # we don't need this with groff 1.20 and later. my( $self ) = @_; return 1 if $self->_unicode_already_handled; require Encode; # it's UTF-8 here, but we need character data my $text = Encode::decode( 'UTF-8', ${ $self->{_text_ref} } ) ; # http://www.mail-archive.com/groff@gnu.org/msg01378.html # http://linux.die.net/man/7/groff_char # http://www.gnu.org/software/groff/manual/html_node/Using-Symbols.html # http://lists.gnu.org/archive/html/groff/2011-05/msg00007.html # http://www.simplicidade.org/notes/archives/2009/05/fixing_the_pod.html # http://lists.freebsd.org/pipermail/freebsd-questions/2011-July/232239.html $text =~ s/(\P{ASCII})/ sprintf '\\[u%04X]', ord $1 /eg; # should we encode? ${ $self->{_text_ref} } = $text; } 1; __END__ =head1 NAME Pod::Perldoc::ToMan - let Perldoc render Pod as man pages =head1 SYNOPSIS perldoc -o man Some::Modulename =head1 DESCRIPTION This is a "plug-in" class that allows Perldoc to use Pod::Man and C for reading Pod pages. The following options are supported: center, date, fixed, fixedbold, fixeditalic, fixedbolditalic, quotes, release, section (Those options are explained in L.) For example: perldoc -o man -w center:Pod Some::Modulename =head1 CAVEAT This module may change to use a different pod-to-nroff formatter class in the future, and this may change what options are supported. =head1 SEE ALSO L, L, L =head1 COPYRIGHT AND DISCLAIMERS Copyright (c) 2011 brian d foy. All rights reserved. Copyright (c) 2002,3,4 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 AUTHOR Current maintainer: Mark Allen C<< >> Past contributions from: brian d foy C<< >> Adriano R. Ferreira C<< >>, Sean M. Burke C<< >> =cut