{"id":15557732,"url":"https://github.com/fgasper/perlxs-rosetta","last_synced_at":"2026-02-17T17:33:35.596Z","repository":{"id":141193795,"uuid":"277140503","full_name":"FGasper/perlxs-rosetta","owner":"FGasper","description":"A “rosetta stone” for Perl XS","archived":false,"fork":false,"pushed_at":"2021-12-01T18:51:02.000Z","size":19,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T13:39:41.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FGasper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-04T15:52:52.000Z","updated_at":"2025-01-21T15:51:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"162bab63-dde6-4cde-941c-1032dc3dc36d","html_url":"https://github.com/FGasper/perlxs-rosetta","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FGasper/perlxs-rosetta","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fperlxs-rosetta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fperlxs-rosetta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fperlxs-rosetta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fperlxs-rosetta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FGasper","download_url":"https://codeload.github.com/FGasper/perlxs-rosetta/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FGasper%2Fperlxs-rosetta/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29551257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T14:33:00.708Z","status":"ssl_error","status_checked_at":"2026-02-17T14:32:58.657Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T15:20:31.756Z","updated_at":"2026-02-17T17:33:35.566Z","avatar_url":"https://github.com/FGasper.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Perl XS Rosetta Stone\n=====================\n\nThe following is meant as a quick-and-dirty “cheat sheet” reference for XSUB authors.\nMany of the “translations” below can take multiple forms; the below is not a substitute for\nreading and digesting the relevant Perl documentation: `perlxs`, `perlxstut`, `perlapi`, `perlguts`, etc.\n\nThe following assumes knowledge of C, including use of pointers.\n\nScalars: assignment\n-------\n\n| Perl             | XS               |\n| ----------------- | ---------------- |\n| `my $v`    | `SV *mysv = newSV(0)` |\n| `$v = undef`    | `sv_set_undef(mysv)` |\n| `my $v = 1`   | `SV *mysv = newSVuv(1)` |\n| `$v = 1`   | `sv_setuv(mysv, 1)` |\n| `$v = -1`  | `sv_setiv(mysv, -1)` |\n| `$v = 'literal'`  | `sv_setpvs(mysv, \"literal\")` |\n| `$v = $other_str`  | `sv_setpvn(mysv, otherstr, length_of_otherstr)` |\n\nScalars: concatenation\n-------\n\n| Perl             | XS               |\n| ----------------- | ---------------- |\n| `$v .= 'literal'`  | `sv_catpvs(mysv, \"literal\")` |\n| `$v .= $other_str`  | `sv_catpvn(mysv, otherstr, length_of_otherstr)` |\n\nScalars: length\n------\n\n| Perl     | XS       |\n| --------- |    ---- |\n| `length $a` | `sv_len_utf8(mysv)` |\n\nArrays\n------\n\n| Perl             | XS               |\n| ----------------- | ---------------- |\n| `my @a`        | `AV *myav = newAV()` |\n| `@a = ()`      | `av_clear(myav)` |\n| `push @a, $foo` | `av_push(myav, foo)` |\n| `$foo = pop @a` | `SV *foo = av_pop(myav)` |\n| `$foo = shift @a` | `SV *foo = av_shift(myav)` |\n| `($old) = splice(@a, 2, 1, $foo)` | `SV **old = av_store(myav, 2, foo)` |\n| `my ($el) = splice(@, 2, 1)` | `SV *myel = av_delete(myav, 2, 0)` |\n| `() = splice(@, 2, 1)` | `av_delete(myav, 2, G_DISCARD)` |\n| `@INC`  | `get_av(\"main::INC\")` or `(GvAV(PL_incgv))` |\n\n\nPackages/Namespaces\n-------------------\n\n| Perl             | XS               |\n| ----------------- | ---------------- |\n| `__PACKAGE__`    | `HvNAME( (HV*)CopSTASH(PL_curcop) )` |\n\nGlobal State\n------------\n\n| Perl             | XS             |\n| ---------------- | -------------- |\n| `${^GLOBAL_PHASE}` | `PL_phase` / `PL_dirty` |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fperlxs-rosetta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgasper%2Fperlxs-rosetta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgasper%2Fperlxs-rosetta/lists"}