Hi there,

I am new to using the Mojolicious Perl mod and pretty new doing web design and I am positively stumped trying to pass parameters within a hyperlink. I would rather use the Mojolicious url_for command, but am fine specifying the hyperlink without.

Let's say there are variables $x and $y. Hyperlink text is value for $x.

One of my url_for attempts (although I see I am not encapsulating the href value in quotes:

<a href= <%= url_for("foo")%><%= x=$x&y=$y> %>$x</a>

And here is an attempt without url_for:

<%= <a href="http://foo.com/foo?x=$x&y=$y">%><%= $x %></a>

Actually, in one of my attempts (here just trying to pass one variable), I get to the url I want and I think the text of the url shows the correct syntax for passing a variable, but I do not see it. This is less generic, but:

<tr><td><a href="http://torstore01.omc.foo.com:443/device_list?id=<%= +$id %>"><%= $id %></a></td></tr>

Here is the url it goes to:

http://torstore01.omc.foo.com:443/device_list?id=568185

(Looks good to me!) And I have this asking for the parameter:

% use Data::Dumper; % use CGI; % my $cgi = new CGI; % my %input = $cgi->param(); % layout 'default'; % my $dir = '/home/tony/outage-management/testing'; % open (TEST,">$dir/device_list_test.txt"); % print TEST '%input: ', Dumper(%input);

And file device_list_test.txt contains

%input:

(The hash is empty.) Maybe I am passing the variable, but I am doing something wrong at the place where I try to fetch it?

For all I know, I am trying to do something in ways that cannot be done. Would sure appreciate a hand.

Signed,

{frazzled}


In reply to Passing Parameters via hyperlink by o2bwise

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.