Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Dereference inside a regex

by AnomalousMonk (Monsignor)
on Jun 07, 2013 at 14:55 UTC ( #1037685=note: print w/ replies, xml ) Need Help??


in reply to Dereference inside a regex

The regex has uninitialized values then.. ?

What uninitialized values? Can you give a short, standalone program that produces these uninitialized values?


Comment on Re: Dereference inside a regex
Re^2: Dereference inside a regex
by tobias_hofer (Friar) on Jun 07, 2013 at 15:56 UTC
    ya,.. its also strange to me
    here the code in its current state:
    sub AnalyseMapFile { my $self = shift; my $MapFile = $self->{MAPFILEINFO}{MAPFILECONTENT}; my $PlaceToPutInformation = $self->{MEMORYMAP}; $self->{MAPFILEINFO}{ProfileInformation} = $ProfileInformation; my $memory_section = ''; my $state = 0; my $memory_size = 0; my $state_smybol = { 1 => 'Image component sizes', 2 => ' Code \(inc\. data\) RO Data RW Data ZI Dat +a Debug Object Name', }; #Each config profile defines its own way how to parse the map-file +. #Process map-file for ( my $iterator = $ProfileInformation->{'StartLine'} ; $iterator < @$MapFile ; $iterator++ ) { chomp($MapFile->[$iterator]); next if (! $MapFile->[$iterator]); if (( $state == 0 ) ###THIS IS LINE 104 && ( $MapFile->[$iterator] =~m/$MTA::Profile_ARM::state_symbo +l->{1}/)) { $state = 1; next; } elsif (( $state == 1 ) && ( $MapFile->[$iterator] =~m/$MTA::Pr +ofile_ARM::state_symbol->{2}/)) { $state = 2; next; } elsif ( $state == 2 ) { #Get module information my($Code, $CodeData, $ROData, $RWData, $ZIData, $Debug, $O +bjName) = split(/\s/,$MapFile->[$iterator]);
    and I get this message from perl-diagnostics, moreover i am using eclipse and epic-plugin and strawberryperl 5.10.0.
    The warning looks like this:
    Use of uninitialized value in regexp compilation at D:/_Debug/Project/profile_ARM.pm line 104 (#1) (W uninitialized) An undefined value was used as if it were alread +y defined. It was interpreted as a "" or a 0, but maybe it was a mi +stake. To suppress this warning assign a defined value to your variables. To help you figure out what was undefined, perl will try to tell y +ou the name of the variable (if any) that was undefined. In some cases it + cannot do this, so it also tells you what operation you used the undefine +d value in. Note, however, that perl optimizes your program and the opera +tion displayed in the warning may not necessarily appear literally in y +our program. For example, "that $foo" is usually optimized into "that + " . $foo, and the warning will refer to the concatenation (.) operat +or, even though there is no . in your program.


    Ok, i am just guessing that this is because of the dereferencing, but the scalar
    $state is initialized with '0'. So I am running out of plans...

      Before I saw your reply below indicating your problem is fixed, I was going to suggest you take a look at the package global variable  $MTA::Profile_ARM::state_symbol to see how it was defined; you have apparently done this and found the problem. And, yes, using strictures and warnings is always a good idea, especially if you are a novice Perler.

      The misleading line number reported for the "uninitialized value in regexp compilation" warning is due to a quirk (dare one say bug?) present until recently (I'm too lazy to look up the version in which this was fixed) in the compiler such that the line number of the first line of a statement block (e.g., an if-statement) is the line number reported for any warning (or error?) encountered within the statement block. This can be disorienting, but the warning message did clearly refer to a "regex compilation" problem, and there are only two regexes associated with the if-statement in question, and these regexes consist entirely in the interpolation of some value from a single global hash, so the obvious place to look should have been the  $MTA::Profile_ARM::state_symbol global.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2014-07-12 23:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (242 votes), past polls