warning: Creating default object from empty value in /var/www/drupal-5.23/modules/taxonomy/taxonomy.module on line 1418.

Perl で、ブラウザから送られてきたデータを CGI.pm を使わずに処理する方法

最も原始的な例は以下のようになるだろう。今さらだけど、知っておいて損はないかもしれない。 HTTP プロトコルの場合、クライアントからサーバにデータを送る方法は POST メソッドか GET メソッドと仕様で定義されているから、POST の場合と GET の場合の2つのパターンを考えてデータを受け取ってあげればよい。
最も原始的な例は以下のようになるだろう。今さらだけど、知っておいて損はないかもしれない。 HTTP プロトコルの場合、クライアントからサーバにデータを送る方法は POST メソッドか GET メソッドと仕様で定義されているから、POST の場合と GET の場合の2つのパターンを考えてデータを受け取ってあげればよい。

Perl で、画像のサムネイルを作成してブラウザから表示させる方法

以下のサンプルファイルを image.cgi と名前を付けて保存、アクセス権を chmod +x image.cgi とかして ブラウザから https://yourname.com/image.cgi とかにアクセスすればよい。 注意点としては、このスクリプトは画像しか表示できないことである。これと一緒に HTML ファイルを表示しようと思っても、HTTP プロトコルの仕様上不可能である。なぜかというと HTTP プロトコルを通して画像を表示する場合は、すでにこのスクリプトが HTTP ヘッダとして Content-type: image/jpeg を最初に出力してブラウザが受け取っているからで、このスクリプトの中で同時に(画像を表示した後に) HTML 文書を表示させようとて Content-type: text/html を出力(print "Content-type: text/html\n\n)してもブラウザは受け付けてくれないのである。 #!/usr/bin/perl use GD;
以下のサンプルファイルを image.cgi と名前を付けて保存、アクセス権を chmod +x image.cgi とかして ブラウザから https://yourname.com/image.cgi とかにアクセスすればよい。 注意点としては、このスクリプトは画像しか表示できないことである。これと一緒に HTML ファイルを表示しようと思っても、HTTP プロトコルの仕様上不可能である。なぜかというと HTTP プロトコルを通して画像を表示する場合は、すでにこのスクリプトが HTTP ヘッダとして Content-type: image/jpeg を最初に出力してブラウザが受け取っているからで、このスクリプトの中で同時に(画像を表示した後に) HTML 文書を表示させようとて Content-type: text/html を出力(print "Content-type: text/html\n\n)してもブラウザは受け付けてくれないのである。 #!/usr/bin/perl use GD;

Requirements for Mobile Phones (English)

I would like to propose the unique requirements for mobile phones. The following items are significant considerations under mobile site development, especially in i-mode phones.
  1. UserAgent type that is, a Browser Name of CGI environments which is sent by a mobile phone to a web server.
  2. Range of IP addresses in each mobile operator, which is required to judge whether a user is using a mobile phone or a PC in order to support both of them in the web site. In Japanese mobile phone operators, they are using their specific proxy servers, which are accompanying with the specific range of IP addresses.
  3. Screen Size of each mobile phone, especially the size of width, which would be found in a CGI environment UserAgent in the latest phones
  4. Image Format such as JPEG, PNG and GIF supported by each mobile phone
  5. Maximum Size of Receiving Bytes per a page
  6. Difference of Handling Colors in each mobile phone
  7. Difference of Smilies (Picture Icons) both in each mobile phone and operator
  8. Name Convention of an E-mail Address in each operator (Japanese i-mode e-mail system violates RFC).
  9. Available Character Set in each operator (Shift-JIS, UTF-8 in Japan)
  10. Available Character Types in each operator (such as ZENKAKU, HANKAKU in Japan)
  11. Available Input Method in each operator (Access-key concept in CHTML)
  12. Support of Native Functions of a mobile phone (i.e. switching a browser screen to an e-mail application with 'mailto:' in CHTML at a single screen of a mobile phone, launching Java application, and directly calling to someone with 'tel:' in CHTML, etc)
  13. Difference in between Official Sites and Unofficial Sites (The acquiring information is different)
  14. Session Management because we cannot use cookie in i-mode phones
I would like to propose the unique requirements for mobile phones. The following items are significant considerations under mobile site development, especially in i-mode phones.
  1. UserAgent type that is, a Browser Name of CGI environments which is sent by a mobile phone to a web server.
  2. Range of IP addresses in each mobile operator, which is required to judge whether a user is using a mobile phone or a PC in order to support both of them in the web site. In Japanese mobile phone operators, they are using their specific proxy servers, which are accompanying with the specific range of IP addresses.
  3. Screen Size of each mobile phone, especially the size of width, which would be found in a CGI environment UserAgent in the latest phones
  4. Image Format such as JPEG, PNG and GIF supported by each mobile phone
  5. Maximum Size of Receiving Bytes per a page
  6. Difference of Handling Colors in each mobile phone
  7. Difference of Smilies (Picture Icons) both in each mobile phone and operator
  8. Name Convention of an E-mail Address in each operator (Japanese i-mode e-mail system violates RFC).
  9. Available Character Set in each operator (Shift-JIS, UTF-8 in Japan)
  10. Available Character Types in each operator (such as ZENKAKU, HANKAKU in Japan)
  11. Available Input Method in each operator (Access-key concept in CHTML)
  12. Support of Native Functions of a mobile phone (i.e. switching a browser screen to an e-mail application with 'mailto:' in CHTML at a single screen of a mobile phone, launching Java application, and directly calling to someone with 'tel:' in CHTML, etc)
  13. Difference in between Official Sites and Unofficial Sites (The acquiring information is different)
  14. Session Management because we cannot use cookie in i-mode phones

Perl で、JavaScript と連動してサーバにアクセスログを残す方法

ウェブページへのアクセスログを記録する方法は、いろいろな方法があると思う。もっとも簡単なのは Apache などのウェブサーバが自動的に記録するログをチェックすることで、これには何の手間もいらない。しかし、レンタルサーバなどでログが自由に扱えない場合はどうしたらいいのだろう? そのひとつが、画像としてリンクされている Perl などの CGI を呼び出す方法だ。利用者に知られずこっそりとアクセスログを取るには 1x1 ピクセルの画像をそのウェブページの背景と共に表示してしまえば、そのウェブページのソースをチェックされない限り、ほとんどの場合は気づかれずにすむだろう。 そんなわけで、以下のように JavaScript と対応する Perl スクリプトで、アクセスログを記録する仕組みを作ってみた。ログの形式は Apache に準拠する(たぶん)。
ウェブページへのアクセスログを記録する方法は、いろいろな方法があると思う。もっとも簡単なのは Apache などのウェブサーバが自動的に記録するログをチェックすることで、これには何の手間もいらない。しかし、レンタルサーバなどでログが自由に扱えない場合はどうしたらいいのだろう? そのひとつが、画像としてリンクされている Perl などの CGI を呼び出す方法だ。利用者に知られずこっそりとアクセスログを取るには 1x1 ピクセルの画像をそのウェブページの背景と共に表示してしまえば、そのウェブページのソースをチェックされない限り、ほとんどの場合は気づかれずにすむだろう。 そんなわけで、以下のように JavaScript と対応する Perl スクリプトで、アクセスログを記録する仕組みを作ってみた。ログの形式は Apache に準拠する(たぶん)。