strip out of single quotes
2 direct replies — Read more / Contribute
|
by frank1
on Sep 16, 2025 at 09:26
|
|
|
90'+7'
my question is how to strip out of single quotes between +7 and have integer 90+7 = 97
i want to strip out of single quotes when time '+additional time' exits, if not then nothing to strip out
|
parse json
2 direct replies — Read more / Contribute
|
by frank1
on Sep 14, 2025 at 12:56
|
|
|
i need some help on parsing some json msg, am doing a get request and getting the json output, but need help in parsing it
and separating both teams with thier scores in declosed "competitors": {}, {}
this is my json output
{
"leagues": [
{
"id": "700",
"season": {
"year": 2025,
"type": {
"id": "1",
"type": 13481
}
},
"logos": [
{
"width": 500,
"height": 500,
"rel": [
"full",
"default"
],
"lastUpdated": "2019-05-08T16:07Z"
},
{
"width": 500,
"height": 500,
"rel": [
"full",
"dark"
],
"lastUpdated": "2021-08-10T20:43Z"
}
],
"calendarType": "day",
"calendar": [
"2025-08-15T07:00Z"
]
}
],
"events": [
{
"id": "740633",
"season": {
"year": 2025,
"type": 13481
},
"competitions": [
{
"id": "740633",
"status": {
"clock": 540,
"displayClock": "9'",
"period": 1,
"type": {
"id": "25",
"shortDetail": "9'"
}
},
"venue": {
"id": "197",
"fullName": "Turf Moor",
"address": {
"country": "England"
}
},
"format": {
"regulation": {
"periods": 2
}
},
"notes": [],
"geoBroadcasts": [],
"broadcasts": [],
"broadcast": "",
"competitors": [
{
"id": "379",
"homeAway": "home",
"score": "0",
"records": [
{
"name": "All Splits"
}
],
"team": {
"id": "379",
"name": "Burnley",
"links": [
{
"rel": [
"clubhouse"
],
"isHidden": false
},
{
"rel": [
"stats"
],
"isHidden": false
},
{
"rel": [
"schedule"
],
"isHidden": false
},
{
"rel": [
"squad"
],
"isHidden": false
}
],
"venue": {
"id": "197"
}
},
"statistics": [
{
"name": "appearances"
}
]
},
{
"id": "364",
"homeAway": "away",
"score": "0",
"records": [
{
"name": "All Splits"
}
],
"team": {
"id": "364",
"name": "Liverpool",
"links": [
{
"rel": [
"clubhouse"
],
"isHidden": false
},
{
"rel": [
"stats"
],
"isHidden": false
},
{
"rel": [
"schedule"
],
"isHidden": false
},
{
"rel": [
"squad"
],
"isHidden": false
}
],
"venue": {
"id": "192"
}
},
"statistics": [
{
"name": "appearances"
}
]
}
],
"details": [],
"odds": [
{
"provider": {
"id": "2000"
},
"awayTeamOdds": {
"summary": "1/3",
"team": {
"id": "364"
},
"link": {
"language": "en-GB",
"rel": [
"away"
],
"isHidden": false
}
},
"homeTeamOdds": {
"summary": "8/1",
"team": {
"id": "379"
},
"link": {
"language": "en-GB",
"rel": [
"home"
],
"isHidden": false
}
},
"drawOdds": {
"summary": "4/1",
"link": {
"language": "en-GB",
"rel": [
"draw"
],
"isHidden": false
}
}
}
],
"wasSuspended": false,
"playByPlayAvailable": true,
"playByPlayAthletes": true
}
],
"status": {
"clock": 540,
"displayClock": "9'",
"period": 1,
"type": {
"id": "25",
"shortDetail": "9'"
}
},
"venue": {
"displayName": "Turf Moor"
},
"links": [
{
"language": "en-GB",
"rel": [
"live"
],
"isHidden": false
},
{
"language": "en-GB",
"rel": [
"stats"
],
"isHidden": false
}
]
}
]
}
this is my part of script i want to fix, and output all teams with the scores
for my $match (@{$parse_json->{leagues}}) {
my $elapsed = $match->{competitions}{status}{displayClock};
my $status = $match->{wasSuspended};
my $home = $match->{competitors}{team}{homeAway};
my $away = $match->{competitors}{team}{homeAway};
my $away_goal = $match->{competitors}{score};
my $home_goal = $match->{competitors}{score};
print "$elapsed: $home: $home_goal: Suspended Match: $status";
print "$elapsed: $away: $away_goal: Suspended Match: $status";
}
|
Type::Params signature_for - can it handle method + variable string args without arrayref wrapping?
1 direct reply — Read more / Contribute
|
by Anonymous Monk
on Sep 13, 2025 at 11:14
|
|
|
MyPackage->import(qw(symbol1 symbol2 symbol3));
I need to validate that:
It's a proper method call (class name first)
Followed by at least one non-empty string argument
But I want the arguments to remain as individual scalars in @_, not get wrapped into an arrayref.
Every approach I've tried with slurpy ends up forcing the string arguments into an arrayref:
use Type::Params qw( signature_for );
use Types::Standard qw( slurpy Any );
signature_for import => (
method => 1,
pos => [ slurpy Any ],
);
sub import {
warn "Args: ", join(", ", map { ref($_) || $_ } @_), "\n";
# Shows: Args: MyPackage, ARRAY(0x...)
}
Is there a way to make signature_for validate the method signature but leave the variable argument list as individual scalars in @_? Or is Type::Params fundamentally designed around restructuring arguments into containers?
Currently using Params::Validate which works fine, but curious if Type::Params can handle this use case.
|
Retrieve and Print TextArea Content
1 direct reply — Read more / Contribute
|
by Milti
on Sep 12, 2025 at 11:06
|
|
|
I want to retrieve and print the contents of a Text Area exactly as it was input from a keyboard, i.e. with no HTML formatting. I am using the code noted below. The content is retrieved and printed but as a single line when it was entered as multiple paragraphs. This is the code I am using
use strict;
use warnings;
use CGI;
my $q = CGI->new;
# Print the HTTP header
print $q->header;
# Get the content of the text area.
# Replace 'textarea_name' with the actual 'name' attribute of your HTM
+L textarea.
my $textarea_content = $q->param('message');
# Print the content exactly as received
####print "Content of the text area:\n";
print $textarea_content;
When content is entered as HTML it is returned as originally entered. Otherwise the return is one line. Is there a way to solve my problem? Thanks for any and all help!
|
Label makes a sub to return empty list -- "secret"? documented?
1 direct reply — Read more / Contribute
|
by Anonymous Monk
on Sep 11, 2025 at 05:58
|
|
|
(Assuming the PM is sooner alive than dead & I can still read/write here), I noticed some cpan modules have a label (the _: to be specific, mostly in modules by SPROUT, but also perl itself if example is needed) at the end of a sub; it's deparsed into () i.e. empty list. Why? Is this behaviour documented anywhere?
|
Released modules sometimes newer on metacpan.org than on cpan.org?!
1 direct reply — Read more / Contribute
|
by Intrepid
on Sep 07, 2025 at 18:25
|
|
|
I've got an observation/question to make that isn't about the Perl language
but instead is about our Perl infrastructure. Hope it's ok to put it at SoPW
anyhow.
I went to look at what's been released recently, at metacpan.org, and found
Image::ExifTool v13.35, released a day ago. On my CygwinPerl installation I
have cpanplus set up to install CPAN modules. In the cpanp
shell I typed i Image::ExifTool and cpanplus found v13.30, not v13.35! Is this a known
thing? How would metacpan have a newer release than cpan.org? Aren't packages
uploaded to cpan.org first, then somehow appear on metacpan.org?
What I did about it was this. I first ran x --update_source, which did not cause the newer Image-ExifTool to show up.
Then, I uninstalled v13.30 (probably an unnecessary
step). Then I downloaded the ExifTool .tar.gz package from metacpan
and unrolled the archive, typed i <path to archive dir> and hit enter. Pleasingly,
that worked (cpanplus does have some good features).
— Soren
Sep 07, 2025 at 22:09 UTC
A just machine to make big decisions
Programmed by fellows (and gals) with compassion and vision
We'll be clean when their work is done
We'll be eternally free yes, and eternally young
Donald Fagen —> I.G.Y.
(Slightly modified for inclusiveness)
|
How to use Perl to assign different fill colors to columns in the same series of an Excel chart?
2 direct replies — Read more / Contribute
|
by CoVAX
on Sep 04, 2025 at 17:02
|
|
|
Not a Perl question per-se: This code creates an Excel file containing a column chart with one series of 36 points. The color of each column in this series is the same color.
My question is: how can one use Perl to assign the fill color '#ED7D31' to the first 12 columns, '#4472C4' to the following 12 columns, and '#00B050' to the final 12 columns?
In case it matters: perl 5.24 running on Windows 7.
#! perl -w
use strict;
use warnings;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new( 'test.xlsx' );
my $worksheet = $workbook->add_worksheet( 'C' );
my $a_fill_color = $workbook->add_format( bg_color => '#ED7D31' );
my $b_fill_color = $workbook->add_format( bg_color => '#4472C4' );
my $c_fill_color = $workbook->add_format( bg_color => '#00B050' );
my $headings = [ 'FY 2024 Big-3', 'Total' ];
my $data = [
[ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'A
+pr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'A
+pr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'A
+pr', 'May', 'Jun',
],
[ 15, 18, 17, 16, 13, 12, 20, 16, 35, 10, 22, 21,
10, 22, 20, 28, 24, 28, 23, 34, 39, 27, 56, 35,
5, 7, 7, 2, 7, 5, 7, 3, 6, 12, 3, 2,
],
];
$worksheet->write( 'A1', $headings );
$worksheet->write( 'A2', $data );
my $chart = $workbook->add_chart(
type => 'column',
subtype => 'clustered',
embedded => 1,
name => 'CHART03' );
$chart->add_series(
name => '=C!$B$1',
categories => '=C!$A$2:$A$37',
values => '=C!$B$2:$B$37',
data_labels => { value => 1 },
gap => 40,
);
$chart->set_title ( name => 'FY 2024 Big-3' );
$chart->set_legend( position => 'none' );
$chart->set_style( 10 );
$chart->set_x_axis( name => '', minor_unit => 1, major_unit => 1 );
$chart->set_y_axis( name => '' );
$chart->set_size(width => 1200, height => 600);
$worksheet->insert_chart( '=C!$D$1', $chart, 10, 10 );
$workbook->close() or die "XLSX: Error closing file: $!";
exit(0);
Searched for donut and crumpit. Found donate and stumbit instead.
|
Module::Build Build.PL parameter inserted by Module::Starter - fatal error
1 direct reply — Read more / Contribute
|
by Intrepid
on Sep 02, 2025 at 14:40
|
|
|
I hope I can get connectivity to Perlmonks long enough to post this write-up.
It's been just terrible. Ok. We'll hope for better days ahead.
I used Module::Starter to create the accessory files and build infrastructure for
a module I've been working on for some time now. I tried installing from CPAN on a Linux box using cpan (the script) and strangely
enough, although I had cpan set up to prefer EU::MM (Makefile.PL) over M::B, it used
M::B. This was a fortunate error because there was mistaken encoding on the Build.PL
file (my name with an umlaut over the "o" gave perl indigestion). And it was also fortunate because the
template-created Build.PL had an entry for release_status that terminated the
creation of ./Build with extreme prejudice:
$ perl Build.PL --installdirs=site
Illegal value 'experimental' for release_status
I have now probably explained enough of the circumstances to ask my question: is
this a problem other people have noticed? I just deleted the entire line and then
Build.PL ran to completion. Was there a change of heart on the part of M::B authors,
regarding a release_status of "experimental"? or was the inclusion of this by
Module::Starter a mistake? Guesses, ideas, knowledge? TIA.
Oh, and do download / install Env::AsYaml from CPAN.
— Sören :-)
Sep 02, 2025 at 18:24 UTC
A just machine to make big decisions
Programmed by fellows (and gals) with compassion and vision
We'll be clean when their work is done
We'll be eternally free yes, and eternally young
Donald Fagen —> I.G.Y.
(Slightly modified for inclusiveness)
|
How to install image::Magick to Strawberry Perl on Windows-10?
1 direct reply — Read more / Contribute
|
by gelbukh
on Aug 31, 2025 at 11:28
|
|
|
I've spent months trying to install Image::Magick for my Strawberry on Windows-10: cpan install |Image::magick fails with "Magick.xs:56:10: fatal error: MagickCore/MagickCore.h: No such file or directory"
WhatI've tried:
From the official Magick site, I downloaded and ran every .exe "installer". All succeeded until Finish, but they seem to only unpack some files and not to interact with the Perl installation. Perl still fails to use Image::Magick; I also noted that some of the "installers" unpack a .ppd file in their installation directory. But ppm install Image-Magick.ppd in that directory fails with "but it is not intended for this build of Perl (MSWin32-x64-multi-thread-5.40)". <code >perl -v </code> says:
This is perl 5, version 40, subversion 0 (v5.40.0) built for MSWin32-x64-multi-thread.
Is there an easy way to make use Image::Magick work on My Strawberry
perl? on Windows? If possible step-by-step what specifically to do; from where to download what .
|
Perl's __LINE__ off by 2
4 direct replies — Read more / Contribute
|
by TorontoJim
on Aug 25, 2025 at 05:33
|
|
|
I have a script doing some counting and logging for debugging/development. I have this line to record the file name and physical line of the statement:
$spinner->count('benchLoop', __FILE__, __LINE__);
While I have this on line 93 of the physical file, Perl __LINE__ is reporting line 95. THere is nothing else on that line, there is no modification of the value in the sub handling it. __FILE__ is reported correctly.
Any idea why __LINE__ would be consistently off by 2?
|
|