Skip to main content





This is the frame body I was using:

our $frame_body = $mw->Frame(-background => $color_theme_bg, -foreground => $color_theme_fg)->pack(-side => 'top'); 

And I have many widgets like labels, dropdowns, buttons, etc... within that frame like below:
 $frame_body ->Label( -text => "@_", -font => $arial_font, -foreground => $color_theme_fg, -background => $color_theme_bg, -highlightthickness => 0, -takefocus => 0, -relief => "flat", -justify => 'center', )-> grid( -column => $mw_col_ctr, -row => $mw_row_ctr, -sticky => "nsew", ); 

May someone help me the best way to apply a "vertical scroll bar" on the right side of this frame?

Its also nice if automatically adjust incase I manually resize the window. 😀

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




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


Is there a way to replace accented characters by their plain version, something like

tr/ûšḥ/ush/?

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



List of new CPAN distributions – May 2024 submitted by /u/perlancar
[link] [comments]



Is it possible to display an image to the user, without loading all the trappings of a whole widget / event-loop environment like Prima, Tk, Wx, Win32::GUI, etc?

Specifically, I want something simple that I can execute in a BEGIN block to display a splash image to the user while the rest of the application is compiled and initializes, which takes about 5-10 seconds. The program in question is a perl Wx application running under MS Windows.

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




Vim highlights subs with a signature params as red/orange to alert you it's incorrect. Now that Perl actually supports signatures and this is no longer a syntax error I need to find a way to disable this. This is really a Vim question, but I'm sure some other Perl nerd out there has run into this before me.

Has anyone figured out how to disable this "warning" in Vim?

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






A quick demo I threw togetherI 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
[link] [comments]




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



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]



Function parameters of arrays sized 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]





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



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]



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










List of new CPAN distributions – Apr 2024 submitted by /u/perlancar
[link] [comments]






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


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]



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.