Skip to main content



I'm starting my journey from Catalyst to Mojo and it's interesting so far. I've been using Catalyst for over a decade, so I expect I have some bad habits to resolve. My question is:

Is there a way to get a Catalyst DBIx-like model in Mojo? I like the model structure used in Catalyst, I like the way it allows me to create a really easy to understand data layer for my projects. I prefer it to the more direct, access the tables/DB directly with queries approach. Is there a Mojo equivalent to the Catalyst

MyApp_create model MainDB.....

available for mojo? Thanks!

submitted by /u/conicalanamorphosis
[link] [comments]




My wife and have a hobby-level online radio station and we use Logitech Media Server as the backend. As part of what we use we're running a plug-in called Spicefly Sugarcube, which interacts with a "brain" called MusicIP. MusicIP allows music suggestions to be called using an API, which is basically what Sugarcube is doing, and it builds a URL with the very last element being "recipe," which is a filter built into MusicIP that helps shape the direction the songs go.

The issue is I'd like to replace the recipe section of this plug in with a fixed array that cycles through to emulate a radio format clock. I realize that by doing this under the hood I lose the functionality of changing the recipes on the fly, but that's okay.

The program is driven by the plugin.pm file located here:

bitbucket.org/spicefly/sugarcu…

I know nothing about Perl so tried to have ChatGPT alter this to replace the recipe section with a fixed array, It returned the upper part of the file this way, with no other changes, and the plug in won't load like this:

#v6.01 - December 2023

#+===================+

#Licencing Requirements Removed

#Released as Open Source under the GNU General Public License v3.0

#

#In Short Summary

#Complete source code must be made available that includes all changes

#Copyright and license notices must be preserved.

#Contributors provide an express grant of patent rights.

package Plugins::SugarCube::Plugin;

# Define the recipe sequence array

my u/recipe_sequence = ('5s', '4s', '5s', '5s', '4s', '5s', '4s', '5s', '5s', '4s', '5s', '4s', '5s', '5s', '4s', '5s', '5s', '4s');

my $recipe_index = 0;

# Function to get the next recipe in sequence

sub get_next_recipe {

my $recipe = $recipe_sequence[$recipe_index];

$recipe_index = ($recipe_index + 1) % u/recipe_sequence; # Loop back to the start

return $recipe;

}

use base qw(Slim::Plugin::Base);

use strict;

use Slim::Utils::Misc;

use Slim::Utils::Prefs;

use Slim::Utils::Log;

my $log = Slim::Utils::Log->addLogCategory(

{

'category' => 'plugin.sugarcube',

# 'defaultLevel' => 'WARN',

'defaultLevel' => 'DEBUG',

'description' => getDisplayName(),

}

);

So my question is, is this possible, and is the kernel of how to make it work here, or is there a better way to do it? If you look at the original plugin.pm file you'll see how the URL is built, and I really just want the very end of the URL to be &recipe=5s or %recipe=4s depending on the sequence I enter. Any help it appreciated!

submitted by /u/typecrazy789
[link] [comments]







I've been trying to port a couple of GUI programs I have from Tkx to Prima in order to get free from ActiveState's shenaningans. I have succesfully translated part of my GUIs to Prima, but I have a lot of trouble with layout.

I don't see a simple way to do what I want, which is to have several rows of controls (buttons at the top and bottom, and a TextView or Edit control in the middle) without it turning into a mess.

I was using frames in Tkx, which are like invisible containers for controls, but Prima doesn't seem to have an equivalent. There are GroupBoxes which always include a border and legend, and FrameSets which always display a border and seem to always be resizable.

I haven't found any comprehensive documentation on any of these, and in particular, the example program for frames shows the use of some exotic properties that don't seem to be documented anywhere.

I'd be grateful if someone could point me to any posts, tutorials, or documentation about frames or whatever I can use as a container for buttons and controls.

submitted by /u/elbitjusticiero
[link] [comments]



I'm attempting to port this C hashing function to Perl but it's not working:

