The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Term::QRCode::Compact - create QR codes for display in the terminal

SYNOPSIS

  use Term::QRCode::Compact 'qr_code_as_text';
  print qr_code_as_text(text => 'https://metacpan.org/module/Term::QRCode::Compact');

  # Output:
  #
  #
  #  ██████████████  ████    ██████████  ██    ██████    ██████████████
  #  ██          ██    ██      ████      ████    ██      ██          ██
  #  ██  ██████  ██    ████████  ████  ██████████        ██  ██████  ██
  #  ██  ██████  ██  ██████        ██████  ██      ██    ██  ██████  ██
  #  ██  ██████  ██  ████      ██    ████  ██    ████    ██  ██████  ██
  #  ██          ██  ██  ██    ██  ██        ██          ██          ██
  #  ██████████████  ██  ██  ██  ██  ██  ██  ██  ██  ██  ██████████████
  #                  ██      ██  ██    ████████████  ██
  #  ██      ██  ██████    ██      ██████    ████████████████████    ██
  #  ██████          ██  ██          ██████  ██    ██  ██      ████
  #  ██          ████    ██  ████████    ██  ████████████      ██
  #          ████    ████    ████          ██████████                ██
  #      ██████████  ██    ██  ██  ████    ██  ████  ██  ██  ████  ██
  #  ██  ████  ██          ████  ██    ████████    ██  ██  ██
  #          ██  ██  ████  ██      ██    ██  ██████████████    ██████
  #  ██    ██  ██      ██  ██████  ████████    ██      ████
  #    ██  ████  ██  ██████████        ██  ████████  ██  ██  ████████
  #          ██    ██████  ██    ████    ██        ██  ██      ████
  #  ████  ████████  ████    ████████  ██      ██████  ██  ██  ██
  #      ██        ██  ██        ████  ██████  ██  ██████  ██      ██
  #    ████████████████  ██    ██        ██████████  ██████  ████
  #  ████  ██  ██      ██  ██████    ██    ██  ██          ██    ████
  #      ██████  ████████████  ████  ████████      ██  ████        ██
  #                ████  ████  ██      ██  ████████    ██  ████    ██
  #  ████  ██    ██  ████  ██  ██████  ██      ██  ████████████████████
  #                  ██  ██    ██  ██████          ████      ██  ████
  #  ██████████████  ██████  ████  ████  ██  ██  ██  ██  ██  ████  ██
  #  ██          ██    ██████  ██████      ██████    ██      ██      ██
  #  ██  ██████  ██  ████    ██████████      ██████  ████████████  ████
  #  ██  ██████  ██    ████    ██        ██████████████  ██████  ██
  #  ██  ██████  ██    ████  ██    ██  ████              ██████████
  #  ██          ██    ██      ██  ████████  ██████  ██  ██
  #  ██████████████  ██  ██████        ██  ████████  ████        ██  ██
  #

  use Term::QRCode::Compact 'qr_code_as_text';
  print qr_code_as_text(
      charset => 'ascii_1x1',
      text => 'Hello'
  );

  # Output

  ############################        ################    ############################
  ############################        ################    ############################
  ####                    ####                    ####    ####                    ####
  ####                    ####                    ####    ####                    ####
  ####    ############    ####    ####    ####    ####    ####    ############    ####
  ####    ############    ####    ####    ####    ####    ####    ############    ####
  ####    ############    ####    ####    ####            ####    ############    ####
  ####    ############    ####    ####    ####            ####    ############    ####
  ####    ############    ####    ########        ####    ####    ############    ####
  ####    ############    ####    ########        ####    ####    ############    ####
  ####                    ####    ########    ####        ####                    ####
  ####                    ####    ########    ####        ####                    ####
  ############################    ####    ####    ####    ############################
  ############################    ####    ####    ####    ############################
                                  ####    ####
                                  ####    ####
  ####    ####################        ####    ####        ####################
  ####    ####################        ####    ####        ####################
              ####                ####        ################        ########    ####
              ####                ####        ################        ########    ####
          ####################        ########    ####    ########    ############
          ####################        ########    ####    ########    ############
          ####        ####    ########    ####################        ########
          ####        ####    ########    ####################        ########
      ############        ####################    ####        ####                ####
      ############        ####################    ####        ####                ####
                                  ####            ####        ####    ####
                                  ####            ####        ####    ####
  ############################        ####    ####    ####        ####    ########
  ############################        ####    ####    ####        ####    ########
  ####                    ####    ####    ####                ####################
  ####                    ####    ####    ####                ####################
  ####    ############    ####    ####        ####    ####        ####        ####
  ####    ############    ####    ####        ####    ####        ####        ####
  ####    ############    ####    ########    ####################    ####
  ####    ############    ####    ########    ####################    ####
  ####    ############    ####    ########        ####    ########        ####
  ####    ############    ####    ########        ####    ########        ####
  ####                    ####        ####    ################    ############
  ####                    ####        ####    ################    ############
  ############################    ########        ####            ####        ####
  ############################    ########        ####            ####        ####

FUNCTIONS

qr_code_as_text

  say qr_code_as_text( text => 'hello' );

Returns a string with newlines that represents the QR-Code.

Options

text

The text to turn into a QR-Code

charset
  charset => 'utf8',

The charset to use when rendering the QR-Code, default is utf8.

dimensions

Optional

  dimensions => '1x2',

The number of pixels per returned character. Currently for ASCII the dimensions the dimensions are 2x1 for ascii and 2x1 for utf8.

level

Optional

  level => 'L',

The level of error correction, 'H', 'M' or 'L'. Default is 'M'.

SEE ALSO

Text::QRCode - needs an update to support . in @INC

Term::QRCode - needs Text::QRCode