From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 22 Apr 2005 01:20:52 +0400 From: Alexey Tourbin To: Sisyphus Message-ID: <20050421212052.GB18070@solemn.turbinal.org> Mail-Followup-To: Sisyphus Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uh9ZiVrAOUUm9fzH" Content-Disposition: inline Subject: [sisyphus] perldoc cache X-BeenThere: sisyphus@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Linux Sisyphus discussion list List-Id: ALT Linux Sisyphus discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2005 21:21:42 -0000 Archived-At: List-Archive: --uh9ZiVrAOUUm9fzH Content-Type: multipart/mixed; boundary="WhfpMioaduB5tiZL" Content-Disposition: inline --WhfpMioaduB5tiZL Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =F1 =D2=C5=C1=CC=C9=DA=CF=D7=C1=CC =CB=C5=DB=C9=D2=CF=D7=C1=CE=C9=C5 =D7 pe= rldoc (=C4=CC=D1 pod2man | nroff). =FE=D4=CF=C2=D9 =CB=C5=DB=C9=D2=CF=D7=C1=CE=C9=C5 =D7=CB=CC=C0=DE=C9=CC=CF= =D3=D8, =CE=D5=D6=CE=CF =D3=CF=DA=C4=C1=D4=D8 =CB=C1=D4=C1=CC=CF=C7 ~/.perl= doc. * Fri Apr 22 2005 Alexey Tourbin 3.14-alt2 - implemented cache for nroff formatted output (mkdir ~/.perldoc) $ mkdir ~/.perldoc $ time perldoc perlre >/dev/null perldoc perlre > /dev/null 3,98s user 0,06s system 99% cpu 4,064 total $ ls ~/.perldoc _usr_bin_pod2man_lax_usr_lib_perl5_pod_perlre_pod_nroff_man $ time perldoc perlre >/dev/null perldoc perlre > /dev/null 0,72s user 0,03s system 98% cpu 0,760 total $ --WhfpMioaduB5tiZL Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="perldoc-3.14-alt-man-cache.patch" Content-Transfer-Encoding: quoted-printable --- Pod-Perldoc-3.14/lib/Pod/Perldoc/ToMan.pm- 2004-12-01 01:20:19 +0300 +++ Pod-Perldoc-3.14/lib/Pod/Perldoc/ToMan.pm 2005-04-22 01:08:03 +0400 @@ -38,6 +38,9 @@ sub parse_from_file { my $self =3D shift; my($file, $outfh) =3D @_; =20 + require Cwd; + $file =3D Cwd::realpath($file) || $file; + my $render =3D $self->{'__nroffer'} || die "no nroffer set!?"; =20 # turn the switches into CLIs @@ -88,7 +91,21 @@ sub parse_from_file { and print "About to run $command\n"; ; =20 - my $rslt =3D `$command`; + my $cache =3D $command; + $cache =3D~ tr/a-zA-Z0-9/_/cs; + $cache =3D "$ENV{HOME}/.perldoc/$cache"; + + my $rslt; + if (-f $cache and -M $cache < -M $file) { + local @ARGV =3D $cache; local $/ =3D undef; + $rslt =3D <>; + } else { + $rslt =3D `$command`; + unless ($file =3D~ m#/tmp/#) { + my $fh; open $fh, ">", $cache + and print $fh $rslt; + } + } =20 my $err; =20 --WhfpMioaduB5tiZL-- --uh9ZiVrAOUUm9fzH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFCaBkzfBKgtDjnu0YRAvOHAKCnfoGyAy2We+QrweNhK7tGWxljuwCggFE0 dyjDyZrnQz319ybtX/JWprk= =q9iT -----END PGP SIGNATURE----- --uh9ZiVrAOUUm9fzH--