phildeman has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to retrieve values from %ENV. Since I am using Catalyst, I am using $c->request to access various variables.
Some variables return values some variables return errors, such as 'Can't store CODE items at....

Is there are way to retrieve environmental variables in Catalyst that will display the following in the View:
DOCUMENT_ROOT
HTTP_COOKIE
HTTP_HOST
HTTP_REFERER
HTTP_USER_AGENT
HTTPS
PATH
QUERY_STRING
REMOTE_ADDR
REMOTE_HOST
REMOTE_PORT
REMOTE_USER
REQUEST_METHOD
REQUEST_URI
SCRIPT_FILENAME
SCRIPT_NAME
SERVER_ADMIN
SERVER_NAME
SERVER_PORT
SERVER_SOFTWARE

http://search.cpan.org/~jjnapiork/Catalyst-Runtime-5.90114/lib/Catalyst/Request.pm shows a list of variables to access values.
I tried access some values from the list, such as $c->req->params. But some give me the error "Can't store CODE items at..." or
"Can't store GLOB items at....". Any suggestions?

Replies are listed 'Best First'.
Re: Can't store CODE items at
by Your Mother (Archbishop) on Apr 18, 2017 at 21:51 UTC

    :P Catalyst::Engine.

    sub env :Global :Args(0) { use YAML; my ( $self, $c ) = @_; $c->response->content_type("text/plain"); $c->response->body( YAML::Dump( $c->engine->env ) ); }

      Hey Your Mother,

      Thanks for this snippet of code. It worked like a charm!

      All the Best.

      -Phil-

Re: Can't store CODE items at (Catalyst)
by Anonymous Monk on Apr 18, 2017 at 21:22 UTC

    Hi,

    Which version of Catalyst do you have?

      Running:
      -Perl 5.24
      -Catalyst 5.90114

      on Redhat Linux REHL 6.9