Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Variable showing up as blank in Format output. Stumped... (http://www.velocityreviews.com/forums/t892162-variable-showing-up-as-blank-in-format-output-stumped.html)

Zeheeba 05-03-2005 03:50 AM

Variable showing up as blank in Format output. Stumped...
 
Hello Everyone.
I have a format that is outputting a variable as empty spaces. I have
no clue why its doing this.

The variable causing problems is listed below:

$revzone="$last.$net.1.10.in-addr.arpa";

If I put the print command after this declaration I get

43.15.1.10.in-addr.arpa

The problem occurs when I place it in the following format:
__________________________________________________ _________
format DEFAULTREV =
server 10.1.99.20
zone @<.1.10.IN-ADDR.ARPA
$ip
update add @<<<<<<<<<<<<< 10800 PTR @>>>>>>>>>>>>.domain.com."
$revzone, $host
show
send
..
__________________________________________________ __________

The first variable space after "update add" has 25 <'s in it, I
truncated it due to the line wrapping.

After outputting this format to a file, it looks like this:
__________________________________________________ ___________
server 10.1.99.20
zone 15.1.10.IN-ADDR.ARPA
update add 10800 PTR name.domain.com.
show
send
..
__________________________________________________ ___________

Does anyone know why a blank space would be left instead of the
variable? I have never had this problem with formats before.
Any help is appreciated.

Regards,
Daniel


Zeheeba 05-03-2005 03:53 AM

Re: Variable showing up as blank in Format output. Stumped...
 
I apologize for not giving details. Here they are before they are
asked for...

Perl version: 5.6.0-17
OS - Yellow Dog Linux 3.0


Anno Siegel 05-03-2005 08:45 AM

Re: Variable showing up as blank in Format output. Stumped...
 
Zeheeba <daniel@costello.org> wrote in comp.lang.perl.misc:
> Hello Everyone.
> I have a format that is outputting a variable as empty spaces. I have
> no clue why its doing this.
>
> The variable causing problems is listed below:
>
> $revzone="$last.$net.1.10.in-addr.arpa";
>
> If I put the print command after this declaration I get
>
> 43.15.1.10.in-addr.arpa
>
> The problem occurs when I place it in the following format:
> __________________________________________________ _________
> format DEFAULTREV =
> server 10.1.99.20
> zone @<.1.10.IN-ADDR.ARPA
> $ip
> update add @<<<<<<<<<<<<< 10800 PTR @>>>>>>>>>>>>.domain.com."
> $revzone, $host
> show
> send
> .
> __________________________________________________ __________
>
> The first variable space after "update add" has 25 <'s in it, I
> truncated it due to the line wrapping.
>
> After outputting this format to a file, it looks like this:
> __________________________________________________ ___________
> server 10.1.99.20
> zone 15.1.10.IN-ADDR.ARPA
> update add 10800 PTR name.domain.com.
> show
> send
> .
> __________________________________________________ ___________
>
> Does anyone know why a blank space would be left instead of the
> variable? I have never had this problem with formats before.
> Any help is appreciated.


Presumably one or the other of the variables used is not defined
when write is called. You don't show that, so we can only guess.

Run your code under strict and warnings and follow the hints.

Anno

zeheeba@gmail.com 05-03-2005 03:37 PM

Re: Variable showing up as blank in Format output. Stumped...
 
Problem solved, thanks for your help Anno. I shouldn't work on scripts
so late at night. The variable $revzone was being declared after the
format was being written, no wonder it wouldn't work.

Thanks again.

Daniel



All times are GMT. The time now is 08:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.