Skip to content

Instantly share code, notes, and snippets.

@bg1bgst333
Created March 6, 2025 06:11
Show Gist options
  • Save bg1bgst333/9907ee321299e0607a972715dc7bfdf1 to your computer and use it in GitHub Desktop.
Save bg1bgst333/9907ee321299e0607a972715dc7bfdf1 to your computer and use it in GitHub Desktop.
CGI::Carp
#!/usr/bin/perl
use strict; # 厳密な文法チェック.
use CGI; # CGI
use CGI::Carp; # CGI::Carp
# CGIオブジェクトの作成.
my $q = CGI->new; # CGI::newでCGIオブジェクトを生成し, $qに格納.
# HTTPヘッダの出力.
print $q->header;
# HTMLヘッダの出力.
print $q->start_html("CGI::Carp"); # <html>タグなどの出力.
# エラー発生.
croak "CGI::Carp!"; # croakで"CGI::Carp!"と出力.
# HTMLフッタの出力.
print $q->end_html; # </html>タグなどの出力.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment