リメイク:「戻る」リンクを作る

                             <p>ソースコード</p>
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl -T
# 日本語(utf-8)

use strict;
use warnings;
use Encode;
use utf8;
use CGI;

{
    my $cgi  = CGI->new;
    my $html = "";
    $html .= $cgi->header( { -charset => "utf-8" } );
    $html .= $cgi->start_html(
        {   -title => "テスト4",
            -lang  => "ja",
        }
    );
    $html .= $cgi->start_div;
    if ( my $referer = $cgi->referer ) {
        $html .= $cgi->a( { -href => $referer }, "戻る" );
    }
    else {
        $html .= $cgi->p(
            "HTTPからアクセスされていません。たぶん。");
    }
    $html .= $cgi->end_div . $cgi->end_html;
    print Encode::encode( "utf-8", $html );

    #    print $html;
}
                          </div>

Comments

comments powered by Disqus