Catalystã®æ¡å¼µã¯$cã ããããªãYOï¼
ã¯ããã«
è¯ãPluginãæ¸ãã£ã¦ãªãã¨ã¾ãè¦ãã®ããこれã§ãããã
åºæ¬çã«ã¯$cã«ã¡ã½ããã追å ããã£ã¦ã®ãæ¬æ¥ã®ããæ¹ãªãã§ããã©ã
å¥ã«ãããå®ããªããè¡ããªãã£ã¦è¨³ãããªãã§ãã
è¯ããµã³ãã«
MD5ã®ä¾ãã½ã¼ã¹è¦ã¦è§£èª¬ããã¨ã
package Catalyst::Plugin::Upload::MD5; use strict; use Catalyst::Request::Upload; use Digest::MD5; our $VERSION = '0.01'; { package Catalyst::Request::Upload; sub md5sum { my $self = shift; unless ( $self->{md5sum} ) { $self->{md5sum} = Digest::MD5->new->addfile( $self->fh )->hexdigest; } return $self->{md5sum}; } } 1;
ã£ã¦æãã§Catalystã®ä»ã®ã¢ã¸ã¥ã¼ã«ã®packageãæå®ãã¦ã¡ã½ããã追å ããã ãã
ããã®ä¾ã ã¨Catalyst::Request::Uploadã«å¯¾ãã¦ã¡ã½ããã®è¿½å ãããã
Pluginãªã®ã§ãsetup_pluginsã§å½ç¶ãã¼ããã¦ãããã
åºæ¬@ISAã«ã¶ã£ããã ãã§ããã©ãç¹ã«è¿½å ããã¡ã½ããã¯ç¡ãããã®å®ç¾©ã®ã¿èªã¾ããã®ã§ãæ°ããªæ©è½ã追å ããäºãå¯è½ã§ããã¼ã£ã¦è©±ã
ããã§Engineã ã¨ãDispacherã¨ãã«ã¡ããæ©è½è¿½å ã£ã¦ã®ãå¯è½ã§ããã