Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CGIプログラムを書いてみた
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
uutan1108
August 25, 2024
Programming
390
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CGIプログラムを書いてみた
ゆるWeb勉強会@札幌 #27 / フロントエンドカンファレンス北海道2024 お疲れ様会
https://mild-web-sap.connpass.com/event/327040/
uutan1108
August 25, 2024
More Decks by uutan1108
See All by uutan1108
エンジニアとQAエンジニアを繋いでくれた振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
0
260
Designing a Cross-Disciplinary Engineering Community Through Anime
ohmori_yusuke
3
110
コミュニティ・勉強会を作るのは目的じゃない
ohmori_yusuke
1
400
映画のエンドロール風の動画を自動生成するツールを作った
ohmori_yusuke
2
96
アウトプットは“成果物”じゃなく“副産物”だった話
ohmori_yusuke
1
130
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
900
仕様がそのままテストになる!Javaで始める振る舞い駆動開発
ohmori_yusuke
8
6.2k
勉強会から始まった僕のDevRel~新卒エンジニアがつないだ2年間の軌跡~
ohmori_yusuke
2
530
WebエンジニアがSwiftをブラウザで動かすプレイグラウンドを作ってみた
ohmori_yusuke
0
380
Other Decks in Programming
See All in Programming
The Rails Doctrine Decade
koic
2
390
スマートフォンでモールス信号を送受信する 〜スマートフォンのLEDとカメラで作る光通信の設計と実装〜
atsuki_seo
0
190
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
160
アクセシビリティから考える情報設計
high_g_engineer
0
410
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
350
Workers Cache を知る
syumai
0
270
一人だけ、Kiroが静止する日
hideg
0
130
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
170
Security issues being discussed on Web Platforms
petamoriken
0
1.2k
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
110
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
300
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
540
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
7.1k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
Exploring anti-patterns in Rails
aemeredith
4
510
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
370
Amusing Abliteration
ianozsvald
1
310
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
New Earth Scene 8
popppiees
4
2.6k
Ruling the World: When Life Gets Gamed
codingconduct
0
360
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
370
Transcript
PerlでCGIスクリプトを書いてみた ゆるWeb勉強会@札幌 #27 / フロントエンドカンファレンス北海道2024 お疲れ様会 うーたん
自己紹介
自己紹介 • うーたん ◦ X:@uutan1108 • 株式会社ゆめみ ◦ 新卒2年目 ◦
サーバーサイドエンジニア • 趣味 ◦ アニメを観ること
私とゆるWeb勉強会@札幌
初めてのLT発表|うーたん https://note.com/uutan1108/n/nffce0e70facd
オンラインの時のゆるWebだったけど楽しかった • ワイワイする時間がいい • ハッシュタグでリアクションしてくださる方が多くて いい • 当時大学生の私でも発表しやすくてよかった • 司会、運営のtacckさんから感想がもらえるのがいい
以上、私とゆるWeb勉強会@札幌でした
本題 「PerlでCGIスクリプトを書いてみた」
CGIとは
CGIとは? CGI とは Common Gateway Interface の略です。通常の ページでは、あらかじめ用意された HTML ページを表示す
るだけですが、CGI を用いることにより、例えば、以下の ようなページを作成することができるようになります。 - カウンター - チャット - 掲示板 - アンケートフォーム CGIの概要 - とほほのWWW入門 https://www.tohoho-web.com/wwwcgi1.htm
CGIスクリプトとは 「CGIプログラム」のうち、Perl、awk、sh などコンパイ ル作業が不要なスクリプト言語で記述されたものを「CGI スクリプト」と呼びます。CGI プログラムは Perl で記述 されたものが多いですが、環境変数と標準入力を参照でき て、結果を標準出力に書き出せるものであれば、C言語、
C++言語、VisualBasic でも何でも構いません。 CGIの概要 - とほほのWWW入門 https://www.tohoho-web.com/wwwcgi1.htm
CGIスクリプトとは 「CGIプログラム」のうち、Perl、awk、sh などコンパイ ル作業が不要なスクリプト言語で記述されたものを「CGI スクリプト」と呼びます。CGI プログラムは Perl で記述さ れたものが多いですが、環境変数と標準入力を参照でき て、結果を標準出力に書き出せるものであれば、C言語、
C++言語、VisualBasic でも何でも構いません。 CGIの概要 - とほほのWWW入門 https://www.tohoho-web.com/wwwcgi1.htm
まずはPerlでCGIを書いてみる
アイドルマスター(765プロ、346プロ) のアイドル 検索アプリ
None
None
機能 - キャラクターの情報で検索 - クエリパラメータで検索機能 - キャラクターの名前漢字または名前カナで検索機能
構成図
Perl(CGIスクリプト) +Apache+MySQL
None
Perlを書いた感想
書いてみてへぇと思ったところを紹介
サブルーチン🤔
ユーザーが定義する関数 Perl では様々な組み込み関数が用意されていますが、自分 で関数を定義することも可能です。 ユーザーが定義する関数をサブルーチンと呼びます。 Perl | サブルーチン https://www.javadrive.jp/perl/sub/
もう少し詳しく
サブルーチンとは🤔 #!/usr/bin/perl sub hello { my ($world) = @_; return
"Hello " . $world; } my $result = hello("World"); print $result;
サブルーチンとは🤔 #!/usr/bin/perl sub hello { my ($world) = @_; return
"Hello " . $world; } my $result = hello("World"); print $result; サブルーチンを呼び出す
サブルーチンとは🤔 #!/usr/bin/perl sub hello { my ($world) = @_; return
"Hello " . $world; } my $result = hello("World"); print $result; @_ に引数”World”
サブルーチンとは🤔 #!/usr/bin/perl sub hello { my ($world) = @_; return
"Hello " . $world; } my $result = hello("World"); print $result; . で“Hello”と”World”を連結
サブルーチンとは🤔 #!/usr/bin/perl sub hello { my ($world) = @_; return
"Hello " . $world; } my $result = hello("World"); print $result; 文字列の Hello World が出力
へぇ 💡
$ と @ の違い🤔
$と@の違いは、データの種類 $: スカラ変数を表し、単一の値(例えば、数字や文字列) を保持する 例: $scalar = 10; → 1つの値を保持する
@: 配列を表し、複数の値を保持する 例: @array = (1, 2, 3); → 複数の値を保持する
$: スカラ変数 #!/usr/bin/perl my $message = "Hello"; print $message; 文字列の
Hello が出力
@: 配列 #!/usr/bin/perl my @nums = (1, 2, 3); print
@nums; 配列の 123 が出力
もう少し詳しく
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data;
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data; 配列のリファレンス
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; 配列のリファレンス
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; print $array_ref > ARRAY(0x560c6a730788) リファレンスが得られる
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data; デリファレンス
$ と @ の違いは🤔 #!/usr/bin/perl my @array = @$array_ref; デリファレンス
$ と @ の違いは🤔 #!/usr/bin/perl my @array = @$array_ref; print
$array_ref > ARRAY(0x560c6a730788) print @$array_ref; > 123 リファレンス先の値を参照して出力する
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data; 配列の (1, 2, 3) を出力
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data; 配列の先頭の要素を $data に代入
$ と @ の違いは🤔 #!/usr/bin/perl my $array_ref = [1, 2,
3]; my @array = @$array_ref; print @array; my ($data) = @array; print $data; $data の 1 を出力
へぇ 💡
最後に
アイドル図鑑のコード
None
タグの閉じ忘れでスタイル崩れてしんどかった
宣伝
PHPカンファレンス沖縄2024前夜祭 で登壇します PHPカンファレンス沖縄2024前夜祭 - connpass https://phpcon-okinawa.connpass.com/event/324902/
Scrum Fest Mikawa 2024 で登壇します Scrum Fest Mikawa 2024 -
新卒エンジニアが組織に馴染むために勉強会を主催して職能間の境界を越える | ConfEngine - Conference Platform https://confengine.com/conferences/scrum-fest-mikawa-2024/proposal/20268
アイドル名簿(今回作ったアプリのコード) OHMORIYUSUKE/perl-mysql-apache-on-docker https://github.com/OHMORIYUSUKE/perl-mysql-apach e-on-docker
お わ り