Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Is "ref($class) || $class" a bad thing?

by stvn (Monsignor)
on Jul 12, 2004 at 16:02 UTC ( [id://373638]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $class = ref($class) || $class;
    
  2. or download this
    my $foo = Foo->new();
    my $foo2 = $foo->new();
    my $foo3 = Foo::new();
    
  3. or download this
    +------+-------+-------+
    | true | false | final |
    ...
    +------+-------+-------+
    |   1  |   x   |   1   |  $foo->new()
    +------+-------+-------+
    
  4. or download this
    package Foo;
    sub new {
    ...
    my $foo = Foo::new();
    print $foo;
    $foo->test();
    
  5. or download this
    main=HASH(0x180035c)
    
  6. or download this
    Can't locate object method "test" via package "main" at test.pl line 1
    +4.
    
  7. or download this
    eval { Foo::new() };
    ok(!$@, "Foo::new dies when called as a function");
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://373638]
Approved by Limbic~Region
Front-paged by Ovid
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-26 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found