#!/usr/bin/perl -- use strict; use warnings; use CGI; print CGI->new->start_html( -title => 'searc http://invertor.ru', -author => '@pashanoid', -base => 'true', -meta => { 'keywords' => 'invertor ups search solar wind alternative energy', 'copyright' => 'MicroART' }, -style => [ { 'src' => '/styles/invertor.css' }, { 'src' => '/styles/ie1.css', 'endif' => 'if lte IE 6' } ], -lang => 'ru-RU', -encoding => 'windows-1251', ); ### Method: _style # internal method for generating a CSS style section #### #~ '_style' => <<'END_OF_FUNC', ## MONKEYPATCHING sub CGI::_style { package CGI; use vars '$XHTML'; my ( $self, $style ) = @_; use DDS; Dump($style); my (@result); my $type = 'text/css'; my $rel = 'stylesheet'; my $cdata_start = $XHTML ? "\n\n" : " -->\n"; my @s = ref($style) eq 'ARRAY' ? @$style : $style; my $other = ''; for my $s (@s) { if ( ref($s) ) { use DDS; Dump({"WTF", $s, }); my $endif = delete $s->{endif}; my ( $src, $code, $verbatim, $stype, $alternate, $foo, @other ) = rearrange( [qw(SRC CODE VERBATIM TYPE ALTERNATE FOO)], ( '-foo' => 'bar', ref($s) eq 'ARRAY' ? @$s : %$s ) ); use DDS; Dump({ qw{$src} => $src, qw{$code} => $code, qw{$verbatim} => $verbatim, qw{$stype} => $stype, qw{$alternate} => $alternate, qw{$foo} => $foo, qw{@other} => \@other, }); my $type = defined $stype ? $stype : 'text/css'; my $rel = $alternate ? 'alternate stylesheet' : 'stylesheet'; $other = "@other" if @other; if ( ref($src) eq "ARRAY" ) # Check to see if the $src variable is an array reference { # If it is, push a LINK tag for each one for $src (@$src) { push( @result, $XHTML ? qq() : qq() ) if $src; $src and $endif and $result[-1] = sprintf "", $endif, $result[-1]; } } else { # Otherwise, push the single -src, if it exists. push( @result, $XHTML ? qq() : qq() ) if $src; $src and $endif and $result[-1] = sprintf "", $endif, $result[-1]; } if ($verbatim) { my @v = ref($verbatim) eq 'ARRAY' ? @$verbatim : $verbatim; push( @result, "" ) for @v; } my @c = ref($code) eq 'ARRAY' ? @$code : $code if $code; push( @result, style( { 'type' => $type }, "$cdata_start\n$_\n$cdata_end" ) ) for @c; } else { my $src = $s; push( @result, $XHTML ? qq() : qq() ); } } @result; } __END__ $ARRAY1 = [ { src => '/styles/invertor.css' }, { endif => 'if lte IE 6', src => '/styles/ie1.css' } ]; $HASH1 = { WTF => { src => '/styles/invertor.css' } }; $HASH1 = { "\$alternate" => undef, "\$code" => undef, "\$foo" => 'bar', "\@other" => [], "\$src" => '/styles/invertor.css', "\$stype" => undef, "\$verbatim" => undef }; $HASH1 = { WTF => { endif => 'if lte IE 6', src => '/styles/ie1.css' } }; $HASH1 = { "\$alternate" => undef, "\$code" => undef, "\$foo" => 'bar', "\@other" => [], "\$src" => '/styles/ie1.css', "\$stype" => undef, "\$verbatim" => undef };
##
{ 'src' => '/styles/ie1.css',
-wrapp => [ '' ],
},