Spreadsheet::ParseXLSX question on merged cells
2 direct replies — Read more / Contribute
|
by chafelix
on Nov 12, 2025 at 18:04
|
|
|
I am using Spreadsheet:Parsexlsx to read an excel file. I need to say "if this is a merged cell, then...."
I used ptkdb to see what attributes there are. So each cell has
-Col and Row ( numbers)
-Format with keys (AlignH,AlignV, BdrColor, BdrDiag,Bdrstyle)
-Fill (an array)
-FmtIdx (a number)
-Font (another hash ref)
-FontNo
-Hiden
-a number of Ignores
-FormatNo
-Rich
-Sheet
-Type
_Val and value
-Lock
-Rotate
-Shrink
-Wrap, (all these numbers)
The problem is none of these seem to have the info I need.
Any ideas?
|
Update Old Selenium Tests
3 direct replies — Read more / Contribute
|
by hbarnard
on Nov 12, 2025 at 04:38
|
|
|
I have a fairly substantial, but 'old', set of tests for Cclite. They use, or used use Test::WWW::Selenium; which now doesn't seem to find a webdriver on any version of Selenium that I download
Error requesting http://10.0.0.65:4444/selenium-server/driver/:
404 Not Found
My tests all take the form of
$sel->open_ok("/cgi-bin/cclite.cgi");
$sel->type_ok("registry", 'dalston');
$sel->type_ok("userLogin", $user);
$sel->type_ok("userPassword", "password");
$sel->submit("form") ;
I'd really like to find some way to use/re-use them without too much extra work. I'm prepared to do a little Java and recompile Selenium if it comes to that
|
What is cpan (the installer) doing prepending all these directories to the PERL5LIB path?
5 direct replies — Read more / Contribute
|
by Intrepid
on Nov 11, 2025 at 14:37
|
|
|
Hello folks. I am puzzled. I've been noticing a message from cpan that I
don't remember seeing before; an example is below. I was seeing 17 build dirs
and then I ran install for a couple more today, and it jumped to 19. Why and how is cpan
doing this? I know it's necessary when a module being built/tested/installed has
prerequisites but they seem to be hanging around long after they are necessary.
Anyone? If you're in the know, kindly enlighten me.
Prepending blib/arch and blib/lib of 19 build dirs to PERL5LIB, reaching size 2952; for 'install'
perl is CygwinPerl 5.40.3
CPAN/cpan is v2.38
EDIT
I've attempted to answer the question for myself, see below. Only with partial success.
Nov 25, 2025 at 18:41 UTC
|
Can I (with XS) invoke the regex engine without making copies of the buffer?
1 direct reply — Read more / Contribute
|
by NERDVANA
on Nov 09, 2025 at 13:36
|
|
|
This is related to my module Crypt::SecretBuffer, where the goal of the module is to prevent leaking secrets into the freed heap memory of the perl process where something could later come along and scan the address space looking for leftover secrets. The SecretBuffer tries to isolate data from being looked at by any normal Perl ops, so that it can be exclusively be viewed by XS/C functions and wiped clean when it goes out of scope.
So, in that context, is there any way to use "pregexec" to apply the perl regex engine to my buffer but prevent it from making copies into perl-owned buffers? pregexec seems a bit under-documented... It says "described in perlreguts" but while that has pages upon pages of the inner workings of the regex engine, it doesn't even tell the meaning of the return value of pregexec or explain exactly what the final "nosave" parameter means. Ideally it would be a flag that does exactly what I want and avoids copying any buffers into any global variables, but that doesn't seem to be the case from looking at the C code. (which I admit I haven't taken the time to fully understand yet)
I'd also be OK if it made copies, but someone could tell me a reliable way to go zero out the buffers of those SVs so that all the captures magically appear to be full of NUL characters afterward.
Basically I'd like it to behave like standard C library regexec that just records positions of the capture groups in an array. I'm also debating if I should just use libc's regexes and declare that limitation on the SecretBuffer API, that you have to restrict yourself to Posix extended regex notation.
Update:
So actually the "nosave" parameter does appear to do some of what I want. Setting that flag prevents any of the magic variables from getting updated.
perl -e 'use v5.40;
use Inline C => q{
int call_pregexec(SV *regex, SV *sv) {
REGEXP *rx= SvRX(regex);
STRLEN len;
char *buf= SvPV(sv, len);
return pregexec(rx, buf, buf+len, buf, 0, sv, 1);
}
};
say "098mnb" =~ /([0-9])([a-z])/;
say call_pregexec(qr/([a-z])([0-9])/, "abc123");
say $&;
say $1; say $2;
say $+[0]; say $+[1];'
but then, the question becomes how to find out *where* the regex matched, since it didn't update any of the output variables.
|
Problem Declaring a hash
3 direct replies — Read more / Contribute
|
by The_Evil_One
on Nov 05, 2025 at 14:39
|
|
|
I am learning Perl using a book downloaded from the internet.
Opal is a system for charging fares on public transport in NSW Australia. I have had four Opal cards and they identified by 16 digit numbers. I have four target directories into which the files related to these cards go and I have tried to set up a hash to map between card numbers and the destination directories but it does not work and the error messages make no sense to me.
This is the current form of the hash definition which is at line 26 in the script:-
my %OCN_PFX_To_TDir=(
3085220111379778 => '3085220111379788_Rexx',
3085220334620644 => '3085220334620644_Spare',
3085220346432582 => '3085220346432582_Rexx2',
3085220352420034 => '3085220352420034_Algol'
);
This is the input followed by the error messages I get:-
carl@md-tower-004:~$ perl ~/bin/copy_opal1.plx
Can't modify constant item in scalar assignment at /home/carl/bin/copy
+_opal1.plx line 26, near ");"
Execution of /home/carl/bin/copy_opal1.plx aborted due to compilation
+errors (#1)
(F) You aren't allowed to assign to the item indicated, or otherwi
+se try
to change it, such as with an auto-increment.
Uncaught exception from user code:
Can't modify constant item in scalar assignment at /home/carl/bin/
+copy_opal1.plx line 26, near ");"
Execution of /home/carl/bin/copy_opal1.plx aborted due to compilat
+ion errors.
I am writing a small program to copy Opal related files from my downloads directory to the appropriate destination directories.
Basically it tells me that I am trying to assign a scalar value to the % sign representing the modulus operator which cannot receive such a value but the % sign is to mark the variable as being a hash.
I have tried various changes on the definition, originally I had both keys and values in double quotes now I have the values in single quotes, originally I used commas to separate key value pairs. No matter what I change the error messages remain the same.
It may be that the book I downloaded is old and some syntax suggested in the book no longer works but no matter how many queries I have put into Google and how many AI overviews I have seen and hit list links that I have followed nothing has confirmed this.
|
Fetching 'http://search.cpan.org/uploads.rdf' (from cpan) LibXML error is triggered
3 direct replies — Read more / Contribute
|
by Intrepid
on Nov 05, 2025 at 13:09
|
|
|
Hello Monks and Nuns. I was working with cpan (the installer) on CygPerl today and
tried the command recent; it didn't work and this is what I saw:
cpan2> recent
CPAN: XML::LibXML loaded ok (v2.0210)
Fetching 'http://search.cpan.org/uploads.rdf'
CPAN: LWP loaded ok (v6.80)
DONE
Catching error: "XML::LibXML::Error=HASH(0xa01ebe148)" at /usr/local/share/perl5/site_perl/5.40/CPAN.pm line 397.
CPAN::shell() called at -e line 1
Could anyone else try this and see what happens? I'd appreciate it.
My system setup is:
This is perl 5, version 40, subversion 3 (v5.40.3) built for x86_64-cygwin-threads-multi
/usr/lib/perl5/vendor_perl/5.40/x86_64-cygwin-threads/XML/LibXML.pm
XML::LibXML version 2.0210
CPAN version 2.38
@INC:
/usr/local/lib/perl5/site_perl/5.40/x86_64-cygwin-threads
/usr/local/share/perl5/site_perl/5.40
/usr/lib/perl5/vendor_perl/5.40/x86_64-cygwin-threads
/usr/share/perl5/vendor_perl/5.40
/usr/lib/perl5/5.40/x86_64-cygwin-threads
/usr/share/perl5/5.40
Nov 05, 2025 at 18:08 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)
|
Making DBI with SQLite3 truly read-only
1 direct reply — Read more / Contribute
|
by mldvx4
on Nov 04, 2025 at 09:25
|
|
|
Greetings, wise monks,
I am trying to crank down restrictions on an FCGI script. I have DBI opening an SQLite3 database as read-only. This is how I am currently connecting to the database:
my $dbh = DBI->connect("dbi:SQLite:dbname=$database",
undef,
undef,
{
AutoCommit => 0,
RaiseError => 1,
on_connect_do => "PRAGMA foreign_keys = ON",
sqlite_open_flags => "DBD::SQLite::OPEN_READONLY",
})
or die("Could not open database '$database': $!\n");
However, AppArmor still gives the following error about needing write access, even though the error and restrictions causing it do not impair the script from appearing to work as expected:
2025-11-04T14:02:51.130580+00:00 ID28399 kernel: [5084204.347595] audi
+t: type=1400 audit(1762264971.124:63): apparmor="DENIED" operation="o
+pen" profile="/var/www/fcgi/foo.fcgi" name="/var/www/db/foo.sqlite3"
+pid=377569 comm="search.fcgi" requested_mask="wc" denied_mask="wc" fs
+uid=1002 ouid=1002
and in the AppArmor profile:
/var/www/db/foo.sqlite3 kr,
If I add w to that, the errors go away. However, I don't want to do that because the script's access is supposed to remain read-only. Yet it appears that DBI is somehow still requesting some kind of write access, even if it does not use it. What can I change in the DBI connection to ensure that it is purely read-only as far as the database goes?
|
Latest Strawberries: addresses reported by "p", Devel::Peek, etc.
3 direct replies — Read more / Contribute
|
by Anonymous Monk
on Oct 30, 2025 at 18:59
|
|
|
use strict;
use Devel::Peek;
$Devel::Peek::pv_limit = 3;
use warnings;
printf "$^V\n";
my $s = 's' x 32;
Dump $s;
my $addr = pack 'p', $s;
printf "Q: hex: %x, dec: %1\$d\n", unpack 'Q', $addr;
Dump $s;
__END__
v5.32.1
SV = PV(0x1fbf48) at 0x24f0e08
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x2565cb8 "sss"...\0
CUR = 32
LEN = 34
Q: hex: 2565cb8, dec: 39214264
SV = PV(0x1fbf48) at 0x24f0e08
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x2565cb8 "sss"...\0
CUR = 32
LEN = 34
v5.42.0
SV = PV(0x1330f20f4c0) at 0x1330f2836a0
REFCNT = 1
FLAGS = (POK,IsCOW,pPOK)
PV = 0x1330f3129f0 "sss"...\0
CUR = 32
LEN = 40
COW_REFCNT = 1
Q: hex: 1330f312400, dec: 1318809838592
SV = PV(0x1330f20f4c0) at 0x1330f2836a0
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x1330f312400 "sss"...\0
CUR = 32
LEN = 34
Previously (5.32), there was consistency as expected: PV address was "real" RAM address; and simple fact of "packing to pointer" didn't change scalar' guts. Now, I see some weird huge ("virtual"?) addresses -- even though everything works (including, not shown above, accessing (or acquiring, same values) these pointers from C). Where such numbers come from, is this the new normal? Is difference in "Dump" output related to that, or totally another issue?
|
Catching error in DateTime::Format
4 direct replies — Read more / Contribute
|
by Anonymous Monk
on Oct 27, 2025 at 13:29
|
|
|
I'm an inexperienced Perl programmer (my background is mainly in Python), charged with keeping a legacy app running, and I'm having trouble figuring out how to validate a date. (At least, that's what I think the problem is.)
We have a function that takes a date value and does some transformations on it. This is thoroughly tested and works fine for its use case, but we don't actually have a test for what happens if someone sends garbage into it—it assumes the input really is a valid date. Normally, this is fine; the input comes from internal sources and should always be OK. We now need to extend it for a case when we don't have control over the incoming data. So, I tried to wrap it in an eval to catch any errors. Currently, it looks like this:
# in MyApp::Util
sub convert_datetime {
my ( $self, $incoming_datetime ) = @_;
my $new_dt;
eval { $new_dt = DateTime::Format::ISO8601->parse_datetime( $incom
+ing_datetime ); };
return undef if $@;
# No error, now we can convert the date (not shown)
}
The test script now has this:
my $bogus_datetime = MyApp::Util->convert_datetime("FOO");
is ($bogus_datetime, undef, "convert_datetime doesn't blow up if sent
+bogus date");
When I run this, however, I get (I've changed the file paths):
ok 141 - convert_datetime doesn't blow up if sent bogus date
Invalid date format: at /path/to/MyApp/Util.pm line 818.
eval {...} called at /path/to/MyApp/Util.pm line 818
MyApp::Util::convert_datetime("MyApp::Util", "FOO") called at t/Ut
+il.t line 297
...propagated at t/Util.t line 298.
So the test "works" in that it returns an "ok" value, but it also prints the whole "Invalid date format" thing. How do I get it to _not_ do this, or otherwise test to see if the input is valid before I pass it to DateTime::Format::ISO8601->parse_datetime? The docs for this function say "The parse_datetime method will attempt to match these ambiguous strings" etc., but doesn't say what happens if it can't, or what you're supposed to do to test for valid input.
I tried to write a test script, but even though it looks identical (to me), this does _not_ print the "Invalid date format":
#!/usr/bin/env perl
use strict;
use warnings;
use DateTime::Format::ISO8601;
eval {my $foo = DateTime::Format::ISO8601->parse_datetime("FOO");};
print "ERROR\n" if $@;
Running this simply prints "ERROR" and that's it, no other output. What's going on in the real code, or what's the right way to handle this?
|
Oneliner replace in-place adds extra spaces at the end of the file
1 direct reply — Read more / Contribute
|
by bliako
on Oct 26, 2025 at 16:04
|
|
|
Wise Monks,
I am doing an in-place replacement in a text file which succeeds but one (?) extra newline is added at the end of the file:
The input file (a):
1
2
3
The command:
perl -i -lp0e 's/2/4/gs' a
Output
1
4
3
# there is an extra newline at the end, above
Looping the above command (the replacement is done only the first time), will yield as many newlines at the end:
for i in $(seq 1 10); do perl -i.x -lp0e 's/2/4/gs' a; done
@@@@
bw, bliako
|
|