logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

B::ConstOptree - Optree constant folding for $^O, $^V, and $]

Author

       Written by Alexey Tourbin <at@altlinux.org>.

Caveats

       Since regexp matching is not subject to constant folding, expressions like "$^O =~ /win32/i" will not be
       reduced.

Copying

       Copyright (c) 2012 Alexey Tourbin

       This is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
       License as published by the Free Software Foundation; either version 2 of the License, or (at your
       option) any later version.

perl v5.40.0                                       2024-10-20                                   ConstOptree(3pm)

Description

       This module propagates constant folding for $^O, $^V, and $] variables by installing custom PL_check
       handlers for numeric and string comparison opcodes.  In the handlers, references to $^O, $^V, and $]
       arguments are replaced with constant terms like "linux", v5.16.1, and 5.016001, respectively.

Name

       B::ConstOptree - Optree constant folding for $^O, $^V, and $]

Synopsis

        $ perl -MO=ConstOptree -MO=Deparse} -e \
               'require ($^O eq "MSWin32" ? "Win32.pm" : "POSIX.pm")'
        require 'POSIX.pm';
        -e syntax OK

See Also