Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: providing a callback routine to sort

by Laurent_R (Canon)
on Jan 21, 2014 at 23:26 UTC ( [id://1071545]=note: print w/replies, xml ) Need Help??


in reply to providing a callback routine to sort

I really think you did not provide enough information to help you, but this:
$a->asStringFmt() cmp $b->asStringFmt;
looks probably wrong to me. Left side looks like a function, right side not.

Replies are listed 'Best First'.
Re^2: providing a callback routine to sort
by Anonymous Monk on Jan 22, 2014 at 04:17 UTC

    I really think you did not provide enough information to help you

    See Re: providing a callback routine to sort ( $::a $::b )

    The only reason $a and $b are undefined is because they're not $main::a and $main::b -- sort deals with $main::a and $main::b or $::a for sort -- this is the OPs problem and the solution, use the right variable (package affects unqualified variables)

    sort talks about this exactly

    An alternate solution (using prototypes) is also talked about in sort and in chromatics free book Modern Perl a loose description of how experienced and effective Perl 5 programmers work....You can learn this too.

    looks probably wrong to me. Left side looks like a function, right side not.

    Well, they're both perfectly identical method calls

      Thank you! I provided $pkgdir::pkg::a and $pkgdir::pkg::b and it worked! My apologies for missing that in the documentation. Unfortunately, it's all the way at end (in very tiny letters ;)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1071545]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-16 06:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found