Hello! So an example, on the page we will display the image using a script, in the script we write:

print "Location: <адрес нашей картинки>\n\n"; 

in html:

 <img src=".../НашСкрипт.cgi?<Какие то параметры>"> 

As a result, our picture will appear on the page (the simplest counter works like this). And I need, instead of a picture, the script returns a string, "1.23" for example (depending on the parameters passed to it). Something like: return "1.23"; Those. there is for example a tag:

 <b>Что прописать в скрипте и как его отсюда вызвать, что бы здесь появилось - 1.23</b> 

The bottom line is that it is not desirable to make the page dynamic and completely output by the script, as well as make some other changes to the html code. Now on the page and spelled:

 <b>1.23</b> 

I need to change the 1.23 script. I hope the question is clear. Thank!

  • not clear question. you either make the page dynamic or not. html is not a dynamic language. You can of course with the help of js some parameters set but in my opinion you just do not understand what you want. - zb '
  • not doing dynamic. In the example with the picture, I showed how to transfer this or that picture to the page using the conditions passed by the parameters to the script. I need text instead of a picture. Maybe you can not just? - AIex
  • @Alex do you understand the semantic difference between the phrase "dynamic page" and "static page"? meditate just 10 minutes on this topic. - zb '
  • Do an example with a picture on a static page. Be surprised. - AIex
  • wonder what? that the picture is generated by perl? you have three options: generate the entire response with the perl-pom. generate a request with the ajax-pom to generate a request with the iframe pom -u. - zb '

2 answers 2

In the script write:

 print("Content-Type: text/html\r\n\r\n"); print("1.23"); 

On the page use SSI :

 <!--#include virtual="script.cgi"--> 
  • SSI! I thought about it! Thank! And without this in any way? ) - AIex
  • why SSI if there and so perl is? - zb '
  • dionys, I'm just not sure if SSI is supported ... - AIex
  • @eicto, because there is a static page and you need to add dynamic data to it. - dionys
  • @Alex, you need to check. If there is no SSI, there will be other solutions. - dionys pm
 dancer -a MyWeb::App cd MyWeb-App C:\TCPU59\utils\job\05062013\dance\MyWeb-App>bin\app.pl [16132] core @0 .000008> loading Dancer::Handler::Standalone handler in c:/Dwimperl /perl/site/lib/Dancer/Handler.pm l. 46 [16132] core @0 .000229> loading handler 'Dancer::Handler::Standalone' in c:/Dwimperl/perl/site/lib/Dancer.pm l. 462 >> Dancer 1.3092 server 16132 listening on http://0.0.0.0:3000 == Entering the development dance floor ... 

ctrl-c

add to bin \ app.pl

 #!C:\Share\Dwimperl\perl\bin\perl.exe use Dancer; use MyWeb::App; get '/hello/:name' => sub { return "Why, hello there " . params->{name}; }; dance; 

we request in the browser http: // localhost: 3000 / hello / bob we get Why, hello there bob we rule as in your example

 #!C:\Share\Dwimperl\perl\bin\perl.exe use utf8; use Dancer; use MyWeb::App; get '/hello/:name' => sub { return "<b>Что прописать в скрипте и как его отсюда вызвать, что бы здесь появилось - ".params->{name}."</b>"; }; dance; 

run

 http://localhost:3000/hello/1.23 

see:

 Что прописать в скрипте и как его отсюда вызвать, что бы здесь появилось - 1.23 

ps1 text in the script must be in utf-8 encoding

ps2 http://www.perldancer.org/quickstart

  • 2
    Or Mojolicious :: Lite - Error