How to get the exact, full version number of Perl that's installed? - perl

I know I've got Perl 5.20.1.1 installed. But can I determine that programmatically?
$] only gives the revision, version and sub-version, i.e. 5.020001 for me, meaning 5.20.1.
The Config module (documented here) doesn't seem to give anything deeper than that. For me:
perl -MConfig -e 'foreach (sort keys %Config) { print "$_ -> $Config{$_}\n" if /version|revision/io; }'
gives:
PERL_API_REVISION -> 5
PERL_API_SUBVERSION -> 0
PERL_API_VERSION -> 20
PERL_REVISION -> 5
PERL_SUBVERSION -> 1
PERL_VERSION -> 20
Revision -> $Revision
SUBVERSION -> 1
api_revision -> 5
api_subversion -> 0
api_version -> 20
api_versionstring -> 5.20.0
ccversion ->
d_inc_version_list ->
d_libm_lib_version ->
db_version_major -> 0
db_version_minor -> 0
db_version_patch -> 0
gccversion -> 4.8.3
gnulibc_version ->
ignore_versioned_solibs ->
inc_version_list ->
inc_version_list_init -> 0
revision -> 5
subversion -> 1
version -> 5.20.1
version_patchlevel_string -> version 20 subversion 1
versiononly ->
I don't think there's anything in there that gives any more information, but it probably doesn't help that in my case the sub-version number is the same as the sub-sub-version number!
Is there anywhere else I can look? Or have I perhaps missed something in %Config?

