Giter VIP home page Giter VIP logo

lexical-select's Introduction

NAME
    Lexical::select - provides a lexically scoped currently selected
    filehandle

VERSION
    version 0.10

SYNOPSIS
      use Lexical::select;

      open my $fh, '>', 'fubar' or die "Oh noes!\n";

      {
        my $lxs = lselect $fh;

        print "Something wicked goes to \$fh \n";

      }

      print "Back on STDOUT\n";

DESCRIPTION
    Changing the currently selected filehandle with "select" and changing it
    back to the previously selected filehandle can be slightly tedious.
    Wouldn't it be great to have something handle this boilerplate,
    especially in lexical scopes.

    This is where Lexical::select comes in.

    Lexical::select provides the "lselect" function. As demonstrated in the
    "SYNOPSIS", "lselect" will change the currently selected filehandle to
    the filehandle of your choice for the duration of the enclosing lexical
    scope.

    It should be noted that the duration of the selected filehandle is
    limited to the lexical scope, not the effects of the selected
    filehandle.

FUNCTIONS
    Functions exported by default.

    "lselect"
        Takes one parameter, a "filehandle" that will become the currently
        selected filehandle for the duration of the enclosing scope.

        Returns an object, which provides the "restore" method.

        You can then either "restore" the currently selected filehandle back
        manually or let the object fall out of scope, which automagically
        restores.

METHODS
    "restore"
        Explicitly restores the currently selected filehandle back to the
        original filehandle. This is called automagically when the object is
        "DESTROY"ed, for instance when the object goes out of scope.

SEE ALSO
    SelectSaver

AUTHOR
    Chris Williams <[email protected]>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2014 by Chris Williams.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

lexical-select's People

Contributors

bingos avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.