Can't call method "param" on an undefined value at /Users/me/PERL/ScriptDir/dev.pl line 1026.

This error message is telling you something very specific: you are invoking a method (called param) on something ($cgi) but the thing you are invoking it on is not a CGI::Tiny object but undef.

So all the rest is irrelevant: $cgi is not the object it is supposed to be, but undef. So you need to look at where $cgi is set, and diagnose what went wrong there (or somewhere in the pathway from there to line 1026).

Once you have fixed that, you can go back to your original line my $bookparam = $cgi->param('book') || ''; and I imagine it should work.


In reply to Re: CGI::Tiny versus undefined parameter/form field by hv
in thread CGI::Tiny versus undefined parameter/form field by Polyglot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.