c static inline uint64_t hash64(uint64_t val, unsigned bits) { return (val * 0x61c8864680b583ebull) >> (64 - bits); }

Here is what I came up with:

``` sub hash64 { my ($val, $bits) = @_; my $magic_constant = 0x61c8864680b583eb;

# Perform the hash computation my $hashed = ($val * $magic_constant) >> (64 - $bits); return $hashed; 

} ```

My hashed values aren't matching what I'm seeing from C. I suspect it has to do with how Perl handles numbers larger than 64bit? C would truncate them (I think) but Perl will happily work with larger numbers?

12345 hashed to 64bits should output 6832837858993532755 according to the C version. Am I missing something obvious?

submitted by /u/scottchiefbaker
[link] [comments]



Hi, I am installing braker and it requires a set of Perl modules to be installed. I am having a hard time installing the YAML::XS module. I am using Perl v5.38.

The Perl module was installed using cpanm command, and when I run perldoc -l YAML::XS it shows There is No documentation.

The directory, where the libraries and executables exist, was added to the PATH and PERL5LIB environment variable, and still the XS.pm is missing in the YAML folder.

I tried to re-install the library in two different ways: cpanm --local-lib=~/perl5 --reinstall YAML::XS and cpanm --force -v YAML::XS still not resolved.

What is happening here, should I install a different version of Perl? Is it possible to manually install YAML/XS.pm?

submitted by /u/learnwithscholar
[link] [comments]





The URI module took a short holiday, but quickly returned. Just for giggles, I'd like to see everyone react (positivily) to u/oalders in the Github issue:

  • Can we get 100 reactions?
  • Can we get all the reactions (so, thumbs down is really just for completeness)
  • Can we star the heck out of the libperl-www repo?

There are people who take care of things so most people never notice when something goes wrong, and from the time I reported this to resolution was three hours (although the issue was already known, I think). That's some pretty good support right there, and we should fête over that.

For what it's worth, GitHub pays attention to these things. When I filed an issue about getting them to think about putting Perl in their Advisory Database, the number of reactions that issue got made them think about it (right now it's a whole process with scheduling dev time, etc). One of the ways to show that Perl is alive is to react to Perl things (um, that deserve it, not bot spam!).

submitted by /u/briandfoy
[link] [comments]



Hi I am new to this stuff

i want to use scriptthis perl script to simulate the https requests performed by the deep testing app (for realme devices)

now i need to run this script on (strawberry perl)

but i have no pc to do this

so how can i run perl script on termux

everytime i do this on termux

i get this

files.fm/u/8jt4mfg5g7

submitted by /u/dragonuser_
[link] [comments]



Basically, my Perl code wants to achieve the following :

my @array = qx{cat /some/servers/list}; # this is working

my $port = 30004;

foreach(@array) {

my $return_code = system ("/usr/bin/nc -zv", $_, $port) # wanting to run nc -zv hostname 30004

But it just isn't working.

What I've tried so far :

  1. foreach(@array) {

my @ args = ($_." ".$port)

my $return_code = system ("/usr/bin/nc -zv", @ args)

  1. Used IPC::System::Simple qx/systemx/ and then passed the whole thing thru systemx instead of system
  2. Used qx, Used exec, doesn't work.

Note: I need the return code for rest of dependant logic down the road, so have to have the $return_code scalar.

Please help! I'm at my wits end!

submitted by /u/icy-mist-01
[link] [comments]







I use Net::SMTP to send emails when a user requests data, and I have the email BCC'ed to my personal Gmail. But while it appears that the user does get the email (even when using Gmail), it's not showing up in my Gmail.

Any suggestions on what the problem might be?

I'm using these modules:

use Net::SMTP; use MIME::Lite; use Digest::MD5 qw(md5_hex); 

And this is the script:
$from = 'noreply@example.com'; $login_pass = 'blahblahblah'; $messageID = time(); $msg = MIME::Lite ->new ( From=> "Me <$from>", To=> "recipient@gmail.com", Bcc=> 'me@gmail.com', Subject=> "Subject", 'Message-ID'=> '<' . $messageID . '-' . md5_hex($from) . '-' . md5_hex($found_email) . '@example.com>', Type=> 'multipart/alternative' ); $msg->attach( Type => 'text/plain', Encoding=> 'quoted-printable', Data=> qq~ Plain text version of email ~ ); $msg->attach( Type => 'text/html', Data=> qq~ <b>HTML version of the email</b> ~ ); $msg->scrub(['x-mailer', 'Content-Disposition']); $smtp = Net::SMTP->new( 'mail.example.com', Port => 465, SSL => 1 ); $smtp->auth($from, $login_pass) or die('Could not authenticate'); $smtp->mail($from); if ($smtp->to($found_email)) { $smtp->data(); $smtp->datasend( $msg->as_string() ); $smtp->dataend(); } 

submitted by /u/csdude5
[link] [comments]


The notes from the latest meeting of the Perl Steering Council mention:

We exchanged Perl (re)branding ideas with Olaf [Alders]. We will be keeping in touch on that front.

Does anyone here know whether this is only about the camel logo owned by O'Reilly or if there are some bigger changes coming (Perl 7?)?

submitted by /u/Drogoslaw_
[link] [comments]



Hello,

I'm trying to install Request Tracker and in the process am receiving an error that states:

Some dependencies were missing:
DBD::mysql >= 2.1018, != 4.042 ................... MISSING

I'm lost. How to do I resolve this?

Thank you!

submitted by /u/ngrybst
[link] [comments]



Did anyone else receive unsolicited email from the Science Perl Committee announcing a journal for sale? I'm not sure how or why they added my email address to the list. It'd be interesting to see if others also did so.

submitted by /u/mr_chromatic
[link] [comments]








I am quite thrilled to announce that after several months of hard work, I have released the perl module DateTime::Format::Intl. It mirrors its JavaScript equivalent of Intl.DateTimeFormat. The algorithm is quite elaborate, replicating how it works in web browsers. I also had to develop quite a few dependencies to make it work, notably Locale::Unicode and Locale::Unicode::Data, which provides access to all the Unicode CLDR (Common Locale Data Repository) data as an SQLite database via an extensive number of perl methods. I hope it will benefit you and supports you in the internationalisation of your projects in perl.

submitted by /u/jacktokyo
[link] [comments]



Hey, I am writting in perl since few years I have written lots of stuff over the years however would consider myself more beginner, I love syntax and the fact that perl is almost on every linux. My main usecase is system scripting/parallelizing tasks/ some API clients.

I have felt in love threads::queue and inotify2 implementation and use them very frequently.

Module management - What is more nowadays standard to manage them?

I use cpan, or download module from cpan and execute perl makefile or later generated C Makefile.

However sometimes struggle:

Last example that comes to my mind:

I want to create simple app that interacts with cassandra and any module I try to gather is based on deprecated IO::Sockets::INET6 - also have disabled ipv6 and not able to build it. Is there any package manager that ships modules in some more portable formats?

If I build module that for example needs some .so that is bound to kABI [Inotify2] I push them to system perllib path. I understand that it is based on kABI and need to recompile with kernel-headers. But is there any more portable solution. My feeling is that on python side managing pkgs with pip is easier.

submitted by /u/Recent-Astronaut-240
[link] [comments]




Perl Community Conference Winter 2024When: December 18th (on the day of the 37th Birthday of Perl)

Where : Virtual

Dress Code : Whatever you want

Price : FREE

How to join : sign up for the mailing list (QR in image), or perlcommunity.org/science/#mai…)

Wanna know more : science.perlcommunity.org/spj#…

submitted by /u/ReplacementSlight413
[link] [comments]





perl -CS -E'say v74.65.80.72'

I wanted to grok how deeply I didn't understand what this was doing, so I also made some modifications:

while true; do perl -CS -E 'say eval ( sprintf "v%s", join ".", map { int rand 1024 } ( 0 .. (int rand 24) + 8 ) )'; sleep 1; done

submitted by /u/smutaduck
[link] [comments]



Doing some Unicode research I'm finding several different ways to generate Unicode characters:

```perl binmode(STDOUT, ":utf8");

my $thumbs_up = "";

$thumbs_up = "\x{1F44D}"; $thumbs_up = "\N{U+1F44D}"; $thumbs_up = chr(0x1F44D); $thumbs_up = pack("U", 0x1F44D);

print $thumbs_up x 2 . "\n"; ```

What is that \x syntax? I tried looking it up on Perldoc and couldn't find anything. Is the \N specific for Unicode?

submitted by /u/scottchiefbaker
[link] [comments]



Bit of a weird question:
I am working on a save game editor for an old game that nobody cares about, and I have to run a Perl script as part of it.
I have been trying to convert the logic of the script to C#, which I am writing the application itself in, but due to differences in how Perl and C# handle bytes, this is proving impossible for me to figure out with my limited skill set. If anyone would like to workshop this issue, I would welcome the help.

Anyway, my question: Since I need to include the script with my application, the user needs a way to run it. I would like to avoid having the user install Perl themselves, as that would just be another step I'd have to troubleshoot every time someone had a problem.
So would it be legal for me to include Strawberry Perl in its portable form with my application?
From quick googling, I think it would, but I don't want to risk anything.

Thank you for your help.

submitted by /u/Graesholt
[link] [comments]



Now that the CPAN module sealed.pm has stabilized at v7 after a year of solid real world live mod_perl 2 + ithread hosting , I think it's time to step back and ask exactly *why* this feature - first offered to p5p in 2001 by Doug MacEachern, wasn't ever incorporated into the core feature set of the language. For background, see

iconoclasts.blog/joe/perl7-sea…

Instead of "it" being a technical issue at stake, it seems clear that the reason Doug's patch was rejected was more of a social problem. The Language Design Weenies in the Damian Conway Personality Cult at the time didn't *want* this feature, since only Dylan had it, and Python was never going to get it. So it was rejected outright.

Sadly, that attitude still is pervasive in the upper echelons of the community, but I think the community is better served by breaking out this functionality into a subroutine attribute that only operates on typed lexicals, which otherwise serve no useful purpose.

What do you think? Have you tried sealed.pm out in your codebase yet?

submitted by /u/joesuf4
[link] [comments]




Hello everyone! First, let me start off by saying I am no Linux guru and I am definitely no Perl expert, so I apologize if these are dumb questions or if I don't provide enough information... Let me preface this post with a little backstory!

I want to test Request Tracker for my IT team to use. It looks promising and it looks like what we need. That being said, this install has been an absolute nightmare. The guides are very hit and miss, the other walkthroughs that I've been able to google have only been partially accurate... It's been a very frustrating time. I know, most people would have walked away from it at this point, but I'm stubborn and now I'm determined to make it work - even if we don't go forward using it. I HAVE been able to piece together a complete walk through, which is nice, and it gives me the base install. In order to get what I feel like I need to make this work for my environment, I need to have a few of their add-ins installed, and that's where my trouble comes in...

Example - Here is an example of what I'm trying to get installed. Initially, when I ran the perl Makefile.PL command, I got the error listed in the title. After digging for a few days, I was able to find this on another post in the RT forums:

$ sudo apt-get install libgd-dev libgraphviz-dev graphviz autoconf apache2 libapache2-mod-fcgid slapd ldap-utils expat openssl libssl-dev # Install standalone Perl for RT $ wget http://www.cpan.org/src/5.0/perl-5.26.3.tar.gz $ tar -xzf perl-5.26.3.tar.gz $ cd perl-5.26.3 $ sudo ./Configure -des -Dprefix=/opt/perl5 $ sudo make $ sudo make test $ sudo make install # Use new Perl install: $ export PATH=/opt/perl5/bin:$PATH $ which Perl # Install Meta CPAN $ wget https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz $ /opt/perl5/bin/perl Makefile.PL $ make $ make test $ sudo make install # Tell RT to use metacpan $ export RT_FIX_DEPS_CMD='/opt/perl5/bin/cpanm --sudo --notest' # Configure RT $ ./configure --enable-gd --enable-graphviz 

This still gave me the error, and then digging a little more got me this:
# CD into App-cpanminus-1.7044.tar.gz $ cd App-cpanminus-1.7044.tar.gz # Run perl Makefile.PL $ perl Makefile.PL 

So, if I run perl Makefile.PL from /home/username/App-cpanminus-1.7044.tar.gz it works. But if I try to do this from anywhere else, I get the error message listed in the subject. I thought that this:
export PATH=/opt/perl5/bin:$PATH

would resolve that? Or am I mistaken?

I can run the perl Makefile.PL in the above directory, but then to continue the steps for the add-in (Example link from above), when I get to the make initdb command, I get a totally different error:
make: *** No rule to make target \initialize-database’.? Stop.`

Which completely stops me again... which is why I'm hoping if I can get the initial error resolved, the rest of this will work like it should. There are about a dozen add-ins that I'd like to add, but if I can't get past any of this, then it's a moot point. I know I should give up and look for something else, but my company is in the middle of a divestiture, and I need something to help cover my US sites until we are completely integrated into the new parent company.

Thank you in advance for any advice or suggestions!

submitted by /u/IT_Guy_In_TN
[link] [comments]



The RequireExplicitInclusion policy will complain about modules that you're using but didn't specifically include. For example:

use Test::More; sub test_something { local $Test::Builder::Level = $Test::Builder::Level + 1; return is( ... ); } 

The policy will complain about you using $Test::Builder::Level without including Test::Builder.

Ideally you could tell the policy that Test::More brings in Test::Builder but until then you can now do this:

[Modules::RequireExplicitInclusion] ignore_modules = Test::Builder 

submitted by /u/petdance
[link] [comments]


Running a Perl script with -C seems to enable most of the UTF-8 stuff I would want. How do I get the same functionality inside of a Perl script? Perlrun mentions putting it on the shebang line, but that doesn't work above v5.10?

The utf8::all module also seems to do what I want, but it's not a core module. Is there a simple way in core Perl to just say "turn on UTF8 pretty much everywhere"?

submitted by /u/scottchiefbaker
[link] [comments]




I've been using perl for 35+ years. As a sysadmin (and hobbyist, tool developer, whatever) it's long been my go-to language for the vast majority of my development efforts.

Over that time I've definitely seen it fading. But in the past year I've seen more concerning issues. The meta cpan website is often sluggish, and right at the moment, it's partly offline (some pages work, others, perhaps less frequently used, are offline).

Some modern Linux distros ship with a crappy set of modules. Like, no LWP. And my experience getting modules for basic functionality is not encouraging. It's very unfortunate for example that LWP doesn't know how to find installed web CAs on standard Linux distributions. Sure, I can make it work, but things just seem to be getting more and more fiddly for basic common functionality.

I've coded python a bit here and there. I've never cared for the language, but most of these concerns are surface and ultimately irrelevant, if the day-to-day experience is better than perl. And yeah, there's a lot to not like about python's day-to-day experience. The multiple confusing approaches to virtual environments and the necessity of understanding them to operate sucks. But when it comes down to it, any language style or design dislike I may have pales in comparison to the question: "is the language sufficiently supported?"

For the first time in the long history of doom-saying about perl, I'm beginning to have doubts if the answer to that question is still "yes". But maybe it's just the frustration of this one particular evening (temporary web problems while trying to find a well-supported multi-platform approach to filesystem events notification that can seamlessly work with the select() call).

submitted by /u/thomasafine
[link] [comments]






Hey folks, how do I assign the result of split() to a hash-key?

my $str ='a,b,c'; my $result = {str => split(',' $str)};

Results in: str = 'a'

submitted by /u/Terrible_Cricket_530
[link] [comments]



Has anyone tried Intel's OneAPI compiler suite to compile and use Perl? I mention OneAPI because it is available for free now (on Ubuntu, etc). I plan to give it a shot, I'd like to extended Alien::OpenMP to support it depending on how easy it is to compile perl with it.

submitted by /u/OODLER577
[link] [comments]