Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: new() function: incorrect?

by ForgotPasswordAgain (Deacon)
on Nov 12, 2008 at 09:54 UTC ( #723094=note: print w/ replies, xml ) Need Help??


in reply to new() function: incorrect?

It's hard to know if there are contextual things missing, since I wasn't there. Did you ask them why they thought it was wrong? Maybe they were testing whether you really knew what you were talking about. Maybe they say it's wrong just to see how you react.

Your new doesn't accept any arguments, maybe they didn't like that. You don't have a true value (1;) at the end of the package, maybe it was that. Maybe they didn't want you to actually write an object, but instead use a module like Moose.


Comment on Re: new() function: incorrect?
Download Code
Re^2: new() function: incorrect?
by lukeyboy1 (Beadle) on Nov 12, 2008 at 14:26 UTC
    I should have added that this was just a snippet of code...not complete, like! :)
Re^2: new() function: incorrect?
by jeffa (Chancellor) on Nov 12, 2008 at 19:05 UTC

    "Did you ask them why they thought it was wrong?"

    Were I the interviewer I would most certainly raise a flag on this line:

    my $class = ref($proto) || $proto;
    This line is a classic "cargo cult" line that I myself used without knowing what it did or why it was there. The bottom line is that 9 times out of 10 this line will do what you want, but it is still cargo cult. I would have certainly preferred to see use Moose! :)


    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-04-17 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (453 votes), past polls