Sponsored Content
Top Forums Programming Programming a Telegram Bot Using Node-RED, PHP, and MySQL Post 303045166 by Neo on Thursday 12th of March 2020 11:45:07 PM
Old 03-13-2020
Good job Ravinder.

Always a pleasure to see people learning new things and using that knowledge to solve real-world problems.

Can you use kind of system at your work?
This User Gave Thanks to Neo For This Post:
 

7 More Discussions You Might Find Interesting

1. Red Hat

Can't uninstall MYSQL from RED HAT ES

Hi Everyone Could you kindly advise on how I should do a chkconfig and uninstalling mysql rpm on Red hat ES.Please check the errors that I'm getting below. :eek: I need to uninstall MySQL completely from my linux system ver 2.4.21-37 and use the chkconfig command to switch it on... (15 Replies)
Discussion started by: CollenM
15 Replies

2. What is on Your Mind?

Telegram Bots - Bot Code Examples

I'm currently looking into ways to integrate the Telegram API into the forums: Telegram Bots - Bot Code Examples I'm thinking, first off, to use the Telegram API to get forum alerts and notifications (to Bot or Not?). Second, I thinking of ways to more deeply integrate Telegram into the... (5 Replies)
Discussion started by: Neo
5 Replies

3. Web Development

Node.js and mysql - ER_ACCESS_DENIED_ERROR

