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

    Coro::Localize 0.1.2

    Download button

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

    License / Price:

    Last Updated:

    Category:
    Rebecca Turner | More programs
    Perl Artistic License / FREE
    July 10th, 2012, 05:37 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    Coro::Localize description

    Localize variables to a coroutine

    Coro::Localize provides a new keyword, "corolocal" that works will localize a variable to a particular coroutine. This allows you to have thread-local values for global variables. It can localize scalars, arrays and hashes.

    SYNOPSIS

     use feature qw( say );
     use Coro;
     use Coro::EV;
     use Coro::Localize;
     # Or with Syntax::Feature:
     # use syntax qw( corolocal );
     
     our $scalar = "main loop";
     
     async {
     corolocal $scalar = "thread 1";
     say "# 1 - $scalar";
     cede;
     say "# 3 - $scalar";
     cede;
     say "# 5 - $scalar";
     };
     
     async {
     corolocal $scalar = "thread 2";
     say "# 2 - $scalar";
     cede;
     say "# 4 - $scalar";
     cede;
     say "# 6 - $scalar";
     };

     say "# starting $scalar";
     EV::loop;
     say "# complete $scalar";


    # Will print:

     # starting main loop
     # 1 - thread 1
     # 2 - thread 2
     # 3 - thread 1
     # 4 - thread 2
     # 5 - thread 1
     # 6 - thread 2
     # complete main loop



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    localize variables | Perl module | Perl | localize | variables

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

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