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

"my" variable $self

by Anonymous Monk
on Nov 09, 2006 at 13:09 UTC ( #583093=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

When compiling my script with perlapp I see the following error:
"my" variable $self masks earlier declaration in same scope at + line 204, <DATA> line 21937.
$self is never used in my script but I do see it in several of the modules I'm using. Is there something I can do to prevent this from occuring? The error only shows up when attempting to run the exe and not the script itself. I assume it has something to do with the scope of $self in the exe.

Replies are listed 'Best First'.
Re: "my" variable $self
by Hofmator (Curate) on Nov 09, 2006 at 14:00 UTC
    Just a shot into the blue ... is Spiffy involved anywhere in your code? Because this adds my $self=shift; statements into the code ...

    Update: Anonymous Monk answered in the meantime here, pointing back to his/her previous post. So Spiffy is involved ... it seems it doesn't play nice with perlapp ...

    -- Hofmator

    Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Spiffy is involved...whats the suggested method to remove the use of Spiffy from the module?

        I very much doubt that you'll be able to remove Spiffy from the module. Spiffy tends to become very closely entwined with the code that uses it.

        I suggest that you report the problem to the author. Hopefully he'll then pass it on to the author of Spiffy.


        "The first rule of Perl club is you do not talk about Perl club."
        -- Chip Salzenberg

Re: "my" variable $self
by davorg (Chancellor) on Nov 09, 2006 at 13:28 UTC

    There seems to be some scoping confusion going on here. Please post a short (<30 lines) program that demonstrates this problem.


    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      I appreciate any insight you may have. This is related to an earlier post regarding my sub error. Here is a simple script that re-creates the error using PerlApp:
      use strict; use warnings; use WWW::Myspace; use Contextual::Return::Failure; my ($account, $password) = retrieve_acct_info(); my $myspace = WWW::Myspace->new($account,$password); sub retrieve_acct_info { my $account = 'email'; my $password = 'password'; return ($account, $password); }
      The error is:
      "my" variable $self masks earlier declaration in same scope at + line 11, <DATA> line 21937.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://583093]
Approved by marto
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2023-10-01 08:33 GMT
Find Nodes?
    Voting Booth?

    No recent polls found