Updated - see pmproxy2

Well after a discussion in the chatterbox about customising themes by CSS. I'm not sure exactly who but someone raised the idea of creating a proxy to simply insert a css tag, so I figured why not give it a go, I might even learn something (I did). (Though, its not like there is anything much to this)

The following is the result, it has:

I dont know if I will do any more to it or not, depends on how much I can come to liking my own CSS themes. Feel free to run off and improove it beyond what I could possibly do in a decade :)

To run: Just stick the script and your "style.css" file somewhere together, exec it, and you're off and proxying from port 82.

- nashdj

use strict; use LWP::Simple; use HTTP::Daemon; use HTTP::Status; open(CSS,"style.css") || die "CSS Error: $!"; my $css = join("",<CSS>); close(CSS); &serve; #well it was going to be bigger than this originally you see sub serve { my $d=HTTP::Daemon->new(LocalAddr=>'localhost', LocalPort=>'82', Reuse => '1') || die "Cant Spawn: $!"; my $c; while(1) { $c =$d->accept; my $r = $c->get_request(); my $url = $r->uri->as_string; my $content; if ($url !~ /style.css$/i) { $url =~ s|^(http://).+?/(.*)$|$1www.perlmonks.org/$2|i; $content = get $url; $content =~ s|<BODY|<link rel=stylesheet type="text/css" href="/ +style.css">\n<BODY|i; } else { $content = $css; } my $response = HTTP::Response->new(); $response->content($content); $c->send_response($response); $c->close; } }
-- I was trying to post this in snippits, but my browser didnt seem to be doing anything :)

In reply to pmproxy by nashdj

Title:
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, details, 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, summary, 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.