Official Perl releases only have three parts. "5" is the language, "20" is the major version and "1" is the minor version. Anything more than that was added by someone else (at a guess, whoever packaged the Perl you're using), so you probably will not find it from inside Perl.

Related

How to setup I2C on NodeMCU?

I'm trying to get a LIDAR-Sensor (VL53L1X) working. I connected the Clk-Pin and the SDA-Pin to my Arduino. Then I run the example script (this one). This worked perfectly fine. Then I tried this on my NodeMCU. I connected D1 with CLK and D2 with SDA. I added the Pins in the Wire.begin() line:
Wire.begin(D2, D1);
Now I got this error message:
19:36:40.889 -> load 0x4010f000, len 1384, room 16
19:36:40.889 -> tail 8
19:36:40.889 -> chksum 0x2d
19:36:40.889 -> csum 0x2d
19:36:40.889 -> v8b899c12
19:36:40.889 -> ~ld
19:36:40.957 -> Failed to detect and initialize sensor!
What I'm doing wrong?
I found out that my NodeMCU was broken

why does lldb skips this line?

I am currently trying to learn swift and while I was coding some dummy stuff, I noticed the xcode is skipping some lines and sometimes stops on weird lines . my env: macos sierra,xcode Version 8.2.1 (8C1002)
since xcode is skipping some lines , I thought the problem is from code optimisation , then I switched to terminal to debug, below is the input&output
I compiled using
swiftc -g -Onone *.swift
then
load it with lldb
lldb main
set breakpoint on lint 18 as shown below and process run with "r"
17 do {
-> 18 try StaticM.teststatic2()
19 print (1)
20 }catch {
21
(lldb) thread step-in
Process 963 stopped
* thread #1: tid = 0x86e1, 0x0000000100001f6a main`static StaticM.teststatic2(self=main.StaticM, $error=Error # 0x00007fff5fbffac0) throws -> () + 26 at staticExt.swift:13, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x0000000100001f6a main`static StaticM.teststatic2(self=main.StaticM, $error=Error # 0x00007fff5fbffac0) throws -> () + 26 at staticExt.swift:13
10 public extension StaticM {
11 #discardableResult
12 public static func teststatic2() throws {
-> 13 var asdf=2;
14 let sdfgsdfg=2;
15 print(sdfgsdfg);
16 print (asdf);
(lldb) n
Process 963 stopped
* thread #1: tid = 0x86e1, 0x0000000100001f72 main`static StaticM.teststatic2(self=main.StaticM, $error=Error # 0x00007fff5fbffac0) throws -> () + 34 at staticExt.swift:15, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x0000000100001f72 main`static StaticM.teststatic2(self=main.StaticM, $error=Error # 0x00007fff5fbffac0) throws -> () + 34 at staticExt.swift:15
12 public static func teststatic2() throws {
13 var asdf=2;
14 let sdfgsdfg=2;
-> 15 print(sdfgsdfg);
16 print (asdf);
17 asdf += 1;
18 }
(lldb) process continue
Process 963 resuming
2
2
1
Process 963 exited with status = 0 (0x00000000)
(lldb)
question is , after I go to next line using "n" in lldb, why lldb skips line 14 of staticExt.swift and jumps straight to line 15 ?
also , sometimes when trying to debug some other program, I click on "step-in" in xcode, it stops on the declaration line of the func instead of first line in the code block, I clicked stepover , it goes back to the caller func line instead of executing the first line of that func.
in all,programe works , but why lldb jumps even with -Onone and -g ?
could you please let me where can I find more info ?
thank you very much.
Swift's basic types (Int's, Strings, etc.) are formally somewhat heavy-weight - for instance in your example:
(lldb) expr --raw -- asdf
(Swift.Int) $R0 = {
_value = 3
}
To make performance acceptable even though this is true, the swift compiler "unboxes" these types in common operations and applies other "optimization-like" tricks to make all this go faster. Since this is such a pervasive feature of swift, it does so even at -Onone, to make performance of unoptimized code acceptable. And once the optimizer starts getting involved, it sometimes can't help itself and will do more work than maybe it should at -Onone.
In this case, because the first variable is a "let" of an Int, swiftc knows it can just directly insert the value into the arguments when it goes to call print, so it doesn't need to make up a variable. If you change the let to a var then code will actually be generated for that line, and the line will get its own line table entry.
If you know how to read assembly code, you can look at the mixed disassembly to see this in action.
In lldb:
(lldb) dis -m -f
will give you mixed disassembly of the current frame.

erlang macro expansion bug

macro module:
-module(macro).
-include_lib("eunit/include/eunit.hrl").
-define(EXPAND(_T), ??_T).
macro_test() ->
?assertEqual("Test", ?EXPAND(Test)),
?assertEqual("Test.test", ?EXPAND(Test.test)).
Is resulting :
6> c(macro).
{ok,macro}
7> eunit:test(macro).
macro: macro_test (module 'macro')...*failed*
in function macro:'-macro_test/0-fun-1-'/1 (macro.erl, line 9)
**error:{assertEqual_failed,[{module,macro},
{line,9},
{expression,"? EXPAND ( Test . test )"},
{expected,"Test.test"},
{value,"Test . test"}]}
=======================================================
Failed: 1. Skipped: 0. Passed: 0.
error
Am I doing something wrong or is this a known bug?
TIA
You're incorrectly assuming that the Erlang compiler treats Test.test as a single token. If you pass the -P option to erlc and examine the output, you'll see that the preprocessor breaks it into multiple tokens. Here's the interesting part of macro.P produced by erlc -P macro.erl:
macro_test() ->
begin
fun(__X) ->
case "Test" of
__X ->
ok;
__V ->
error({assertEqual,
[{module,macro},
{line,8},
{expression,"? EXPAND ( Test )"},
{expected,__X},
{value,__V}]})
end
end("Test")
end,
begin
fun(__X) ->
case "Test . test" of
__X ->
ok;
__V ->
error({assertEqual,
[{module,macro},
{line,9},
{expression,"? EXPAND ( Test . test )"},
{expected,__X},
{value,__V}]})
end
end("Test.test")
end.

How to continuously show os command output in erlang?

I need continuously show stdout/stderr from os command in erlang.
In ruby I can implement it with following code:
s1, s2 , s3, t = Open3.popen3('for %a in (1 2 3 4 5 6 7 8 9) do (echo message & sleep 2 ) 2>&1 ')
s2.each do |l|
puts l
end
it will show 'message\n message\n' in 'real time' - does not wait end of process.
I've tried os:cmd(..)
and
1> P5 = erlang:open_port({spawn, "ruby rtest.rb"}, [stderr_to_stdout, in, exit_s
tatus, binary,stream, {line, 255}]).
#Port<0.505>
2> receive {P5, Data} -> io:format("Data ~p~n",[Data]) end.
Data {data,{eol,<<>>}}
ok
but both of them wait end of process.
Are the any optional for continuously stdout reading in Erlang?
EDIT:
In other words I look for a popen (c/c++; proc_open(php) and etc) function in erlang
EDIT2
Code, that works on linux (tested on centos6.2). Thanks for vinod:
-module(test).
-export([run/0]).
run() ->
P5 = erlang:open_port({spawn, "sh test.sh"},
[stderr_to_stdout, in, exit_status,stream, {line, 255}]),
loop(P5).
loop(P) ->
receive{P, Data} ->
io:format("Data ~p~n",[Data]),
loop(P)
end.
Output:
10> c(test).
{ok,test}
11> test:run().
Data {data,{eol,"1"}}
Data {data,{eol,"2"}}
Data {data,{eol,"3"}}
Data {data,{eol,"4"}}
Data {data,{eol,"5"}}
Data {data,{eol,"6"}}
Data {data,{eol,"7"}}
Data {data,{eol,"8"}}
Data {data,{eol,"9"}}
Data {data,{eol,"10"}}
Data {exit_status,0}
If I understand correctly, you want to continue to execute your program in concurrent with the os command. In Erlang you can just spawn a process which does that and you can continue. For example
1> spawn(fun() ->
P5 = erlang:open_port({spawn, "ruby rtest.rb"},
[stderr_to_stdout, in, exit_status,
binary,stream, {line, 255}]),
receive {P5, Data} ->
io:format("Data ~p~n",[Data])
end
end).
<0.32.0>
2> 5+5.
10
3>
Better to write in a module so that you can understand it better.

Why do I get a blank page on my shop after paying with Paypal?

When I make the payment with PayPal on my website prestashop, after Checkout Payment, the page turns white and stop working instead of come back to validate page of PayPal where we can find the opportunity to return to the store with the number of transaction and a confirmation message like "Payment Completed"
so I decided to reload the white page, and it came back to my website and it told me :
"Error occured : Merci de vous reférer aux logs :
1. PayPal response:
2. CHECKOUTSTATUS -> PaymentActionCompleted
3. TIMESTAMP -> 2012-12-08T22:35:15Z
4. EMAIL -> thomaslacroix149#me.com
5. PAYERID -> 6E5PYX5CHP6N6
6. PAYERSTATUS -> verified
7. FIRSTNAME -> Thomas
8. LASTNAME -> Lacroix
9. COUNTRYCODE -> FR
10. SHIPTONAME -> Thomas Lacroix
11. SHIPTOSTREET -> 5 Rue St Hermentaire
12. SHIPTOCITY -> Martigues
13. SHIPTOZIP -> 13500
14. SHIPTOCOUNTRYCODE -> FR
15. SHIPTOCOUNTRYNAME -> France
16. ADDRESSSTATUS -> Unconfirmed
17. CURRENCYCODE -> EUR
18. AMT -> 1.01
19. ITEMAMT -> 0.01
20. SHIPPINGAMT -> 1.00
21. HANDLINGAMT -> 0.00
22. TAXAMT -> 0.00
23. INSURANCEAMT -> 0.00
24. SHIPDISCAMT -> 0.00
25. L_NAME0 -> Divers
26. L_NUMBER0 -> 201
27. L_QTY0 -> 1
28. L_TAXAMT0 -> 0.00
29. L_AMT0 -> 0.01
30. L_DESC0 -> ...
31. L_ITEMWEIGHTVALUE0 -> 0.00000
32. L_ITEMLENGTHVALUE0 -> 0.00000
33. L_ITEMWIDTHVALUE0 -> 0.00000
34. L_ITEMHEIGHTVALUE0 -> 0.00000
35. PAYMENTREQUEST_0_CURRENCYCODE -> EUR
36. PAYMENTREQUEST_0_AMT -> 1.01
37. PAYMENTREQUEST_0_ITEMAMT -> 0.01
38. PAYMENTREQUEST_0_SHIPPINGAMT -> 1.00
39. PAYMENTREQUEST_0_HANDLINGAMT -> 0.00
40. PAYMENTREQUEST_0_TAXAMT -> 0.00
41. PAYMENTREQUEST_0_INSURANCEAMT -> 0.00
42. PAYMENTREQUEST_0_SHIPDISCAMT -> 0.00
43. PAYMENTREQUEST_0_TRANSACTIONID -> 2B4648015B651205G
44. PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED -> false
45. PAYMENTREQUEST_0_SHIPTONAME -> Thomas Lacroix
46. PAYMENTREQUEST_0_SHIPTOSTREET -> 5 Rue St Hermentaire
47. PAYMENTREQUEST_0_SHIPTOCITY -> Martigues
48. PAYMENTREQUEST_0_SHIPTOZIP -> 13500
49. PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE -> FR
50. PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME -> France
51. PAYMENTREQUEST_0_ADDRESSSTATUS -> Unconfirmed
52. L_PAYMENTREQUEST_0_NAME0 -> Divers
53. L_PAYMENTREQUEST_0_NUMBER0 -> 201
54. L_PAYMENTREQUEST_0_QTY0 -> 1
55. L_PAYMENTREQUEST_0_TAXAMT0 -> 0.00
56. L_PAYMENTREQUEST_0_AMT0 -> 0.01
57. L_PAYMENTREQUEST_0_DESC0 -> ...
58. L_PAYMENTREQUEST_0_ITEMWEIGHTVALUE0 -> 0.00000
59. L_PAYMENTREQUEST_0_ITEMLENGTHVALUE0 -> 0.00000
60. L_PAYMENTREQUEST_0_ITEMWIDTHVALUE0 -> 0.00000
61. L_PAYMENTREQUEST_0_ITEMHEIGHTVALUE0 -> 0.00000
62. PAYMENTREQUESTINFO_0_TRANSACTIONID -> 2B4648015B651205G
63. PAYMENTREQUESTINFO_0_ERRORCODE -> 0
64. Cart changed since the last checkout express, please make a new Paypal checkout payment
So I couldn't complete the payment method.
Does anyone know how to solve this problem?
There are two known issues related to this.
You need to add 755 rights on modules/paypal directory.
Maybe the tools/tcpdf/tcpdf.php file is corrupted and you need to get a new version of it (you can get it by downloading a fresh install of Prestashop).