Skip to content

Instantly share code, notes, and snippets.

@bbkr
Last active September 3, 2015 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbkr/4930c5bb9abaa2211756 to your computer and use it in GitHub Desktop.
Save bbkr/4930c5bb9abaa2211756 to your computer and use it in GitHub Desktop.
Curl Easy NativeCall
use NativeCall;
class Curl::Easy is repr( 'CPointer' ) {
sub curl_easy_init ( ) returns Curl::Easy is native( 'libcurl' ) { * };
sub curl_easy_cleanup ( Curl::Easy ) is native( 'libcurl' ) { * };
method new ( ) {
curl_easy_init();
}
submethod DESTROY {
say 'destroying';
curl_easy_cleanup( self );
}
};
loop { Curl::Easy.new };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment