Skip to content

Does cgi no longer work? #83

@rubyFeedback

Description

@rubyFeedback

I have this code in a .cgi file:

#!/usr/bin/ruby -w
# Encoding: UTF-8
# frozen_string_literal: true
# ============================================================================ #
require "cgi"
cgi = CGI.new
value = cgi['field_name'] # => "123"
cgi['flowerpot'] # => ""
fields = cgi.keys # => [ "field_name" ]

cgi.has_key?('field_name') # => true
cgi.include?('field_name') # => true
cgi.include?('flowerpot') # => false

However had this fails via:

/home/x/data/programming/ruby/src/web/lib/web/examples/cgi/006_testing_simple_cgi_params.cgi:9:
warning: assigned but unused variable - value
/home/x/data/programming/ruby/src/web/lib/web/examples/cgi/006_testing_simple_cgi_params.cgi:11:
warning: assigned but unused variable - fields

/home/x/data/programming/ruby/src/web/lib/web/examples/cgi/006_testing_simple_cgi_params.cgi:7:
warning: CGI library is removed from Ruby 3.5. Please use cgi/escape instead for CGI.escape and CGI.unescape features.

  If you need to use the full features of CGI library, Please install cgi gem.
        /home/x/data/programming/ruby/src/web/lib/web/examples/cgi/006_testing_simple_cgi_params.cgi:9:in     '<main>': undefined method '[]' for an instance of CGI (NoMethodError)

  value = cgi['field_name'] # => "123"
             ^^^^^^^^^^^^^^

The cgi code I got from the main README. I swear this used to work in the past, but suddenly
it seems I no longer have access to cgi even after installing the gem. Could you guys perhaps
add a standalone .cgi file, one that works? For some reason lately I am increasingly getting
so many problems with ruby that I did not have in the past. Also with ruby-gtk3 for instance.
Are things breaking down suddenly? Or am I the only one with that observation? It does not
happen with every gem though, so it seems to be a problem with a few gems more than with
all projects. Finding up to date documentation is also becoming harder, many of those
externalized gems seem to quickly end up into a non-functional, unmaintained state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions