New here?I want to ask a question of the Perl Monks. Where do I start?

Notices:

hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.

If you're new here, please read PerlMonks FAQ
and Create a new user!

Quests
poll ideas quest 2025
Starts at: Jan 01, 2025 at 00:00
Ends at: Dec 31, 2025 at 23:59
Current Status: Active
3 replies by pollsters
    First, read How do I create a Poll?. Then suggest your poll here. Complete ideas are more likely to be used.

    Note that links may be used in choices but not in the title.

Perl News
DuckDuckGo Donates $25,000 to TPRF
on Oct 01, 2025 at 14:45
1 reply by talexb

    DuckDuckGo has made a second $25,000 USD donation to The Perl and Raku Foundation. This is tremendous news, and will help to continue to fund development of Perl. From TPRF President Stuart J Mackintosh:

      DuckDuckGo has demonstrated how Perl and its ecosystem can deliver power and scale to drive the DuckDuckGo core systems, plug-in framework and Instant Answers. The Foundation is grateful that DuckDuckGo recognises the importance of Perl, and for their generous funding support for a second year through their charitable donations programme.
    See the perl.com article for the full story.

    Alex / talexb / Toronto

    As of June 2025, Groklaw is back! This site was a really valuable resource in the now ancient fight between SCO and Linux. As it turned out, SCO was all hat and no cattle.Thanks to PJ for all her work, we owe her so much. RIP -- 2003 to 2013.

SUSE donates to the Perl 5 Core Maintenance Fund
on Aug 07, 2025 at 14:43
0 replies by talexb

    SUSE has recently made a big donation to the Core Maintenance Fund for Perl 5:

      The Perl and Raku Foundation (TPRF) is thrilled to announce a substantial $11,500 donation from SUSE, one of the world’s leading enterprise Linux and cloud-native and AI solutions providers. This generous contribution bolsters the Perl 5 Core Maintenance Fund and demonstrates SUSE’s commitment to the open-source ecosystem.
    Full announcement here.

    Alex / talexb / Toronto

    As of June 2025, Groklaw is back! This site was a really valuable resource in the now ancient fight between SCO and Linux. As it turned out, SCO was all hat and no cattle.Thanks to PJ for all her work, we owe her so much. RIP -- 2003 to 2013.

Supplications
Win32::OLE reading word file with tables
No replies — Read more | Post response
by chafelix
on Oct 04, 2025 at 15:12
    I am reading a word file which has tables, using Win32::OLE. I am only interested in the tables. The code I use is shown below
    use Win32::OLE qw(in); use Win32::OLE::Const 'Microsoft Word'; sub print_tables { my $word =Win32::OLE->new('Word.Application','Quit'); # shift; my $word_file = file(abs_path(shift)); my $doc = $word->{Documents}->Open("$word_file"); my $tables = $word->ActiveDocument->{Tables}; for my $table (in $tables) { my $numrows=$table->Rows->Count; my $rownum=1; while($rownum<=$table->Rows->Count){ ... $main::numcols=$table->Columns->Count; my $cell5=$table->Cell($rownum,$main::numcols);#this is the last colum +n ..... } } }
    The problem arises when the tables have merged columns, so that the number of columns is < $main::numcols In that case I need to check and essantially say either "if $actual_number_of_columns_in_present_row <$main::numcols){...}" or catch the exception "(If ! $cell5 ){...}" So the question is how do I say either of these?
Name a method that exposes a secret
1 direct reply — Read more / Contribute
by NERDVANA
on Sep 30, 2025 at 12:50
    I have a module Crypt::SecretBuffer which prevents a scalar from being seen "unless you really want to" (ideally passing it directly to an XS function to prevent copies from being made). Right now the API for viewing the secret is using 'local' on an attribute 'stringify_mask' and an overloaded stringification on the object:
    $password= secret(...); ... local $password->{stringify_mask}= undef if ref($password) eq 'Crypt:: +SecretBuffer'; $db= DBI->connect($dsn, $user, $password, \%attr);

    On Github, robrwo [suggested a new more functional-programming-like API, namely that a method of SecretBuffer would pass the secret to a callback. My thought on the matter was that the *real* missing feature is a duck-typing API that doesn't need to be specific to SecretBuffer, which should provide an easy and convenient recipe for code that doesn't have a hard dependency on SecretBuffer to gain access to secrets.

    I'd like to conduct an informal poll of which design people like the best:

    1. "apply", a method which takes a callback of one argument:
      if ($password isa 'Crypt::SecretBuffer') { $db= $password->apply(sub { DBI->connect($dsn, $user, $_[0], \%attr) + }); else { $db= DBI->connect($dsn, $user, $password, \%attr); }
    2. A more distinct method name that could be used for duck-typing and apply to other types of object:
      if (blessed $password && $password->can("unmask_secret_to")) { $db= $password->unmask_secret_to(\&DBI::connect, 'DBI', $dsn, $user, + $password, \%attr); } else { $db= DBI->connect($dsn, $user, $password, \%attr); }
      1. reveal_secret_to
      2. unmask_secret_to
      3. call_with_secret
      4. call_unmasked
    3. Use a scalar-ref overload:
      $db= DBI->connect($dsn, $user, ref $password? $$password : $password, +\%attr);

    I just came up with that scalar-ref idea, and seems pretty safe because no code would normally scalar-dereference a ref unless the ref type was 'SCALAR'. Still, that's drastically lowering the bar for leaking the secret, and isn't advertising that it has this capability...

    While pondering your preference, also consider the question "If someone contributed a patch to a module I maintain that added support for receiving secrets via SecretBuffer, how much boilerplate would I be willing to accept?"