Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Here document construct problem

by thedoe (Monk)
on Feb 17, 2005 at 21:09 UTC ( #432093=note: print w/ replies, xml ) Need Help??


in reply to Here document construct problem

What is the full source code? Just by using your scratchpad it is not possible to examine the line of code actually generating the warning.

When using warnings, perl generates this warning when it tries to evaluate a variable that has not been previously defined. Try looking at line 349 in your code and what variables are being used in it. If there are multiple variables used, use the process of elimination to figure out which is causing your problem, then make sure to assign it the value you need.

Update: Changed using strict to using warnings to correct mix-up.


Comment on Re: Here document construct problem
Re^2: Here document construct problem
by hok_si_la (Curate) on Feb 17, 2005 at 21:13 UTC
    thedoe,

    Using strict doesn't cause the warnings. Usings warnings does. If I comment out "use warnings;" I have no prob. The line that the warning is referring to is the middle END_OF_PRINT from the block of code that I posted. This block is encased by "&*&*&*&*&*&*&" in my scratchpad. I will comment the line itself.

    hok_si_la

      What happens if:

      END_OF_PRINT #&printOwner($data{owner1}); #&printOwner($data{owner2}); #&printOwner($data{owner3}); print <<END_OF_PRINT; </TH> </TR> END_OF_PRINT

      is changed to:

      #END_OF_PRINT #&printOwner($data{owner1}); #&printOwner($data{owner2}); #&printOwner($data{owner3}); #print <<END_OF_PRINT; </TH> </TR>
      and picked up by the END_OF_PRINT that occurs after <html> ?

      Update: Ok. Just checking for any weirdness in slight deviations from what you posted above. Ignore my comments below this reply, for they were added in error.

      /renz.
      "This is the Mark-man, safe and sure,
      Who still is right, and prayes to be so still."
      --George Herbert, Constancie.

        renz,

        Well if you did intend do comment out both the END_OF_PRINT, and the print <<END_OF_PRINT; on the second block, then the script will execute without warnings. Anytime those two here document contructs are commented out I have no issues. Otherwise, I will get the warnings.

        see ya in the CB,
        hok_si_la -->also listening to Cohen now.

      I apologize for my previous mixup of use strict and use warnings.

      As for where the warnings are coming from, they are being generated by variables within the here document starting at line 349. Any variables inside which have not been previously assigned will give you this warning and report line 349. This includes any keys in the data hash which have not been previously assigned, even if the data hash has been created.

      A good way to debug it would be using Data::Dumper as previously suggested for the data hash and manually inspecting any other variables used within that here document.

        thedoe,

        I think you are on to something. This would agree with what kutsu advised earlier. I will let you know what the dumper does.

        hok_si_la
        First, I want to thank everyone who helped me with this via this node or the CB.

        Bart/blokhead pointed out that the commented subroutine calls in my example weren't infact commented as I thought they were. This allowed me to see that the issue was with an ODBC session I was having within the subroutine (printOwners) itself. I instead decided to use DBI and everything seems to be working great.

        Take care!
        hok_si_la

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2014-08-02 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (54 votes), past polls