#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    4
    Rep Power
    0

    Is this some oop stuff


    Hello!

    I am trying to call a function here:


    $Dashboard::dashboard->DoSomething($myvariable_1, $myvariable_2, $myvariable_3, $myvariable_4,$myvariable_5);



    sub DoSomething {
    my ( $self, $myvariable_1, $myvariable_2, $myvariable_3, $myvariable_4,$myvariable_5 ) = @_;

    $self->_debug("1: $myvariable_1\n");
    $self->_debug("2: $myvariable_2\n");
    $self->_debug("3: $myvariable_3\n");
    $self->_debug("4: $myvariable_4\n");
    $self->_debug("5: $myvariable_5\n");


    Is this $self some reserved variable in perl ? This is not working. saying uninitialised value for the variables @myvariable_1-5
  2. #2
  3. !~ /m$/
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    May 2004
    Location
    Reno, NV
    Posts
    4,264
    Rep Power
    1810
    $self isn't a reserved keyword, but when you are inside an object, methods receive the object as their first argument. You receive it even though it was not passed in, and it is traditionally captured into a variable called $self, though you could call it anything you want.

    I can't tell from the context of your code snippet if you are inside or outside of an object. Also, you appear to be calling methods on the class rather than on an instantiated object.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    4
    Rep Power
    0
    Thanks again Keath, have a nice day!



    Originally Posted by keath
    $self isn't a reserved keyword, but when you are inside an object, methods receive the object as their first argument. You receive it even though it was not passed in, and it is traditionally captured into a variable called $self, though you could call it anything you want.

    I can't tell from the context of your code snippet if you are inside or outside of an object. Also, you appear to be calling methods on the class rather than on an instantiated object.

IMN logo majestic logo threadwatch logo seochat tools logo