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 |
Birds that Flock Together
So I’ve been prepping for my class on Game Development and one of the things I want to introduce to people is the concept of an ECS (Entity Component System).Chris Prather (The Room)
[link] [comments]
(cdxcvii) 8 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
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]
I've been trying to debug an issue for 3 days now, am getting nowhere, and am about to headbutt my laptop. If anyone's done any heavy lifting with Net:DBus then, for the sake of my laptop, I'd really appreciate the help!
Problem description: I have a hash table with a bunch of keys. The values relating to those keys are of different types (as in, I've cast them to dbus types). So:
my $testhash = {}; $testhash->{"xesam:albumArtist"} = [dbus_string("Tom Waits")]; $testhash->{"xesam:album"} = dbus_string("Mule Variations"); $testhash->{"xesam:trackNumber"} = dbus_int32(1); $testhash->{"xesam:artist"} = [dbus_string("Tom Waits")]; $testhash->{"xesam:title"} = dbus_string("Big in Japan"); $testhash->{"mpris:artUrl"} = dbus_string("file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/folder.jpg"); $testhash->{"mpris:length"} = dbus_int64(64182857); $testhash->{"mpris:trackid"} = dbus_object_path("/0"); $testhash->{"xesam:url"} = dbus_string("file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/01 - Big in Japan.mp3");
I've created a DBus service, and have successfully implemented a method that returns that hash table ($IFACE is the interface name I'm using for all of my test methods):
dbus_method("ReturnDynamicHash", [], [["dict", "string", ["variant"]]], $IFACE); sub ReturnDynamicHash { my $self = shift; print "Object: ReturnDynamicHash called.\n"; my $return = {}; my @keys = keys(%{$testhash}); my $count = scalar(@keys); if ($count) { foreach my $key (@keys) { $return->{$key} = $testhash->{$key}; } } return $return; }
As a DBus method, this works perfectly:
% dbus-send ....... .ReturnDynamicHash array [ dict entry( xesam:trackNumber variant int32 1 ) dict entry( mpris:trackid variant /0 ) dict entry( xesam:albumArtist variant array [ Tom Waits ] ) dict entry( xesam:album variant Mule Variations ) dict entry( mpris:length variant int64 64182857 ) dict entry( xesam:url variant file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/01 - Big in Japan.mp3 ) dict entry( mpris:artUrl variant file://mnt/storage/Music/mp3/Tom Waits/Mule Variations/folder.jpg ) dict entry( xesam:artist variant array [ Tom Waits ] ) dict entry( xesam:title variant Big in Japan ) ]
However, the interface I'm implementing requires that a DBus Property return that hashtable, not a method:
dbus_property("StaticHashProperty", [["dict", "string", ["variant"]]], "read", $IFACE); sub StaticHashProperty { print "Object: StaticHashProperty accessed.\n"; my $return = {}; my @keys = keys(%{$testhash}); my $count = scalar(@keys); if ($count) { foreach my $key (@keys) { $return->{$key} = $testhash->{$key}; } } return $return; }
and this doesn't work.
From the dbus-send client I get
Error org.freedesktop.DBus.Error.NoReply: Remote peer disconnected
and from the Perl server stderr i get:
dbus[93409]: Array or variant type requires that type array be written, but object_path was written. The overall signature expected here was 'a{sas}' and we are on byte 4 of that signature. D-Bus not built with -rdynamic so unable to print a backtrace Aborted (core dumped)
Now, this error is coming from libdbus itself, not the Perl wrapper (though could of course still be a bug in the Perl module that's causing the error). It seems to have entirely the wrong signature ( a{sas}, not a{sv} as defined above the Property method) and therefore appears to be complaining that the type of one of the values is wrong (each time I run it I get a slightly different error; I think it's deducing the signature from the first key-value pair it pulls from the hash and assumes they should all be the same - so if the first pair it pulls has a uint64 value, then it complains that the next pair doesn't also have a uint64 value).
Since the Method works I know Net::DBus can handle these sorts of return values, but for some reason, as a property, it just isn't working. I also know that other applications do implement this interface, including this Property, successfully, so I know this isn't a limitation of DBus.
I've been looking at the code in Net::DBus that handles serialization, assuming there must be some difference between how Properties and Methods are handled, but can't see anything obvious.
Anyone? Any idea? Literally anything at all? Thank you!!!!!
submitted by /u/Flashy_Boot
[link] [comments]
The following is a quick ramble before I get into client work, but might give you an idea of how AI is being used today in companies. If you have an questions about Generative AI, let me know!
The work to make the OpenAI API (built on Nelson Ferraz's OpenAPI::Client::OpenAI module) is going well. I now have working example of transcribing audio using OpenAI's whisper-1 model, thanks to the help of Rabbi Veesh.
Using a 7.7M file which is about 16 minutes long, the API call takes about 45 seconds to run and costs $0.10 USD to transcribe. The resulting output has 2,702 words and seems accurate.
Next step is using an "instruct" model to appropriately summarize the results ("appropriate" varies wildly across use cases). Fortunately, we already have working examples of this. Instruct models tend to be more correct in their output than chat models, assuming you have a well-written prompt. Anecdotally, they may have smaller context windows because they're not about remembering a long conversation, but I can't prove that.
Think about the ROI on this. The transcription and final output will cost about 11 cents and take a couple of minutes. You'll still need someone to review it. However, think of the relatively thankless task of taking meeting minutes and producing a BLUF email for the company. Hours of expensive human time become minutes of cheap AI time. Multiply this one task by the number of times per year you have to do it. Further, consider how many other "simple tasks" can be augmented via AI and you'll see why it's becoming so powerful. A number of studies show that removing many of these simple tasks from people's plates, allowing them to focus on the "big picture," is resulting in greater morale and productivity.
When building AI apps, OpenAPI::Client::OpenAI should be thought of as a "low-level" module, similar to DBIx::Class. It should not be used directly in your code, but hidden behind an abstraction layer. Do not use it directly.
I tell my clients that their initial work with AI should be a tactical "top-down mandate/bottom-up implementation." This gives them the ability to start learning how AI can be used in different parts of their organization, given that marketing, HR, IT, and other departments all have different needs.
Part of this tactical approach is learning how to build AI data pipelines. With OpenAI publishing their OpenAPI spec, and with Perl using that, we can bring much of the power of enterprise-level AI needs to companies using Perl. It's been far too long that Perl has languished in the AI space.
Next, I need to investigate doing this with Gemini and/or Claude, but not now.
Note, if you're not familiar with the BLUF format, it's a style of writing email that is well-suited for email in a company that is sent to many people. It's "bottom-line up front" so that people can see the main point and decide if the rest of the email is relevant to them. It makes for very effiicient email communication.
submitted by /u/OvidPerl
[link] [comments]
BLUF: THE method for better and effective written communication
Communication in remote work is all about written communication. That’s the big shift that happened regarding how we communicate. The Economist and Information Week are two examples of many…Gabriela De Luca (Medium)
Hi all,
Nelson Ferraz has been working with generative AI for a while. I've started collaborating with him on his OpenAI modules. He wrote a module named OpenAI::API, but it required manually writing the code for all of the behavior. With the size of the OpenAI API, the rapid evolution, of said API, the birth of new models and the deprecation of old models, this approach turned out to be unmaintainable.
Thus, that module was deprecated in favor of Nelson's OpenAPI::Client::OpenAI module. Throw the 13K+ lines OpenAPI spec for OpenAI at it and it just works. Further, the module is pretty much a single Perl class rather than a bunch of hand-crafted code.
CPAN authors know it can be hard to keep modules up-to-date (mea culpa, mea culpa!) and this module is no exception. I need this module so I offered to collaborate and created a PR to update it to version 2.0.0 of the OpenAI spec. It now passes all the tests (for those wondering, you need an OpenAI key and it costs $0.04 USD to run the test suite).
In trying to build a Whisper pipeline for that, I found that I couldn't. There was a PR for Whisper support for the older module, but for the newer one, I can't figure out how to get it to issue a request with multipart/form-data
support. I've noted the issue in the PR.
If anyone would like to see OpenAI support for Perl, we would dearly love to collaborate with you to make this happen.
submitted by /u/OvidPerl
[link] [comments]
[link] [comments]
(cdxcvi) 6 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. Dev...niceperl.blogspot.com
submitted by /u/oalders [link] [comments] |
This is Your Opportunity to Sponsor the Perl and Raku Conference 2024
Sponsorship opportunities for the 2024 Perl and Raku Conference are still availablePerl.com
I want to repeat a process for every key in a hash, with numeric keys. So there are 3 possibilities, with 3 if, and each one compares the value of the index of an array, so that if that position eq to "sp", "sp2" or "sp3" it will search in a document some value so then it can be printed. It doesn´t work and every times gives me only one value, i would like to get the values that correspond with the hash. For example the hash could be %grupos=(1,'A',2,'G',3,'J')
and the array @hibridaciones=("sp","sp2",sp3")
The document .txt (simplified) is:
HS0.32 CS0,77 CD0.62 CT0,59 C10,77 C20,62 C30,59 OS0.73 OD0,6 O10,73 O20,6 NS0.75
The code is:
open (covalencia,"<", "cov.txt") or die "$!\n"; print keys %grupos; keys %grupos; foreach my $z (keys %grupos) { print "\n$z\n"; if (@hibridaciones[my $z-1] eq “sp") { while (my $line = <covalencia>) { if ( $line=~/C1/) { $line =~s/C1//; $radio=$line; print "\n$radio"; } } } if (@hibridaciones[my $z-1] eq "sp2") { while (my $line = <covalencia>) { if ($line=~/C2/) { $line =~s/C2//; $radio=$line; print "\n$radio"; } } } if (@hibridaciones[my $z-1] eq "sp3") { while (my $line = <covalencia>) { if ($line=~/C3/) { $line =~s/C3//; $radio=$line; print "\n$radio"; } } } } close (covalencia);
submitted by /u/SamuchRacoon
[link] [comments]
[link] [comments]
(cdxcv) 8 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. DBD...niceperl.blogspot.com
submitted by /u/Adriaaaaaaaan [link] [comments] |
gpw2024 - Deutscher Perl/Raku Workshop 2024
Der Deutsche Perl/Raku-Workshop ist eine jährlich in Deutschland stattfindende Open-Source-Konferenz für jedermann. Der Workshop in 2024 fand vom 15.04.2024 ...YouTube
On this site: https://codegolf.stackexchange.com/questions/246845/convert-json-object-of-directories-to-list-of-paths
There is an interesting perl solution but I'm trying to wrap my head around it and am baffled.
map/}/?/{/&&say($s)..$s=~s|[^/]+/$||:($s.=s/"//gr."/"),/{?}|".+?"/g When I do a simple test: my $s = <some json string> .. the map above I don't get any output. Thanks in advance
submitted by /u/UnicodeConfusion
[link] [comments]
Convert JSON object of directories to list of paths
Task The input consists of a JSON object, where every value is an object (eventually empty), representing a directory structure. The output must be a list of the corresponding root-to-leaf paths.Code Golf Stack Exchange
I have a bunch of files that I am parsing out a simple tag
<institution content-type="division">(.+?)?<\/institution>
Everything is going fine until I hit this result:
2) School of Chemical & Biomolecular Engineering
This is complaining because it thinks the ) is unmatched. How do I get it to accept whatever is in the capture? I tried playing around with \Q and \E but that isn't working. For clarity, I won't know what is in this tag, it could be anything at all and the tag is simple enough that I don't want to use some XML parser.
submitted by /u/sirhalos
[link] [comments]
I'm experimenting with different frameworks and I've come across this wonderful catalyst framework based on Perl, does anyone know of a front end (which is website, forums, etc.) coupled with a back end (tracker engine) for use with modern Perl? I have a PHP based one and was wondering if it was possible to do the same using Perl.
submitted by /u/Otherwise-Tune-257
[link] [comments]
Asking for a friend. No really, I don't use VSCode but I know that a lot of people do and in one week I had two different people ask me this. I didn't see anything in the Visual Studio Marketplace. I'm looking for something like markdown-preview enhanced, but for Pod.
If you don't have that, is it something that you would want?
If it's something you want, would you throw in some money to have it? This isn't something I'd do myself, but I know some people with some free time who could use a little money. I could crowdfund it or whatever. The intent is to have something free in the Marketplace.
Would you care if it's not implemented in Perl? If it was JS or whatever VSCode prefers but does the job, that's fine with me (and remember I don't use VSCode). I have no idea how much that matters, but I'd hate for people to have to do all sorts of crazy setup, which for many people is installing anything from CPAN.
submitted by /u/briandfoy
[link] [comments]
m, n → m+n
is the hello world of dependent types. I hacked this together over two evenings:use 5.038; use strictures; use Kavorka qw(fun); use Moops; our %TypeVarRegistry; class MyTypes extends Type::Library :ro { use Type::Library -declare => qw(TypeVar TypeVarExpr); use Types::Common::String qw(NonEmptyStr); use Types::Standard qw(ArrayRef); use Types::Common::Numeric qw(PositiveOrZeroInt); my $TypeVar = Type::Tiny->new( name => 'TypeVar', constraint_generator => fun(NonEmptyStr $name → CodeRef) { fun {} } ); my $TypeVarExpr = Type::Tiny->new( name => 'TypeVarExpr', constraint_generator => fun(NonEmptyStr $name → CodeRef) { fun {} } ); my $SizedArray = Type::Tiny->new( name => 'SizedArray', parent => ArrayRef, constraint_generator => fun( Enum["type"] $literal_type, Type::Tiny $parameterized, Enum["length"] $literal_length, $expr → CodeRef ) { if (PositiveOrZeroInt->check($expr)) { fun { $expr == ArrayRef->of($parameterized)->assert_return($_)->@* } } elsif ('TypeVar' eq $expr->parent->name) { fun { $TypeVarRegistry{$expr->parameters->[0]} = ArrayRef->of($parameterized)->assert_return($_)->@*; 1 } } elsif ('TypeVarExpr' eq $expr->parent->name) { fun { my $eval; # world's worst symbolic expr parser if ( my ($var1, $op, $var2) = $expr->parameters->[0] =~ /(\w+)(\+)(\w+)/ ) { $eval = $TypeVarRegistry{$var1} + $TypeVarRegistry{$var2}; } else { die; } $eval == ArrayRef->of($parameterized)->assert_return($_)->@* } } else { die } }, ); __PACKAGE__->meta->add_type($_) for $TypeVar, $TypeVarExpr, $SizedArray; __PACKAGE__->meta->make_immutable; } use MyTypes qw(SizedArray TypeVar TypeVarExpr); fun add_ok( SizedArray[type => Str, length => TypeVar["m"]] $A, SizedArray[type => Str, length => TypeVar["n"]] $B → SizedArray[type => Str, length => TypeVarExpr["m+n"]] ) { [$A->@*, $B->@*] } use Data::Dx; Dx add_ok([qw(e r t)], [qw(e r t)]); fun add_broken( SizedArray[type => Str, length => TypeVar["m"]] $A, SizedArray[type => Str, length => TypeVar["n"]] $B → SizedArray[type => Str, length => TypeVarExpr["m+n"]] ) { [$A->@*, $B->@*, 'this must not work'] } use Data::Dx; Dx add_broken([qw(a s d f)], [qw(g h j k)]);
submitted by /u/daxim
[link] [comments]
I need to find the distance between two GPS coordinates. Geo::Calc does this effectively, but it hasn't been updated in over a decade, and, more seriously, it adds a significant startup delay just by loading the module:
root@1c8fb16bd7bb:/app# time perl -e 'use v5.38' real 0m0.005s user 0m0.001s sys 0m0.004s root@1c8fb16bd7bb:/app# time perl -e 'use v5.38; use Geo::Calc' real 0m0.679s user 0m0.631s sys 0m0.048s
This isn't a deal-breaker (honestly, it barely matters at all in production, but it's annoying for repeated loads during dev/testing), but I was wondering if anyone knew of a more-modern/more-efficient alternative. I searched google and metacpan but it's tough to wade through the noise for such a generic search term.
submitted by /u/tyrrminal
[link] [comments]
The portions of B::Generate associated with PADOP construction use static variables, and thus are not thread safe.
This release imports that section of Generate.xs into sealed.xs and removes the static variable dependencies.
submitted by /u/joesuf4
[link] [comments]
[link] [comments]
(cdxciv) 17 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
submitted by /u/singe [link] [comments] |
Use bash , ncal , Perl to list years, months, and weeks with week numbers
Use bash , ncal , Perl to list years, months, and weeks with week numbers - gist:efa21bd6374824ba8332a3a4ac7b4585Gist
I am hopeful someone has done this before as I'm stuck... I have a 3TB disk image file and I am trying to find all the different email addresses that I've used over the past 22 years.
I can use hex editor tools to find them but it takes days to look at the data and pick out even a handful of matches.
I use Perl regularly but I normally scan text files and do non binary file actions. That's easy since I can do a line by line search. But binary seems different.
If I want to search for zeropoint@ (no domain because I've used dozens of ISPs over the years and that's why I am trying to figure this out.) inside the entire 3TB file, what's the best way to do that? I can dump the results to a file and then clean it up but the search part has me stuck
Thank you
submitted by /u/zeropointlabs
[link] [comments]
[link] [comments]
PTS 2024: Lisbon
Almost exactly a year since the last Perl Toolchain Summit, it was time for the next one, this time in Lisbon. Last year, I wrote:Ricardo Signes (rjbs forgot what he was saying)
submitted by /u/perlancar [link] [comments] |
List of new CPAN distributions – Apr 2024
dist author abstract date AI-Ollama-Client CORION Client for AI::Ollama 2024-04-05T09:15:33 Acme-CPANModules-BPOM-FoodRegistration PERLANCAR List of modules and utilities related to Food Registrati…perlancar's blog
[link] [comments]
(cdxciii) 15 great CPAN modules released last week
Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12. App...niceperl.blogspot.com
Although Benchmark::DKbench is a good overall indicator for generic CPU performance for comparing different systems (especially when it comes to Perl software), the best benchmark is always your own code. Hence, the module now lets you incorporate your own custom benchmarks. You can either have them run together with the default benchmarks, or run only your own set, just taking advantage of the framework (reports, multi-threading, monotonic precision timing, configurable repeats with averages/stdev, calculation of thread scaling etc). Here's an example where I run a couple of custom benchmarks on their own with Benchmark::DKbench:
``` use Benchmark::DKbench;
A simplistic benchmark sub:
sub str_bench { for (1..1000) { my $str = join("", map { chr(97 + rand(26)) } 1..rand(15000)); $str =~ s/a/bd/g; $str =~ tr/b/c/; } }
my %stats = suiterun({ include => 'custom', # Run only my custom benchmarks iter => 5, # Iterations to get an average extra_bench => { custom_bench1 => [&str_bench], # Add one more, just inline this time: custom_bench2 => [sub {my @a=split(//, 'x'x$) for 1..5000}], } }); ``` This will produce a report in STDOUT and also return the results in a hash for a single-thread run. You can also run the benchmarks multi-treaded and then calculate & print the multi/single-thread scalability:
```
If you want to get a count of logical cores:
my $cores = system_identity(1);
my %statsmulti = suite_run({ include => 'custom', threads => $cores, iter => 5, extra_bench => { custom_bench1 => [&str_bench], custom_bench2 => [sub {my @a=split(//, 'x'x$) for 1..5000}], } });
my %scal = calc_scalability(\%stats, \%stats_multi); ```
The report prints results per iteration and also aggregates:
``` Aggregates (5 iterations): Benchmark Avg Time (sec) Min Time (sec) Max Time (sec) custom_bench1: 1.092 1.079 1.107 custom_bench2: 0.972 0.961 0.983 Overall Avg Time (sec): 2.065 2.048 2.080
Aggregates (5 iterations, 10 threads): Benchmark Avg Time (sec) Min Time (sec) Max Time (sec) custom_bench1: 1.534 1.464 1.651 custom_bench2: 1.278 1.225 1.345 Overall Avg Time (sec): 2.812 2.689 2.965 The scalability report summarizes as well:
Multi thread Scalability: Benchmark Multi perf xSingle Multi scalability % custom_bench1: 7.12 71
custom_bench2: 7.61 76
DKbench summary (2 benchmarks, 5 iterations, 10 threads): Single: 2.065s Multi: 2.812s Multi/Single perf: 7.36x (7.12 - 7.61) Multi scalability: 73.6% (71% - 76%) ```
The suite normally uses a scoring system which works better than times, so you can set that up by adding reference times to each benchmark, and you can also make the benchmarks return something (checksum etc) to verify results etc, see POD for more.
submitted by /u/dkech
[link] [comments]
From the tprc-general Slack channel, Todd Rinaldo wrote yesterday that "Talk Accept, Decline, Waitlist emails have been sent out." See tprc.us for more information about this year's Perl and Raku Conference in Las Vegas, NV.
submitted by /u/talexbatreddit
[link] [comments]
Hi! Asking for a wisdom here...
We have a module that modifies signal handler $SIG{__DIE__} to log information and to die afterwards. Hundreds of scripts relied on this module which worked fine in perl 5.10.1.
Recently we had the opportunity to install several Perl versions but unfortunately a large number of scripts that used to work with Perl 5.10.1 now behave differently:
- Failed in 5.14.4:
/home/dev/perl-5.14.4/bin/perl -wc
test.pl
RECEIVED SIGNAL - S_IFFIFO is not a valid Fcntl macro at /home/dev/perl-5.14.4/lib/5.14.4/File/stat.pm line 41
- Worked without changes in 5.26.3:
/home/dev/perl-5.26.3/bin/perl -wc
test.pl
test.pl
syntax OK
- Worked without changes in 5.38.2:
/home/dev/perl-5.38.2/bin/perl -wc test.pl
test.pl syntax OK
Many of the scripts can only be updated to 5.14.4 due to the huge jumps between 5.10 and 3.58; But we are stuck on that failures.
Was there an internal Perl change in 5.14 which cause the failures but works on other recent versions without any update on the scripts?
Cheerio!
submitted by /u/Longjumping_Army_525
[link] [comments]
I understand that many disagree with this statement, but it really makes it easier to build distributions for people who not monks. Wish the documentation was more detailed
submitted by /u/ReplacementSlight413
[link] [comments]
submitted by /u/leejo [link] [comments] |
London Perl & Raku Workshop, 2024
London Perl & Raku Workshop. Perl & Raku Conference and training in London.act.yapc.eu
My environment is perl/5.18.2 on CentOs 7
I'm trying to use a SWIG generated module in perl, which has a c plus plus backend. The backend.cpp sets an environment variable, $MY_ENV_VAR =1
But when I try to access this in perl, using $ENV{MY_ENV_VAR} this is undef.
However doing something like print echo $MY_ENV_VAR
works
So the variable is set in the process, but it's not reflected automatically since nothing updates the $ENV data structure.
I'm assuming it may work using some getEnv like mechanism, but is there a way to reset/ refresh the $ENV that it rebuilds itself from the current environment?
submitted by /u/sarcasmwala
[link] [comments]
By default cpanm drops Perl modules into ~/perl5
. How do I tell cpanm to use a different location, such as ~/.local/share/perl5
instead?
submitted by /u/s-ro_mojosa
[link] [comments]
Fast Perl SSG: now with automatic Language Translation via OCI and translate.pl. Check it out at
https://github.com/SunStarSys/orion
submitted by /u/joesuf4
[link] [comments]
GitHub - SunStarSys/orion: SunStar Systems' Orion Enterprise Wiki SSG
SunStar Systems' Orion Enterprise Wiki SSG. Contribute to SunStarSys/orion development by creating an account on GitHub.GitHub
[link] [comments]
Why I Like Perl's OO
I started programming with QBasic and later C. While it was difficult to learn those languages back then (with no internet and just some books) nothing felt “out of place” for me.davidraab.github.io
Im working on a script to test using a jump server to reach remote devices.
I'm able to connect to the jump server using Net::SSH::Expect, however, I'm not sure how to then ssh to a remote device (network element).
Is there a way to create that ssh to the remote device inside the jump server's connection?
submitted by /u/jtzako
[link] [comments]
First things first, I am a data engineer but have little experience in Perl. I've been able to make some easy updates to scripts in the past but this one is a bit tougher.
I have been asked to update a Perl cgi web app that someone wrote ages ago that is used to view and manipulate text files. Currently it is hosted on server (X) and manipulates the files on that same server. However, we have to have backups/mirrors of the data on a dev server and another prod sever (Y). I.e., if I push the button to move the file to a different folder, it should do that on all three servers instead of just X. I added code to do this, referencing the additional servers with their UNC names, but I just get an error "No such file or directory" (which is not true). Googling has suggested that there may be an issue with permissions, but I can bring up the Y and DEV servers from a windows file explorer using the same path so I don't think that is necessarily the issue.
Example: Here we are trying to copy the file with a letter appended a given number of times. It works fine on the X server, its when trying to make it also work on the Y and DEV servers I get an error.
our $DIR_X = "\\\\serverX\\folder\\subfolder" ; our $DIR_Y = "\\\\serverY\\folder\\subfolder"; our $DIR_DEV = "\\\\serverDEV\\folder\\subfolder"; . . . }elsif ($query->param('action') eq 'split' && $query->param('fileNum') ne "") { my $fileNum $query->param('fileNum'); my $fileX=$DIR_X . "\\" . $fileNum . ".txt"; my $fileY $DIR_Y . "\\" . $fileNum . ".txt"; my $fileDEV = $DIR_DEV . "\\" . $fileNum . ".txt"; my $splitNbr = $query->param('splitNbr'); my @letters1("a".. "z"); for (my $i = 0; $i < $splitNbr; $i++) { my $FileNew_X = $DIR_X . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_Y = $DIR_Y . "\\" $fileNum. $letters[$i]=.txt"; my $FileNew_DEV = $DIR_DEV . "\\" $fileNum. $letters[$i]=.txt"; copy($fileX, $FileNew_X) or die "WARNING: copy failed: $!\n"; ---->>>>>ERROR AT NEXT LINE copy($fileY, $FileNew_Y) or die "WARNING: copy failed: $!\n"; copy($fileDEV, $FileNew_DEV) or die "WARNING: copy failed: $!\n"; }
Any thoughts?
submitted by /u/QueenScorp
[link] [comments]
submitted by /u/oalders [link] [comments] |
Getting Started with perlimports
add short description for open graphOlaf Alders (www.olafalders.com)
I stumbled upon this really nice page from Ruby, describing the language from the perspective of other common programming languages:
https://www.ruby-lang.org/en/documentation/ruby-from-other-languages/
The page is written in a friendly tone, inviting programmers familiar with other programming languages to Ruby. No programming language is being viewed as inferior, quite the contrary: all mentioned languages are praised and even defended from haters, for example:
- "Perl is awesome. Perl’s docs are awesome. The Perl community is … awesome. For those Perlers who long for elegant OO features built-in from the beginning, Ruby may be for you."
- "Happily, it turns out that Ruby and C have a healthy symbiotic relationship. And, of course, Ruby itself is written in C."
- "Java is mature. It’s tested. And it’s fast (contrary to what the anti-Java crowd may still claim)."
- "Python is another very nice general purpose programming language."
I believe Perl could greatly benefit from having a similar page. With its friendly philosophy and TMTOWTDI, it seems natural to invite programmers from other languages, with an approach of "Don't be afraid to keep programming the way you are used to, if it works in Perl, there are no limits enforced".
Since Perl is now not a common choice for new code or for learning, it makes a lot of sense to bring over people from other languages. Especially in an age where strict conventions seem to be praised, I can see Perl becoming a source of some fresh air.
submitted by /u/Lenticularis39
[link] [comments]
my $MAX_PROCESSES=10; my $pm = Parallel::ForkManager->new($MAX_PROCESSES); while (1) { my $pid=$pm->start and next; print "$$ LOCK \n"; $pm->finish; } $pm->wait_all_children;
I made this sample piece of code which I basically took from the docs, I only changed to infinite loop but I cannot understand why this would make any different between an infinite loop and iterating through an array for example? Anyway I am fighting this for several hours now trying different versions of my code and cannot find why am I getting "Cannot start another process while you are in the child process" all the time, any hints appreciated
output looks basically like this
Cannot start another process while you are in the child process at .... 16366 LOCK 16367 LOCK 16368 LOCK 16369 LOCK 16370 LOCK 16371 LOCK 16372 LOCK 16373 LOCK 16374 LOCK 16375 LOCK Cannot start another process while you are in the child process at ....
submitted by /u/Weak_Word221
[link] [comments]