Talk:Perl plugin
From NSIS Wiki
Jump to navigationJump to search
I have tested Perl plugin "nsPerl" 1.3 sucessfully on NSIS 3.01 (ANSI code) with perl58.dll library 5.8.8.2 from Opensource Perl Strawberry Project.
Tests were made only with some regex so be careful if you use other functions.
I didn't have to recompile nsperl.dll to use this alternate library.
I you want to test, you can download it here: Perl58.dll_(strawberry-perl-5.8.8.2).zip
Note that i have tested nsPerl 1.4.1 with its integrated perl510.dll without success on NSIS 3.01 (ANSI code).
Sample code:
OutFile "test.exe" SilentInstall normal ShowInstDetails show ReserveFile perl58.dll Function .onInit ;Extract Install Options files ;$PLUGINSDIR will automatically be removed when the installer closes InitPluginsDir File /oname=$PLUGINSDIR\perl58.dll "perl58.dll" FunctionEnd Section "MainSection" SEC01 StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); $$a =~ s/a/o/g; $$a" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "substitution a->o => [$0]" DetailPrint "" StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); if ($$a =~ /toto/) {return 1;} else {return 0;}" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "tata = toto ? [$0]" DetailPrint "" StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); if ($$a =~ /tata/) {return 1;} else {return 0;}" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "tata = tata ? [$0]" DetailPrint "" StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); if ($$a =~ /^tata$$/) {return 1;} else {return 0;}" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "tata = ^tata$$ ? [$0]" DetailPrint "" StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); if ($$a =~ /^t.*/) {return 1;} else {return 0;}" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "tata = ^t.* ? [$0]" DetailPrint "" StrCpy $0 "tata" DetailPrint $0 nsPerl::exec /NOUNLOAD "$$a = NSIS_getvar('0'); if ($$a =~ /^to.*/) {return 1;} else {return 0;}" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "tata = ^to.* ? [$0]" DetailPrint "" StrCpy $0 "Test bad perl command" DetailPrint $0 nsPerl::exec /NOUNLOAD "printfffff();" Pop $0 DetailPrint "perl command status: $0" Pop $0 DetailPrint "Error detail: [$0]" # be careful to not use /NOUNLOAD on last nsPerl exec # so libraries nsPerl.dll and perl58.dll could not be deleted from $PLUGINSDIR and so $PLUGINSDIR directory nsPerl::exec "dummy request to UNLOAD libraries" SectionEnd
DeCiZoR 17:23, 23 March 2017 (UTC)