Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    Web::Simple 0.020

    Download button

    No screenshots available
    Downloads: 224  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Arthur Axel Schmidt | More programs
    Perl Artistic License / FREE
    September 22nd, 2012, 09:49 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Web::Simple description

    A quick and easy way to build simple web applications

    The only public interface the Web::Simple Perl module itself provides is an import based one -

     use Web::Simple 'NameOfApplication';

    This imports 'strict' and 'warnings FATAL => "all"' into your code as well, so you can skip the usual

     use strict;
     use warnings;


    provided you 'use Web::Simple' at the top of the file. Note that we turn on *fatal* warnings so if you have any warnings at any point from the file that you did 'use Web::Simple' in, then your application will die. This is, so far, considered a feature.

    Calling the import also makes NameOfApplication isa Web::Simple::Application - i.e. does the equivalent of

     {
     package NameOfApplication;
     use base qw(Web::Simple::Application);
     }


    It also exports the following subroutines:

     default_config(
     key => 'value',
     ...
     );

     dispatch { sub (...) { ... }, ... };

     response_filter { ... };

     redispatch_to '/somewhere';

     subdispatch sub (...) { ... }


    and creates a $self global variable in your application package, so you can use $self in dispatch subs without violating strict (Web::Simple::Application arranges for dispatch subroutines to have the correct $self in scope when this happens).

    Finally, import sets

     $INC{"NameOfApplication.pm"} = 'Set by "use Web::Simple;" invocation';

    so that perl will not attempt to load the application again even if

     require NameOfApplication;

    is encountered in other code.

    SYNOPSIS

     #!/usr/bin/perl

     use Web::Simple 'HelloWorld';

     {
     package HelloWorld;

     dispatch {
     sub (GET) {
     [ 200, [ 'Content-type', 'text/plain' ], [ 'Hello world!' ] ]
     },
     sub () {
     [ 405, [ 'Content-type', 'text/plain' ], [ 'Method not allowed' ] ]
     }
     };
     }

     HelloWorld->run_if_script;



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    web applications | Perl module | Perl | web | development

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM