Finally I saw the video (against better knowledge that it will keep me awake... ;-)

Apart from the urgent need to kick this annoying kid into a pit full of pythons (snakes not hackers¹) I was very surprised about the DBI examples...

Because quote($$;$) has obviously a signature which should force scalar context.

I coded a little example...

use strict; use warnings; package DBI; use Data::Dumper; sub quote ($$;$) { print Dumper \@_; } package CGI; sub param { return qw/a b c/; } package main; DBI->quote(CGI->param()); #DBI::quote(CGI->param());

out

$VAR1 = [ 'DBI', 'a', 'b', 'c' ];

It turns out that signatures are not effective when used as a method, b/c they can't be evaluated at compile time.

OTOH uncommenting the second direct call causes a compilation error.

The documentation of DBI is purely OOP demonstrating method calls...

... so what keeps me puzzled is why the $-signatures where ever inserted.

(It looks like it was originally not meant to be OOP and handling the problem ... but when switching to OOP this use case was forgotten.)

Does anyone have insights if this was addressed now by the maintainers?

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

PS: YES I'm aware that using placeholders is the state of the art now... though I could imagine someone still using such code in production.

¹) I'm not a sadist...


In reply to Re^4: Stop Using Perl (DBI) by LanX
in thread Stop Using Perl by shmem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.