×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SSI call returning 1
4

SSI call returning 1

SSI call returning 1

(OP)
I have this SSI call in an index page.

CODE

<!--#include virtual="cgi-bin/picture.pl?call=body&page=home&" --> 

It returns the index page's <body> via this print statement.

CODE

print "<body class='page_body' style='background-image: url(\"images/themes/halloween/homeback.jpg\");'>"; 

The body statement works fine but there is a stray '1' at the end of the <body> code and this appears at the top of the resulting page.
Is the problem because the script is not returning visible content or is there some other cause?

Keith
www.studiosoft.co.uk

RE: SSI call returning 1

(OP)
The problem was a sill schoolboy error.

Menu item .........

CODE

#--------------------------------------------------------
if($INP eq 'body'){
#--------------------------------------------------------
	print &MakeBody();
	exit;
} 

calling the sub ..........

CODE

# --------------------------------------------------------
sub MakeBody{
# --------------------------------------------------------
	print "<body class='page_body' style='background-image: url(\"images/themes/halloween/homeback.jpg\");'>";
} 

Doh!

Keith
www.studiosoft.co.uk

RE: SSI call returning 1

Ah double print!

One in the routine, then the 'true' return value from sub.

Just a side note: It is apparently now bad practice to use ampersands for sub calls!

MakeBody();

instead of

&MakeBody();


"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: SSI call returning 1

(OP)
Yeah I know but no amount of staring at it yesterday solved it.
Why is it bad practice with the ampersand?

Keith
www.studiosoft.co.uk

RE: SSI call returning 1

(OP)
I use the ampersand on sub calls for clarity and wonder what the issue is with them.

I did a quick search but couldn't find a specific reason not to use them.
Perhaps if I stopped using them, all my code would be perfect and I would never have to spend time looking for errors, ever again.

Keith
www.studiosoft.co.uk

RE: SSI call returning 1

>> Perhaps if I stopped using them, all my code would be perfect and I would never have to spend time looking for errors, ever again.

Keith wake up - you appear to have nodded off and started dreaming! sleeping2

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music

RE: SSI call returning 1

2
Hi

The best hint I found related to this is related to prototypes (*) :

Quote (man perlsub)

The function declaration must be visible at compile time. The prototype affects only interpretation of new-style calls to the function, where new-style is defined as not using the & character. In other words, if you call it like a built-in function, then it behaves like a built-in function. If you call it like an old-fashioned subroutine, then it behaves like an old-fashioned subroutine.
( man perlsub | Prototypes | 3rd paragraph )

Personally I keep using the ampersand.

(*) The articles I read used various adjectives on them, usually somewhere between pointless and evil.

Feherke.
feherke.ga

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close