Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
This ought to fix your newline issue ;)(i submitted it on
package Apache::CVS::Revision; sub content { my $self = shift; $self->_checkout() unless $self->co_file(); return undef if $self->is_binary(); open FILE, $self->co_file(); # my $content = join "\n", <FILE>; my $content = join '', <FILE>; close FILE; return $content; }
update: caching support added, even though apache2 doesn't like Apache::CVS (will test with mod_perl1x later on). Enjoy
package Apache::CVS::Tidy; use strict; use warnings; use base qw(Apache::CVS::HTML); use Perl::Tidy; use Cache::FileCache; ## PodMaster use CGI qw(start_html); sub print_page_header { my $self = shift; return if $self->page_headers_sent(); $self->request()->print(start_html( -title => 'CVS Repository', -style => { src => '/path/to/perltidy.css' }, )); $self->print_path_links(); $self->page_headers_sent(1); } ## PodMaster ## originally straight from Apache::CVS::HTML ## caching support added, and print_text_revision inlined sub handle_revision { my $self = shift; my ($uri_base, $revision_num) = @_; my $file = Apache::CVS::File->new($self->path(), $self->rcs_config +()); my $revision = $file->revision($revision_num); eval { if ($revision->is_binary()) { my $subrequest = $self->request()->lookup_file($revision->co_file()); $self->content_type($subrequest->content_type); $self->print_http_header(); $self->request()->send_fd($revision->filehandle()); close $revision->filehandle(); } else { $self->print_http_header(); $self->print_page_header(); my $cache = Cache::FileCache->new( { namespace => 'JeffasTidyCvs', # cache_root => 'someplace' # I like the default auto_purge_on_set => 0, auto_purge_on_get => 0, directory_umask => '077', # i don't care } ); my $key = $file->path().$file->name().$revision->number(); my $content = $cache->get($key) if defined $cache; if( defined $content ){ ## is it cached? PodMaster $self->request()->print($content); } else { ## your sub print_text_revision my $html; $content = $revision->content(); perltidy( source => \$content, destination => \$html, argv => '-html -npod -css=/path/to/perltidy.c +ss', errorfile => '/dev/null', ); $cache->set($key,$html) if defined $cache; $self->request()->print($html); } } }; if ($@) { $self->request()->log_error($@); $self->print_error("Unable to get revision.\n$@"); return; } } 1; package Apache::CVS::Revision; sub content { my $self = shift; $self->_checkout() unless $self->co_file(); return undef if $self->is_binary(); open FILE, $self->co_file(); # my $content = join "\n", <FILE>; my $content = join '', <FILE>; close FILE; return $content; } 1;

So sorry honourable jeffa, I was saving the plaintext($content) instead of the html ($html), fixed now ;)

After much debugging, Apache::CVS is sweet, but it relies on unportable code (damn, Rcs sucks)

MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.

In reply to Re: Apache::CVS::HTML + Perl::Tidy by PodMaster
in thread Apache::CVS::HTML + Perl::Tidy by jeffa

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [shmem]: erix: it may be a unicorn goat, or the devil in disguise

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (5)
    As of 2017-03-30 17:46 GMT
    Find Nodes?
      Voting Booth?
      Should Pluto Get Its Planethood Back?

      Results (362 votes). Check out past polls.