No description
This repository has been archived on 2026-08-22. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jan Henning Thorsen 062a3cefde 0.05 Sat Jun 19 18:31:42 CEST 2010
* Add static() as alias to my_state()
2010-06-19 18:31:43 +02:00
lib/Var 0.05 Sat Jun 19 18:31:42 CEST 2010 2010-06-19 18:31:43 +02:00
t add "static" as alias to "my_state" 2010-06-19 18:22:15 +02:00
.gitignore better formatting of code 2009-08-13 00:56:49 +02:00
Changes 0.05 Sat Jun 19 18:31:42 CEST 2010 2010-06-19 18:31:43 +02:00
Makefile.PL 0.04 Sat Jun 19 18:29:18 CEST 2010 2010-06-19 18:29:19 +02:00
README 0.05 Sat Jun 19 18:31:42 CEST 2010 2010-06-19 18:31:43 +02:00

NAME
    Var::State - Static variable in perl 5.8

VERSION
    0.05

SYNOPSIS
     use Var::State;

     sub foo {
         static my $i = 0;
         return $i++;
     }

     print foo() for(0..10); # will print 0 to 10

FUNCTIONS
  static(var)
    Does almost the same as "state" in 5.10, but it requires the variable to
    be declared with "my". See "SYNOPSIS" for example.

    This function does support list context, something "state" in 5.10 does
    not support.

  state
    See LIMITATIONS.

  import
    Will import "static()" into the current namespace.

LIMITATIONS
    Need to add "state" as a keyword, so you don't have to declare the
    variable with "my()" first. This exact problem breakes compatibility
    with 5.10's state, and therefore "t/11-state-5.10.t" is not included in
    the test-suite.

BUGS
    Please report any bugs or feature requests to "bug-var-state at
    rt.cpan.org", or through the web interface at
    <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Var-State>. I will be
    notified, and then you'll automatically be notified of progress on your
    bug as I make changes.

AUTHOR
    Jan Henning Thorsen, "<pm at flodhest.net>"

COPYRIGHT & LICENSE
    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

    Copyright (c) 2007 Jan Henning Thorsen