Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Adding simple HTTP controls to existing code

by Bod (Parson)
on Jul 05, 2021 at 20:54 UTC ( [id://11134683]=note: print w/replies, xml ) Need Help??


in reply to Adding simple HTTP controls to existing code

For my Controlling USB on Raspberry Pi project I set up a tunnel using ngrok and had an HTTP listener on the Raspberry Pi using HTTP::Server::Simple. It works very well...

Here is the bit that handles the HTTP requests...

package Bod::Curtains::Server; VERSION = 1.0 use HTTP::Server::Simple::CGI; use base qw(HTTP::Server::Simple::CGI); use Bod::Curtains::Control; use HTTP::Tiny; use Sys::Hostname; use strict; my $control = Bod::Curtains::Control->new; my $host = hostname; sub handle_request { my ($self, $request) = @_; print "HTTP/1.0 200 OK\r\n"; print $request->header; print "SUCCESS\n"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-24 08:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found