How to display an image using Perl

I want to write a perl script to automatically enter the site and do some interesting things. The problem is that the website I want to access has a captcha image. I have no way to protect it, so I need to read the image and then display the image to the user so that the user can read the characters in the image, and then enter the character on the command line back into the program. I want to know what is the easiest way to display an image to a user?

Thanks.

+4
source share
2 answers

First, you can use LWP :: Simple to extract the image and save it to disk.

Subsequently, the simplest thing in Windows is to do

system("C:\\imagepath\\foo.jpg"); 

which displays the image in the default application, which is used to display it.

In OS X you can do

  system("open ~/imagepath/foo.jpg"); 

In freedesktop.org compatible systems you can do

  system("xdg-open ~/imagepath/foo.jpg"); 

This is due to switching between the command line application and the designated OS to view the image. If you want it to be more seamless, you can use the Perl GUI library and create a window with a loaded image

+9
source

Open on web page?

Create the application as a web application, just upload the image using LWP, then display it on your page (CGI or Dancer, etc.).

You can put a simple text form to enter the code.

+1
source

Source: https://habr.com/ru/post/1391461/


All Articles