Ã˸ÅCatalyst´Â ¿ì¾ÆÇÑ MVC À¥ ÀÀ¿ë ÇÁ·Î±×·¥ ÇÁ·¹ÀÓ ¿öÅ©¸¦ Æ÷ÇÔÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. | |
Áö±Ý ´Ù¿î·Îµå |
Ã˸Š¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- Perl Artistic License
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Sebastian Riedel
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~mramberg/Catalyst-View-PSP-0.01/lib/Catalyst/Helper/View/PSP.pm
Ã˸ŠÅ±×
Ã˸Š¼³¸í
Catalyst´Â ¿ì¾ÆÇÑ MVC À¥ ÀÀ¿ë ÇÁ·Î±×·¥ ÇÁ·¹ÀÓ ¿öÅ©¸¦ Æ÷ÇÔÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Catalyst´Â ¿ì¾ÆÇÑ MVC À¥ ÀÀ¿ë ÇÁ·Î±×·¥ ÇÁ·¹ÀÓ ¿öÅ©¸¦ Æ÷ÇÔÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Æ÷°ýÀû ÀÎ ¹®¼ ¹× ÀÚ½À¼¸¦À§ÇÑ Ã˸Š:: ¼öµ¿ ¹èÆ÷¸¦À§ÇÑ Ã˸Š:: ¼öµ¿ ¹èÆ÷. # Ã˸ÅÁ¦ ¼³Ä¡ :: µµ¿ì¹Ì ¹× ±âŸ °³¹ß µµ±¸ ¿ë Devel # »õ·Î¿î ÀÀ¿ë ÇÁ·Î±×·¥ Catalyst.pl MyApp # ¸ðµ¨ Ãß°¡, ºä, ÄÁÆ®·Ñ·¯ ½ºÅ©¸³Æ® Ãß°¡ MyDatabase DBIC :: Schema Create = Dymic DBI : SQLite : / path / to / db script / myApp_create.plº¸±â myTemplate tt script / myApp_create.pl ÄÁÆ®·Ñ·¯ °Ë»ö # testserver¿¡¼ ³»Àå - »ç¿ëÇÏ·Á¸é -RÀ» »ç¿ëÇÏ¿© ÀÚµ¿À¸·Î ÀÚµ¿À¸·Î ´Ù½Ã ½ÃÀÛÇÏ¿© »ç¿ë °¡´ÉÇÑ ¸ðµç ¿É¼Ç ½ºÅ©¸³Æ® / myApp_server.pl # ¸í·É ÁÙ Å×½ºÆ® ÀÎÅÍÆäÀ̽º ½ºÅ©¸³Æ® / myApp_test.pl / yada ### in lib / myApp.pm atalyst qw / -debug /; # lib / myApp / controller / root.pm (autocreated) ÇÏÀ§ foo : global {# / foo / 1, / foo / 1 / 2 µîÀ»À§ÇÑ ±Û·Î¹ú {# ÀÚü, $ c, @args) = @_; # args´Â qw / 12 / foo / foo / 1 / 2 $ c-> stash -> {template} = 'foo.tt'; # db - stash vars¿¡¼ ÅÛÇø´ # ·è¾÷ÀÌ TT $ c-> stash -> {data}} = $ c-> ¸ðµ¨ ( 'database :: foo') -> °Ë»ö ({±¹°¡ => $) args }); if ($ c-> req-> params -> {bar}) {# ¾×¼¼½º °¡Á® ¿À±â ¶Ç´Â °Ô½Ã ¸Å°³ º¯¼ö $ c-> ¾ÕÀ¸·Î ( 'bar'); # ´Ù¸¥ µ¿ÀÛ ÇÁ·Î¼¼½º # Àü´Þ ¹Ýȯ ÈÄ ´Ù¸¥ ÀÛ¾÷ ¼öÇà}} # foo.tt TT ÅÛÇø´Àº µ¥ÀÌÅͺ£À̽º¿¡¼ ¼û±è µ¥ÀÌÅ͸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù # / bar / of / soap, / bar / of / soap / of / soap / 10, µîµî. ¼ºê ¹Ù : °æ·Î ( '/ bar / of / soap') {...} # ¸ðµç ÀÛ¾÷À» È£ÃâÇÕ´Ï´Ù. ÃÖ»óÀ§ ÄÁÆ®·Ñ·¯ ¾Æ·¡ÂÊ ÇÏÀ§ ÀÚµ¿ : °³ÀÎ {My ($ self, $ c) = @_; if (! $ c-> user_exists) {# catalyst :: plugin :: authentication $ c-> res-> ¸®µð·º¼Ç ( '/ login'); # ·Î±×ÀÎ ¸®ÅÏÀÌ ÇÊ¿äÇÕ´Ï´Ù. 0; # abort ¿äûÀ»ÇÏ°í Áï½Ã end ()} return 1; # ¼º°ø; ´ÙÀ½ µ¿ÀÛÀ¸·Î °è¼Ó ¼öÇà} # ¸ðµç ÀÛ¾÷ÀÌ ¿Ï·áµÈ ÈÄ È£Ãâ : °³ÀÎ {MY ($ self, $ c) = @_; if (scalar @ {$ c-> ¿À·ù}) {...} # ÇÚµé ¿À·ù $ C-> res-> body; #Àº ÀÌ¹Ì ÀÀ´ä $ c-> ¾ÕÀ¸·Î ( 'myApp :: View :: tt'); # ·»´õ¸µ ÅÛÇø´} ###¿¡¼ myApp / Controller / foo.pm # / foo / bar ÇÏÀ§ Ç¥½Ã ÁÙ : ·ÎÄà {...} # / blargle sub blargle for for global {...} # »öÀÎ Á¶Ä¡ ÀÏÄ¡ / foo,ÇÏÁö¸¸ / foo / 1, µîµî. ÇÏÀ§ »öÀÎ : °³ÀÎ {...} ###¿¡¼ myApp / Controller / foo / bar.pm # foo / foo / bar / baz sub sub baz : local {.. } # ù ¹ø° ·çÆ® ÀÚµ¿ÀÌ È£ÃâµÇ¸é foo ÀÚµ¿,ÀÌ ÇÏÀ§ ÀÚµ¿ : °³ÀÎ {...} # °·ÂÇÑ Á¤±Ô Ç¥Çö½Ä °æ·Îµµ °¡´ÉÇÑ ÇÏÀ§ ¼¼ºÎ »çÇ×ÀÔ´Ï´Ù. regex ( '^ Á¦Ç° / (w +) / ¼¼ºÎ $') { ³» ($ self, $ c) = @_; # URI¿¡¼ (W +) ÃßÃâ My $ Product = $ C-> Req-> ĸó -> ; } ¿ä±¸ »çÇ× : ¡¤ Perl ¿ä±¸ »çÇ× : ¡¤ Perl.
Ã˸Š°ü·Ã ¼ÒÇÁÆ®¿þ¾î
extutils :: autoinstall.
extutils :: autoinstallÀº CPANÀ» ÅëÇØ Á¾¼Ó¼ºÀ» ÀÚµ¿À¸·Î ¼³Ä¡ÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. ...
148