Anonymous functions and safe compartments

2014-12-28 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello! How do i run and pass arguments to an anonymous subroutine that i shared on a safe compartment? My goal is to have a function that perform "dangerous" operations, that must be available to untrusted code, however this function needs some p

Re: Anonymous functions and safe compartments

2014-12-28 Thread David Emanuel da Costa Santiago
c("func1"); } ## The output is what i was expecting: $ perl Example.pl About to run shared function! Dangerous func1 operation! Thanks Brandon for your help. Best regards, David Santiago Em Sun, 28 Dec 2014 16:35:50 -0500 Brandon McCaig escreveu: > David: > > O

Yenc encoder performance

2015-07-30 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello, I'm developing a perl yenc encoder but unfortunatelly it's not having the performance i was expecting to have (and it's CPU heavy). Can i get some help improving it's performance? This is the code i have (41 lines). Initially i though abo

Re: Yenc encoder performance

2015-07-31 Thread David Emanuel da Costa Santiago
stack overflow) http://stackoverflow.com/questions/3104493/performance-with-perl-strings I'm going to try your suggestions an i will report back. Best regards, David Santiago Em Thu, 30 Jul 2015 16:56:31 -0400 Uri Guttman escreveu: > On 07/30/2015 04:14 PM, David Emanuel da Costa Santiago wrot

Re: reading from socket

2015-09-17 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello Chris. Can you provide the yenc files? Both the good one and the bad one? Thx, Regards, David Santiago On Thu, 17 Sep 2015 23:19:22 +0200 "Chris Knipe" wrote: > Just an example, and no, the decoder isn't written by me, it's from > the o

Perl memory leaks (and valgrind)

2015-10-01 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello all, Is the valgrind tool a reliable tool for checking for memory leaks in perl and in our perl scripts? I have a perl script that's consuming all the memory available on my system. I rechecked the script and since i didn't found anything (a

Re: Perl memory leaks (and valgrind)

2015-10-01 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Now with the code attached. Best regards, David Santiago On Thu, 1 Oct 2015 19:19:47 +0200 David Emanuel da Costa Santiago wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > > Hello all, > > Is the valgrind

Re: Perl memory leaks (and valgrind)

2015-10-02 Thread David Emanuel da Costa Santiago
:16:58 +0200 David Emanuel da Costa Santiago wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > > > Hi Shlomi, > > Thanks for your reply. I tried your suggestion and it didn't work: > > ==10175== LEAK SUMMARY: > ==10175==definitely los

Sockets getting stuck

2015-10-12 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello all! I'm creating some sockets to a remote server and from time to time, the sockets get "frozen". I'm creating the socket as: $socket = IO::Socket::INET->new ( PeerAddr => $server,

Re: Sockets getting stuck

2015-10-12 Thread David Emanuel da Costa Santiago
ocket simply gets in zombie state. Not dead, but not alive. The connection timeout doesn't work, the receive timeout (SO_RCVTIMEO) and send timeout (SO_SNDTIMEO) does work. Is there any way to recover from this? On Mon, 12 Oct 2015 18:58:42 +0200 David Emanuel da Costa Santiago wrote: >

Re: Sockets getting stuck

2015-10-13 Thread David Emanuel da Costa Santiago
2015 20:50:46 -0700 $Bill wrote: > This failed twice to post - emailing it. > > On 10/12/2015 09:58, David Emanuel da Costa Santiago wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA256 > > > > > > Hello all! > > > > I'm creating s

Re: Sockets getting stuck

2015-10-13 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hi Brandom. On Tue, 13 Oct 2015 10:08:27 -0400 Brandon McCaig wrote: > On Tue, Oct 13, 2015 at 6:34 AM, David Emanuel da Costa Santiago > wrote: > > Hi! > > Hello, > > > THanks for your suggestion. > > I

How to interpolate a hash in a string

2015-11-03 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello all. I'm trying to interpolate a hash value in a string but i got stuck. I already tried with eval, without any success... I have two conf files in the form conf file 1: option=value option2=value2 conf file 2: property=propertyValue prop

Re: How to interpolate a hash in a string

2015-11-04 Thread David Emanuel da Costa Santiago
: > Re-sending with CC to OP since it didn't make the group. > > On 11/3/2015 14:03, David Emanuel da Costa Santiago wrote: > > -BEGIN PGP SIGNED MESSAGE- > > Hash: SHA256 > > > > > > Hello all. > > > > I'm trying to interpolate a

Re: Forking as another user

2016-03-11 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello all. AFAIK, you can't do that. When you fork everything is copied, including the UID. To achieve something similar, you need to launch another process (but you'll need to be root to launch it as another user) Regards, David Santiago On F

Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Hi! I have a script that writes to a socket, but i noticed that the same script have diferent speeds on different machines. It's faster on my 5 year laptop than on my desktop. I profiled the script on both machines and some functions are taking almost the double of the time! Example: on my lapt

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
r applications i can reach same speed with SSL on both machines. Regards, David Santiago On Wed, 01 Jun 2016 19:36:06 +0100 Steve Pointer wrote: > Does your laptop have a TPM? > > > > On 1 June 2016 19:25:39 BST, David Emanuel da Costa Santiago > wrote: > > > >

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
oldest hardware runs faster. The SSLeay version is the same on both machines (version 1.72 - the latest one haven't reach the stable repos yet) Regards, David Santiago On Wed, 1 Jun 2016 22:23:51 +0300 Shlomi Fish wrote: > On Wed, 1 Jun 2016 20:25:39 +0200 > David Emanuel da Costa Santia

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
imum speed using a different application. Regards, David Santiago On Thu, 2 Jun 2016 07:40:00 +1200 Kent Fredric wrote: > On 2 June 2016 at 06:25, David Emanuel da Costa Santiago > wrote: > > The question for one million dollar is "Why?". And how can i improve > >

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
The openssl version is 1.0.2.h. Thanks for your help. I'm going to follow Uri's advice and send an email to p5p list. Thank you! Regards, David Santiago On Thu, 2 Jun 2016 08:18:23 +1200 Kent Fredric wrote: > On 2 June 2016 at 08:04, David Emanuel da Costa Santiago > wro

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
Unfortunatelly i don't have a third box. :-( I'm going to follow your advice and send an email to p5p. Thank you! Best regards, David Santiago On Wed, 1 Jun 2016 16:17:47 -0400 Uri Guttman wrote: > On 06/01/2016 04:04 PM, David Emanuel da Costa Santiago wrote: > > Hi Ken

Re: Script runs slower with better hardware

2016-06-01 Thread David Emanuel da Costa Santiago
t; 3.2GHz). Is the program you're trying to run written in such a way as > to take advantage of multi-threading? Was the benchmark you mentioned > a single threaded or multi-threaded benchmark? > > Best wishes, > James Alton > > > On Wed, Jun 1, 2016 at 12:25 PM, Da

Re: DBI.c: loadable library and perl binaries are mismatched

2016-06-30 Thread David Emanuel da Costa Santiago
Hi Ron. I had that problem not with the DBI module, but when i was using Inline::C. To solve that issue i had to compile my code with the gcc flag -DPERL_IMPLICIT_SYS Maybe it helps if you can recompile the bit that has the XS (or C) code with that flag? Best regards, David Santiago On

Re: Remove Newlines from String

2016-09-06 Thread David Emanuel da Costa Santiago
Hi! You can use "chomp" to remove the $/ from the end of the line. If you want to replace all non printable characters you can do something like: ### START #Change the value to the maximum you want my %HEXCODES = map{$_ => sprintf("%03X", $_)} (0..128); my $s="This is my string! \r\n the en

Re: Remove Newlines from String

2016-09-06 Thread David Emanuel da Costa Santiago
Thanks :-) A little bug: > my %HexCodes = map { ord($_) => sprintf '%02X', $_ } ( 0 .. 128 ); my %HexCodes = map { chr($_) => sprintf '%02X', $_ } ( 0 .. 128 ); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.p

