Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: what's difference between bless and tie?

by BrowserUk (Pope)
on Dec 23, 2012 at 13:37 UTC ( #1010095=note: print w/replies, xml ) Need Help??

in reply to what's difference between bless and tie?

With tie you bless a named variable, and a predefined set of methods for that variable type are called automatically as the variable is used.

It allows the variables to be used exactly as if they were normal Perl variables of that type rather than requiring the methods be called using object syntax, which makes for very natural usage:

tie my @array, 'Some::Thing'; ... $array[ $n ] *= 5;

Rather than the clumsy:

my $myObj = Some::Thing->new(); ... $myObj->setItem( $n, $myObj->getItem( $n ) * 5 );

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010095]
[Corion]: Ah, how I missed it. After some years, I revisit slashdot on a click-bait link, and it provides the usual humor instantly: "I didn't know Drupal had rules for sex. It must be a plug-in"
[Corion]: erix: This is not for sybase, but for the input data files, resp. their contents.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2017-03-28 09:05 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (328 votes). Check out past polls.