576e39c88d25c1f50c3933b5fc156586da440aef
[sheet.git] / common.inc.plp
1 <:
2 use utf8;
3 use strict;
4 use warnings;
5 no  warnings 'qw';  # you know what you doing
6 no  warnings 'uninitialized';  # save some useless checks for more legible code
7 use open IO => ':utf8';
8
9 our $style;
10
11 $header{content_type} = 'text/html; charset=utf-8';
12
13 sub stylesheet {
14         my %styles = map {$_ => $_} @_;
15         $style = exists $get{style} && $styles{$get{style}} || $_[0];
16         return join "\n", map { sprintf(
17                 '<link rel="%s" type="text/css" media="all" href="%s" title="%s">',
18                 $_ eq $style ? 'stylesheet' : 'alternate stylesheet', "/$_.css", $_
19         ) } @_;
20 }
21