Online Retail with Perl

Document Sample
scope of work template
							                      

Online Retail with Perl


                Jon Allen


 http://perl.jonallen.info - jj@jonallen.info

                           Background

   •  www.pennysarcade.co.uk launched November 08

   •  Lots of CPAN used…

       –  169 CPAN distributions (including dependencies)

       –  Three key modules power the site:

           •  Catalyst (web framework)

           •  Handel (basket & order processing)

           •  OpenThought (AJAX user interface)



   •  Proud to use Perl! 


Online Retail with Perl
                             perl.jonallen.info

                           Catalyst intro (1)

   •  Very different to “traditional” CGI programming

       –  No scripts

       –  Website is a complete application

       –  URL dispatch controls which methods are invoked

           •  http://mysite.com/view/image/1234/square

           •  MySite::View::image(1234,’square’);

       –  Very flexible

           •  Method behaviour defined using attributes

           •  Multiple methods can be called in a single request



Online Retail with Perl
                                perl.jonallen.info

                           Catalyst intro (2)

   •  Layered architecture

       –  Model (database / business logic)

       –  Controller (application logic)

       –  View (output)

   •  Example – customer receipts

       –  Model = data logic, delivery calculation, etc

       –  Returns an “order” object

       –  HTML View produces web page

       –  PDF View produces shipping receipt



Online Retail with Perl
                                   perl.jonallen.info

            Why did we choose Catalyst?

   •  Proven, stable technology

   •  Fantastic documentation

   •  Plugins

       –  Session handling, access control, etc

   •  Support – community and commercial

   •  Quick to develop in

       –  Easy to install, built-in development server

   •  Simple deployment

       –  FastCGI application server


Online Retail with Perl
                                  perl.jonallen.info

                      e-Commerce basics

                       •  SKU = Stock Keeping Unit

            

         SKUs              –  Represents an individual item sold, i.e. a
                              product in 2 colours and 3 sizes = 6 SKUs



       Baskets
             

                       •  Shopping basket = temporary storage

                           –  User browses site, adds items to basket



                       •  Orders = the good part!

             

        Orders
                           –  Basket converted to order = revenue



Online Retail with Perl
                                  perl.jonallen.info

                      e-Commerce basics

                       •  SKU = Stock Keeping Unit

            

         SKUs              –  Represents an individual item sold, i.e. a
                              product in 2 colours and 3 sizes = 6 SKUs



       Baskets
             

                       •  Shopping basket = temporary storage

                           –  User browses site, adds items to basket

           

      Handel
                       •  Orders = the good part!

             

        Orders
                           –  Basket converted to order = revenue



Online Retail with Perl
                                  perl.jonallen.info

                              Handel

   •  Not a complete e-Commerce package

       –  Toolkit for building e-Commerce applications

       –  This is a good thing

   •  Manages baskets and orders

       –  Object-oriented

       –  Add / Remove / Update / Inspect methods

   •  Catalyst model

   •  Easy to subclass

       –  e.g. add custom delivery calculations / data fields



Online Retail with Perl
                               perl.jonallen.info

                           Taking payments

   •  Merchant account

       –  Lets you accept credit / debit cards

       –  Different types: Internet, MOTO, Retail

       –  Available from most banks or American Express

       –  Small cost per transaction

   •  Payment processing

       –  XML over HTTPS

       –  Complex security requirements – PCI-DSS

       –  Often easier to outsource this bit!



Online Retail with Perl
                             perl.jonallen.info

                               Payment process

     Order amount in                                                     Customer enters
     HTML form
                                                          credit card details



                          https://yoursite/           https://payment/
                                              POST

                          checkout
                   processor



     Basket converted
     to order (Handel)
                                                          Acquiring bank
                                                                                 (3D Secure)


                          https://yoursite/
                          success

                                                      https://payment/
                                              POST

                                                      processor

                          https://yoursite/
                          fail

                                                                         Success or failure
                                                                         page displayed



Online Retail with Perl
                                                      perl.jonallen.info

                           User Interface

   •    Crucial to the shopping experience

   •    OpenThought – AJAX transport library

   •    See http://perl.jonallen.info/talks/lightweightajax 

   •    Developed a Catalyst view for OpenThought

        –  Not on CPAN yet, but will be



   •  Live demo

        –  Weather permitting! 




Online Retail with Perl
                            perl.jonallen.info

                     Other useful things (1)

   •  PDF::Reuse

   •  Modifies existing PDF files

   •  Great for printing receipts

       –  Design template (e.g. in Microsoft Word)

       –  Save as PDF

       –  Create a Catalyst view using PDF::Reuse to insert
          customer details from Handel model

       –  Much less work than coding the full PDF document by
          hand



Online Retail with Perl
                            perl.jonallen.info

                     Other useful things (2)

                             •  Read Léon’s book





Online Retail with Perl
                        perl.jonallen.info

                     Other useful things (2)

                             •  Read Léon’s book

                             •  Buy Léon’s book!

                             •  www.tickmyboxes.com


                             •  100-point checklist of best
                                practice

                             •  Lots of useful tips 




Online Retail with Perl
                          perl.jonallen.info

                           Conclusion

   •  Site was delivered under budget and ahead of
      schedule

       –  Could not have achieved this without Perl and CPAN



   •  Development and Operations are the easy bits…

       –  Marketing and Promotion is where it gets difficult!



   •  Treat your home, treat someone special, treat
      yourself… at www.pennysarcade.co.uk


Online Retail with Perl
                               perl.jonallen.info

                                  Fin!



                  Thank you for listening!


                            Any questions?

                     http://perl.jonallen.info/talks 





Online Retail with Perl
                                 perl.jonallen.info


						
Related docs