How to delete multiple indices from array

2017-04-12 Thread David Emanuel da Costa Santiago
Hello! What's the best way to delete multiple indices from an array? i'm doing: --- my @array=qw/zero one two three four five six seven eight nine ten/; my @indicesToDelete = (2,4,6,7); my %hash; @hash{(0..scalar(@array)-1)} = @array; delete $hash{$_} for @indicesToDelete; @arr

Re: How to delete multiple indices from array

2017-04-12 Thread David Emanuel da Costa Santiago
0; splice(@array, $_-$deviation++,1) for(@indicesToDelete); -- Thank you all! Regards, David Santiago On Wed, 12 Apr 2017 15:19:33 -0400 Uri Guttman wrote: > On 04/12/2017 03:00 PM, David Emanuel da Costa Santiago wrote: > > Hello! > > > > What's the best wa

Re: How to delete multiple indices from array

2017-04-12 Thread David Emanuel da Costa Santiago
; > Hi Uri! > > > > Some notes. > > > > On Wed, 12 Apr 2017 15:19:33 -0400 > > Uri Guttman wrote: > > > >> On 04/12/2017 03:00 PM, David Emanuel da Costa Santiago wrote: > >>> Hello! > >>> > >&g

How to match words with a consecutive character

2017-05-06 Thread David Emanuel da Costa Santiago
Hello. Is there any regular expression, that can match any consecutive character? Example: qwerty -> no match qwertyq -> no match qqwerty -> match because of the qq qwerrrty -> match because of the rrr and so on... My obvious attempts that resulted in failure were: 1- /.{2,}/ 2- /[qwerty]{2,

Re: How to match words with a consecutive character

2017-05-06 Thread David Emanuel da Costa Santiago
Thanks! I didn't knew that feature. It's very cool! Thank you very much. Best regards, David Santiago On Sat, 6 May 2017 23:03:48 +0100 David Precious wrote: > On Sat, 6 May 2017 23:13:04 +0200 > David Emanuel da Costa Santiago wrote: > > Is there any regular expr

Re: Please help: perl run out of memory

2022-04-27 Thread David Emanuel da Costa Santiago
Às 11:33 de 17/04/22, wilson escreveu: hello the experts, can you help check my script for how to optimize it? currently it was going as "run out of memory". $ perl count.pl Out of memory! Killed My script: use strict; my %hash; my %stat; To be honest you don't need the %stat, however