I'm using h2xs
to make glue code for a C library to a module. Imagine this scenario in the C header:
struct foo; struct foo * new_foo(); void set_foo_member(struct foo * f, int value); int get_foo_member(const struct foo * f);
When I run
h2xs -x
on this I get something like this in the .xs file:struct foo * new_foo() int get_foo_member(f) const struct foo * f void set_foo_member(f, value) struct foo * f int value
and in the
typemap
:const struct foo * T_PTROBJ struct foo * T_PTROBJ
This builds fine, however, when I go to actually use the code like this:
my $foo = new_foo(); $foo->set_foo_member(123); print "Foo member is: " . $foo->get_foo_member();
I get an error like the following:
get_foo_member: Expected f to be of type const struct FooPtr; got struct FooPtr=SCALAR(0x2ecd9c2dd768) instead at ...
Right, so, that's the backstory. XS checks the type of incoming objects and makes sure they match the expected type from the C header, and if they differ, it throws an error. But it seems to be considering
struct foo *
and const struct foo *
to be two different types, even though they're not (really). Perl shouldn't care about this at all.What's the solution here? Do I remove all const
keywords in my XS code? Is there some switch or setting to make xsubpp
treat both as the same type? Something else?
submitted by /u/greg_kennedy
[link] [comments]
I have a Perl script that takes several hours to run, I need to know when it's done, but I sometimes forget to keep checking.
It's running on Strawberry in Windows Server 2019. How easy would it be to write another script to send an email? I could run them as a batch I'm thinking.
I'm very weak at programming, I really only dabble.
submitted by /u/Hydraulis
[link] [comments]
It's gotta be me, but I'm at a loss. Installing with cpan: I can build XML::LibXML (lots of warnings) but the test suite refuses to run cleanly, staring with errors:
t/02parse.t ........................................ 1/533
# Failed test 'error parsing <!DOCTYPE X SYSTEM "example/ext\_ent.dtd">
# <X>\&foo;</X>
# '
# at t/02parse.t line 887.
# got: ''
# expected: anything else
# Looks like you failed 1 test of 533.
`
and then getting worse from there.
I've installed the module on other Macs including other Intel boxes.
I've re-installed MacPorts (which is what I used to install LibXML2 and all the other prereqs).
I've built from source - same experience. Build succeeds, tests all fail.
I'm trying to figure out how to run the tests individually to see what's going on in better detail, but if anyone has seen and solved this funky issue of getting XML::LibXML to build and run cleanly on Mac OSX, please -I'd love to hear it. Everything else builds/tests/installs fine. reports does show some failed Mac builds.
submitted by /u/OS2REXX
[link] [comments]
I have a Mac M1 chip laptop.
While I have managed to install a couple of modules, most fail to install.
I tried perlbrew, but that was a struggle to even get it to install perl itself, but when it was installed it wasn't working the way I needed it to.
Just wondering if I am missing something with CPAN or if this is an issue because it's an M1 chip?
submitted by /u/MrCosgrove2
[link] [comments]
This might be Perl/docker-perl#161 but if I filed this in the wrong place, let me know. Keeping these things current is the sort of thing I'd pay for.
Pulling perl images locally give the same warnings for old perl versions, although my local docker will still run them:
$ docker pull perl:5.14 5.14: Pulling from library/perl Image docker.io/library/perl:5.14 uses outdated schema1 manifest format. Please upgrade to a schema2 image for better future compatibility. More information at https://docs.docker.com/registry/spec/deprecated-schema-v1/
Here's what I'm getting today from GitHub Actions. Sure, I see all sort of warnings to upgrade node, but nothing about this change:
/usr/bin/docker pull perl:5.14 5.14: Pulling from library/perl [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/perl:5.14 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/ Warning: Docker pull failed with exit code 1, back off 5.148 seconds before retry. /usr/bin/docker pull perl:5.14 5.14: Pulling from library/perl [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/perl:5.14 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/ Warning: Docker pull failed with exit code 1, back off 4.06 seconds before retry. /usr/bin/docker pull perl:5.14 5.14: Pulling from library/perl [DEPRECATION NOTICE] Docker Image Format v1 and Docker Image manifest version 2, schema 1 support is disabled by default and will be removed in an upcoming release. Suggest the author of docker.io/library/perl:5.14 to upgrade the image to the OCI Format or Docker Image manifest v2, schema 2. More information at https://docs.docker.com/go/deprecated-image-specs/ Error: Docker pull failed with exit code 1
From this snippet in my GitHub workflows (e.g. .github/workflows/linux.yml)
matrix: os: - ubuntu-22.04 perl-version: - '5.8' - '5.10' - '5.12' - '5.14' - '5.16' - '5.18' - '5.20' - '5.22' - '5.24' - '5.26' - '5.28' - '5.30' - '5.32' - '5.34' - '5.36' - 'latest' container: image: perl:${{ matrix.perl-version }}
submitted by /u/briandfoy
[link] [comments]
I threw together a quick proof of concept for myself writing out a very simple Entity Component System (ECS) and implementing the flocking simulation on top of it. I liked how it came together so well I wrote some prose around it and decided to share. Note: this is using features from the soon-to-be-released 5.40.0 (RC1 dropped last Friday). submitted by /u/perigrin |
Hi, I recently got an offer for Senior SWE (current title at my company now) for a company that heavily utilizes Perl. I was wondering if folks from this community could offer some insight on what it's like working with Perl and also what, if any, potential long-term career implications are of becoming a Perl developer? Particularly I'm worried of pigeon-holing myself since Perl is not as heavily used in todays age and this company does not make use of modern cloud tools and deployments.
I am a Java developer (5 YOE) at a enterprise software company that is deployed in GCP. We are pretty regularly adopting new technologies so I'm gaining some valuable and relevant industry experience here but I am looking for a change and more opportunity to lead projects and mentor junior engineers.
The company seems good, great WLB, I liked the manager, and with the bonus (base is roughly the same) it would be about a ~8% TC increase plus a lot more stock (monopoly money, private RSUs).
Does anyone have experience transitioning from a Perl based company to a cloud based company with a more modern tech stack? Is this a backwards direction for me, should I continue with my Java development and instead look for opportunities that will offer more marketable skills?
Any input is appreciated, thank you for reading.
submitted by /u/Roodiestue
[link] [comments]
Mo utilities for email.
Changes for 0.02 - 2024-04-26T23:02:53+02:00
- Add tests for error parameters.
- Rewrite the tests so that the functional tests are first and then the errors.