94 |
Sack::Server::HTTP::request( $client, sub { |
Sack::Server::HTTP::request( $client, sub { |
95 |
warn "XXX callback ",dump( @_ ); |
warn "XXX callback ",dump( @_ ); |
96 |
my ( $send, $method, $param ) = @_; |
my ( $send, $method, $param ) = @_; |
97 |
print $send "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\n" |
|
98 |
, dump( $info ) |
if ( $method =~ m{views} ) { |
99 |
|
warn "$method ", -s $method, " bytes"; |
100 |
|
my $code = read_file $method; |
101 |
|
Sack::Merge->clean; |
102 |
|
to_all { view => $code, path => $method }; |
103 |
|
print $send "HTTP/1.0 302 $method\r\nLocation: /\r\n\r\n"; |
104 |
|
return; |
105 |
|
} elsif ( $method =~ m{^/tmp/sack} ) { |
106 |
|
@shard_paths = glob "$method/*"; |
107 |
|
warn "loading shard $method from ", dump( @shard_paths ); |
108 |
|
to_all { load => $method }; |
109 |
|
print $send "HTTP/1.0 302 $method\r\nLocation: /\r\n\r\n"; |
110 |
|
return; |
111 |
|
} |
112 |
|
|
113 |
|
print $send "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"; |
114 |
|
|
115 |
|
print $send qq|<h1>Views</h1><ul>| |
116 |
|
, join("\n", map { qq|<li><a href="$_">$_</a>| } glob '/srv/Sack/views/*/*.pl' ) |
117 |
|
, qq|</ul>| |
118 |
|
; |
119 |
|
|
120 |
|
print $send '<h1>Info</h1><pre>' . dump( $info ) . '</pre>'; |
121 |
|
|
122 |
|
print $send qq|<h1>Data</h1><ul>| |
123 |
|
, join("\n", map { qq|<li><a href="$_">$_</a>| } glob '/tmp/sack/*' ) |
124 |
|
, qq|</ul>| |
125 |
; |
; |
126 |
} ); |
} ); |
127 |
} else { |
} else { |