2010-08-01から1ヶ月間の記事一覧

オブジェクトに任意のメソッドが存在するか確認をする

use strict; use warnings; use Sample; my $yourclass = Sample->new(); if ($yourclass->can('yourmethod')) { print "yourmethod is given\n"; } else { print "yourmethod is not given\n"; } can は Perl でオブジェクトを扱うときのユニバーサル・メソ…