Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number


by nashdj (Friar)
on Dec 04, 2000 at 17:09 UTC ( #44780=CUFP: print w/replies, xml ) Need Help??

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:

  • No Error Control:
  • No Cookie Support
  • No POST Support
  • But... It does the job I wrote it for

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://).+?/(.*)$|$$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 :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://44780]
Approved by root
[marinersk]: choroba++
[choroba]: it's a long running test, so it's normally skipped unless an env var is set
[choroba]: nobody has been bothered to set the variable in the last 3 years
[marinersk]: sub newtest{my $expected_result = &target('foo'); my $actual_result = &target('foo'); if ($actual_result eq $expected_result) { &tdd_success(); } else { &tdd_fail(); } } # Test works after three years!
[choroba]: or nobody bothered...
[choroba]: The problem was bigger, as the test tried to call a method that didn't exist anymore
[marinersk]: :: ducking ::
[choroba]: because, someone renamed the method, but didn't notice it was used in the test, as the test was skipped
[marinersk]: Well, if the method doesn't exist, it would be hard to pass the test.
[choroba]: later, someone removed the new method, as all its usage places were safe, but didn't notice the test still used the old name

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-05-25 15:08 GMT
Find Nodes?
    Voting Booth?