Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Re: Re: Do regex using hash keys to wrapped template tokens

by little (Curate)
on Feb 14, 2002 at 11:20 UTC ( [id://145422]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Do regex using hash keys to wrapped template tokens
in thread Do regex using hash keys to wrapped template tokens

OK, buddy. :-)
When you don't describe your problem more precisely, don't read even the faq, don't even take advice given, don't report any observed behaviour of your script nor support any errors occured, well, I can't help you in this case.
A simple "Go. No Go." is not enough.
And get rid of that for loop, it seems useless. ;-)

Have a nice day
All decision is left to your taste
  • Comment on Re: Re: Re: Do regex using hash keys to wrapped template tokens

Replies are listed 'Best First'.
Re: Re: Re: Re: Do regex using hash keys to wrapped template tokens
by S_Shrum (Pilgrim) on Feb 14, 2002 at 11:48 UTC

    My bad. Here's the long version.

    I have not seen a implementation of $input->param(<red>$1</red>). I assumed it needed to be in a for loop.

    I placed the code you supplied into my script (sans for loop) but see nothing happening in the final displayed result (tokens are displayed).

    More specifically:

    In the template file (which is a html page) there are the following tokens which are wrapped with a variable character that is defined within the script as '$' but can be overridden by passing a different value in the script call (&wrapper=somevalue):

    icon -> $icon$ title -> $title$ sort -> $sort$
    In my script call, I pass the following parameters:
    ?file=whatsnew.dat &for=Soaring &in=Area &max=10 &order=desc &sort=Date &icon=address.gif &title=Testing

    Of the parameters passed, three should perform replacements. What I am getting back in $page_template after s&r is:

    icon -> $icon$ title -> $title$ sort -> $sort$

    ...as if the search did not find matches. Since this search involves a hash, I am wondering if that is what it is looking for: CGI->HASH(...) vs the value of $input->param(...). My understanding is that the w+ (lookahead) should take care of this.

    No errors are displayed.

    ======================
    Sean Shrum
    http://www.shrum.net

      No, it didn't find the replacements I guess.
      # if called with no args param returns a list of the keys my $w = $input->param(); # here you should validate the values for the given keys # and eventually set them to default values before proceeding # $1 is just _the first succesfull match_ $page_template =~ s/\$(\w+)\$^\w/$input->param($1)/eg; $page_template =~ s/\$(\w+)\$lc_/lc($input->param($1))/eg; $page_template =~ s/\$(\w+)\$uc_/uc($input->param($1))/eg;

      Have a nice day
      All decision is left to your taste

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://145422]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-26 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found