Skip to main content



I’m currently having to modify a library that used Smart::Match extensively since I can no longer turn off the zillions of lines of experimental warnings in recent Perls. For people who are in a similar situation it’s looking like Data::Compare can replace the situations where I was doing ‘@foo ~~ @bar’, and it’s easy enough to write a “does this hash have this key” helper.

Meta complaint: I was already a bit annoyed at the whole smartmatch “oh whoops actually this is now experimental” saga but now that I’m stuck fixing this breakage I’m $annoyed++. Im getting annoyed enough that I may choose an older Perl that was “good enough” and just stop using the new ones

See also: https://www.reddit.com/r/perl/comments/pimwma/how_do_i_stop_smartmatch_is_experimental_at/

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



Hello all I have a .pl CGI program that calls a module with lots of code I'll call it LotsOfCode.pm now I need to update a few subs in it and possibly add a dependency.

The pl file looks like this:

main.pl

use LotsOfCode;

Lotsofcode->cat();

LotsOfCode->dog();

Lotsofcode->fish();

Now I'd like this to say the same but I need to improve fish and cat. Say LotsOfCode.pm looks like this:

package LotsOfCode

sub fish {}

sub dog {}

sub cat {}

1;

I'd like to

mkdir ./LotsOfiCode

nano LotsOfCode/fish.pm move sub fish{} here

nano LotsOfCode/dog.pm move sub dog {} here

nano LotsOfCode/cat.pm move sub cat {} here

what do I put in the top of these new files in \LotsOfiCode ?

package LotsOfCode::fish;

or

package fish; ?

or

nothing is what I have so far just

sub fish {}

then in LotsOfCode.pm

do I go:

package LotsOfCode

use LotsOfiCode::fish

use LotsOfiCode::dog

use LotsOfiCode::cat

1;

or

do LotsOfCode::fish;

do LotsOfCode::cat;

do LotsOfCode::dog;

Thank you all in advance I get the more than one way to do it idea of Perl but feel like I keep fumbling with mixing old and new code.

submitted by /u/bug_splat
[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]



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.






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]



Sanity-check calling context

Changes for 0.04

  • (no code changes)
  • Switched to MIT license.
  • Switched README from POD to Markdown.
  • Removed Travis CI.



Sort lines of text by a Comparer module

Changes for 0.002 - 2024-03-07

  • No functional changes.
  • [doc] Mention some related links.


An assortment of date-/time-related CLI utilities

Changes for 0.128 - 2024-03-07

  • [clis strftime, strftimeq] Use localtime() instead of gmtime(). We can still show UTC using "TZ=UTC strftime ...".



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]



Sah schemas related to BCA (Bank Central Asia) bank

Changes for 0.002 - 2024-04-03

  • Rename module/dist Sah-Schema{s,Bundle}-* following rename of Sah-Schema{s,Bundle} (for visual clarity and consistency with naming of other bundles).



search nested hashref/arrayref structures using JSONPath

Changes for 1.0.5 - 2024-04-22T16:10:46-05:00



simulating paper and pencil techniques for basic arithmetic operations

Changes for 0.01 - 2024-04

  • First version, with the four basic operations, plus square-root, GCD and radix conversion. And HTML rendering


Use a type to validate values in a deep comparison.

Changes for 1.0.1 - 2024-04-22

  • Add Test2::Tools::Type





An open source web-based network management tool.

Changes for 2.076000 - 2024-04-22

  • NEW FEATURES
  • ENHANCEMENTS
  • BUG FIXES


Silverpeak Orchestrator REST API client library

Changes for 0.011000 - 2024-04-22T17:58:39+02:00

  • add support for version 9.3+ API endpoints


A module that performs semantic similarity in PXF/BFF data structures and beyond (JSON|YAML)

Changes for 0.07 - 2024-04-22T00:00:00Z

  • Excluded keys with {} or [] values (e.g. subject.vitalStatus: {})
  • Precompiled regex patterns where possible
  • Schema validation errors related to weights are now directed to STDERR
  • Added support for variables with non-word characters (e.g., "Survey.Timestamp.1")



Pango style markup formatting

Changes for 0.036 - 2024-04-22

  • Introducing struts. Update SYNOPOSIS example to modern PDF::API2 conventions. Fix/enhance drawing of brackgrounds. Fix problem with wrongly calculated underlining.


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]



Get stock and mutual fund quotes from various exchanges

Changes for 1.61_01 - 2024-04-21T17:50:16-07:00

  • YahooWeb.pm - Issue #377. Modified YahooWeb to account for changes from Yahoo.
#377


Sah schemas related to SortKey

Changes for 0.002 - 2024-03-07

  • Rename module/dist Sah-Schema{s,Bundle}-SortKey.


Perl Data Language

Changes for 2.088 - 2024-04-22

  • Slatec::ch{ic,sp} work arrays now [t]
  • add Slatec::bvalu
  • add Func::{pchip,spline}, and a demo
  • add Ufunc::diff2
  • extra ) on end of Pars now an error
  • PP dim sizes can be =CALC(...) instead of explicit RedoDimsCode
  • PP add loop(n=start:end:inc) idiom to stop not at end and have non-1 inc
  • updated README.md - thanks @falsifian
  • support T_PTROBJ in typemap


an interactive plotting widget and library for PDL and Prima

Changes for 0.21 - 2024-04-22

  • demo now only loads Prima when run, reducing perldl problems


demonstrate PDL::Graphics::PLplot capabilities

Changes for 0.84 - 2024-04-22

  • add perldl demo
  • fix plFreeGrid to use free that matches the allocator
  • pl{Alloc,Free}{,2d}Grid error if not match allocating and freeing routine
  • minimum PDL 2.083 due to output OtherPars


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]



Tags helper for table view.

Changes for 0.06 - 2024-04-21T17:26:14+02:00

  • Fix of setting of table data. Copy in this time.


Tags helper for CPAN::Changes object.

Changes for 0.04 - 2024-04-21T16:06:08+02:00

  • Add trivial Changes file and test on it.
  • Fix output on ex1.changes test file.


parses .pm file as PAUSE does

Changes for 0.47 - 2024-04-21

  • Improve class detection


Plack application for running Tags::HTML objects.

Changes for 0.17 - 2024-04-21T12:34:17+02:00

  • Add test for 'css_data'.
  • Rewrite examples in doc to version with indented output.


Perl extension for finding the memory usage of Perl variables

Changes for 0.83_50 - 2024-04-21

  • patch from Slaven:
  • CvOUTSIDE is again set on all cloned subs [CPAN #149902]


Tags helper abstract class.

Changes for 0.10 - 2024-04-21T00:11:40+02:00

  • Add storing of CSS link, JS code and JS links in instance.
  • Use CSS::Struct::Output::Structure in tests only.
  • Use Tags::Output::Structure in tests only.


Plack component for Tags with HTML output.

Changes for 0.16 - 2024-04-21T00:08:47+02:00

  • Add handling of css_src().
  • Fix DEPENDENCIES section in doc.
  • Fix default value of 'tags' parameter in doc.
  • Move inicialization of page begin from prepare to actions phase.
  • Sort parameters in doc.
  • Update copyright years.


stateless, text-based CAPTCHAs

Changes for 0.3

  • Added protections for bad enc_payload to validate()


Client for the NearlyFreeSpeech.NET API

Changes for 1.04 - 2024-04-20

  • Added the sync property to DNS objects
  • Use FindBin to locate inc::My_Build in Build.PL


ITree based document list

Changes for 0.06 - 2024-04-20T11Z

  • Added collapseAll and expandAll methods.