This problem has been killing me all day, and I cannot solve it. Basically, I am using node.js with the mysql module and it will not connect to the database. Here is the JS code snippet in node.js: app.get("/test", function(req, res) { var mysql = require("mysql"); var con =... (4 Replies)
Discussion started by: Neo
4 Replies

4. Infrastructure Monitoring

Using Node-RED and MQTT to Monitor Server and Application Stats

After setting up MQTT and testing some ESP8266 and ESP32 modules, where I noted that testing in Programming ESP32 (ESP-WROOM-32) as an MQTT Client Subscribed to Linux Server Load Average Messages, I was so impressed with MQTT that I installed MQTT on three different computers, instantly and... (2 Replies)
Discussion started by: Neo
2 Replies

5. Programming

Publish and Subscribe to AES-256 Encrypted MQTT Messages to Node-RED from PHP Scripts

Various Node-Red crypto modules do not work with PHP, so to send an encrypted message from a PHP script (in this case from a Ubuntu server) to Node-RED we need our own code. After a few hours of searching, testing various libs, more testing and debugging, I got this PHP to Node-RED code... (0 Replies)
Discussion started by: Neo
0 Replies

6. Programming

Node-RED: Writing MQTT Messages to MySQL DB with UNIX timestamp

First, I want to thank Neo (LOL) for this post from 2018, Node.js and mysql - ER_ACCESS_DENIED_ERROR I could not get the Node-RED mysql module to work and searched Google until all my links were purple! I kept getting ER_ACCESS_DENIED_ERROR with the right credentials. Nothing on the web was... (0 Replies)
Discussion started by: Neo
0 Replies

7. What is on Your Mind?

MQTT, Node-RED, Linux, Apache2, MySQL, PHP, Telegram, ESP32, ESP8266, Arduino

I have just completed the first phase of integrating all these devices and technologies: MQTT, Node-RED, Linux, Apache2, MySQL, PHP, Telegram, ESP32, ESP8266, and the Arduino Uno The glue that binds all this together is MQTT. In fact, MQTT makes this kind of integration nearly trivial to... (1 Reply)
Discussion started by: Neo
1 Replies
PERLCOMPILE(1)						 Perl Programmers Reference Guide					    PERLCOMPILE(1)

NAME
perlcompile - Introduction to the Perl Compiler-Translator DESCRIPTION
Perl has always had a compiler: your source is compiled into an internal form (a parse tree) which is then optimized before being run. Since version 5.005, Perl has shipped with a module capable of inspecting the optimized parse tree ("B"), and this has been used to write many useful utilities, including a module that lets you turn your Perl into C source code that can be compiled into a native executable. The "B" module provides access to the parse tree, and other modules ("back ends") do things with the tree. Some write it out as semi- human-readable text. Another traverses the parse tree to build a cross-reference of which subroutines, formats, and variables are used where. Another checks your code for dubious constructs. Yet another back end dumps the parse tree back out as Perl source, acting as a source code beautifier or deobfuscator. Because its original purpose was to be a way to produce C code corresponding to a Perl program, and in turn a native executable, the "B" module and its associated back ends are known as "the compiler", even though they don't really compile anything. Different parts of the compiler are more accurately a "translator", or an "inspector", but people want Perl to have a "compiler option" not an "inspector gadget". What can you do? This document covers the use of the Perl compiler: which modules it comprises, how to use the most important of the back end modules, what problems there are, and how to work around them. Layout The compiler back ends are in the "B::" hierarchy, and the front-end (the module that you, the user of the compiler, will sometimes interact with) is the O module. Here are the important back ends to know about, with their status expressed as a number from 0 (outline for later implementation) to 10 (if there's a bug in it, we're very surprised): B::Lint Complains if it finds dubious constructs in your source code. Status: 6 (it works adequately, but only has a very limited number of areas that it checks). B::Deparse Recreates the Perl source, making an attempt to format it coherently. Status: 8 (it works nicely, but a few obscure things are missing). B::Xref Reports on the declaration and use of subroutines and variables. Status: 8 (it works nicely, but still has a few lingering bugs). Using The Back Ends The following sections describe how to use the various compiler back ends. They're presented roughly in order of maturity, so that the most stable and proven back ends are described first, and the most experimental and incomplete back ends are described last. The O module automatically enabled the -c flag to Perl, which prevents Perl from executing your code once it has been compiled. This is why all the back ends print: myperlprogram syntax OK before producing any other output. The Cross Referencing Back End The cross referencing back end (B::Xref) produces a report on your program, breaking down declarations and uses of subroutines and variables (and formats) by file and subroutine. For instance, here's part of the report from the pod2man program that comes with Perl: Subroutine clear_noremap Package (lexical) $ready_to_print i1069, 1079 Package main $& 1086 $. 1086 $0 1086 $1 1087 $2 1085, 1085 $3 1085, 1085 $ARGV 1086 %HTML_Escapes 1085, 1085 This shows the variables used in the subroutine "clear_noremap". The variable $ready_to_print is a my() (lexical) variable, introduced (first declared with my()) on line 1069, and used on line 1079. The variable $& from the main package is used on 1086, and so on. A line number may be prefixed by a single letter: i Lexical variable introduced (declared with my()) for the first time. & Subroutine or method call. s Subroutine defined. r Format defined. The most useful option the cross referencer has is to save the report to a separate file. For instance, to save the report on myperlprogram to the file report: $ perl -MO=Xref,-oreport myperlprogram The Decompiling Back End The Deparse back end turns your Perl source back into Perl source. It can reformat along the way, making it useful as a deobfuscator. The most basic way to use it is: $ perl -MO=Deparse myperlprogram You'll notice immediately that Perl has no idea of how to paragraph your code. You'll have to separate chunks of code from each other with newlines by hand. However, watch what it will do with one-liners: $ perl -MO=Deparse -e '$op=shift||die "usage: $0 code [...]";chomp(@ARGV=<>)unless@ARGV; for(@ARGV){$was=$_;eval$op; die$@ if$@; rename$was,$_ unless$was eq $_}' -e syntax OK $op = shift @ARGV || die("usage: $0 code [...]"); chomp(@ARGV = <ARGV>) unless @ARGV; foreach $_ (@ARGV) { $was = $_; eval $op; die $@ if $@; rename $was, $_ unless $was eq $_; } The decompiler has several options for the code it generates. For instance, you can set the size of each indent from 4 (as above) to 2 with: $ perl -MO=Deparse,-si2 myperlprogram The -p option adds parentheses where normally they are omitted: $ perl -MO=Deparse -e 'print "Hello, world "' -e syntax OK print "Hello, world "; $ perl -MO=Deparse,-p -e 'print "Hello, world "' -e syntax OK print("Hello, world "); See B::Deparse for more information on the formatting options. The Lint Back End The lint back end (B::Lint) inspects programs for poor style. One programmer's bad style is another programmer's useful tool, so options let you select what is complained about. To run the style checker across your source code: $ perl -MO=Lint myperlprogram To disable context checks and undefined subroutines: $ perl -MO=Lint,-context,-undefined-subs myperlprogram See B::Lint for information on the options. Module List for the Compiler Suite B This module is the introspective ("reflective" in Java terms) module, which allows a Perl program to inspect its innards. The back end modules all use this module to gain access to the compiled parse tree. You, the user of a back end module, will not need to interact with B. O This module is the front-end to the compiler's back ends. Normally called something like this: $ perl -MO=Deparse myperlprogram This is like saying "use O 'Deparse'" in your Perl program. B::Concise This module prints a concise (but complete) version of the Perl parse tree. Its output is more customizable than the one of B::Terse or B::Debug (and it can emulate them). This module useful for people who are writing their own back end, or who are learning about the Perl internals. It's not useful to the average programmer. B::Debug This module dumps the Perl parse tree in verbose detail to STDOUT. It's useful for people who are writing their own back end, or who are learning about the Perl internals. It's not useful to the average programmer. B::Deparse This module produces Perl source code from the compiled parse tree. It is useful in debugging and deconstructing other people's code, also as a pretty-printer for your own source. See "The Decompiling Back End" for details about usage. B::Lint This module inspects the compiled form of your source code for things which, while some people frown on them, aren't necessarily bad enough to justify a warning. For instance, use of an array in scalar context without explicitly saying "scalar(@array)" is something that Lint can identify. See "The Lint Back End" for details about usage. B::Showlex This module prints out the my() variables used in a function or a file. To get a list of the my() variables used in the subroutine mysub() defined in the file myperlprogram: $ perl -MO=Showlex,mysub myperlprogram To get a list of the my() variables used in the file myperlprogram: $ perl -MO=Showlex myperlprogram [BROKEN] B::Terse This module prints the contents of the parse tree, but without as much information as B::Debug. For comparison, "print "Hello, world."" produced 96 lines of output from B::Debug, but only 6 from B::Terse. This module is useful for people who are writing their own back end, or who are learning about the Perl internals. It's not useful to the average programmer. B::Xref This module prints a report on where the variables, subroutines, and formats are defined and used within a program and the modules it loads. See "The Cross Referencing Back End" for details about usage. KNOWN PROBLEMS
BEGIN{} blocks are executed while compiling your code. Any external state that is initialized in BEGIN{}, such as opening files, initiating database connections etc., do not behave properly. To work around this, Perl has an INIT{} block that corresponds to code being executed before your program begins running but after your program has finished being compiled. Execution order: BEGIN{}, (possible save of state through compiler back-end), INIT{}, program runs, END{}. AUTHOR
This document was originally written by Nathan Torkington, and is now maintained by the perl5-porters mailing list perl5-porters@perl.org. perl v5.12.5 2012-11-03 PERLCOMPILE(1)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy