Welcome, Guest
Please Login or Register.
Lost Password?
Remote API, and apache server. (1 viewing)
Post Reply

TOPIC: Remote API, and apache server.

#4950
JamieCameron (Admin)
Posts: 342
graphgraph
Re: Remote API, and apache server. 2007/05/04 13:37  
Excellent! I'd love to take a look at this when it is done..
  The administrator has disabled public write access.
#4954
TonyShadwick (User)
Posts: 140
graphgraph
Re: Remote API, and apache server. 2007/05/04 15:26  
  The administrator has disabled public write access.
#4958
TonyShadwick (User)
Posts: 140
graphgraph
Re: Remote API, and apache server. 2007/05/06 13:23  
Hey Jamie? I started to make a change in web-lib-funcs.pl what would clean up much of what I'm doing, not break anything backwards, and make for much more intuitive code.

For example, in my module's index.cgi, I have this:

&header($text{'module_title'}, "", "", "", "", "", "", $custom_headers);

What I was thinking was to modify sub header{}. Right now you kind of interpolate checking for values passed with generating the headers. What I would do (and have backed off of, since that's really your baby and not mine), is to instead use static variables and render the headers in one shot. At the top of the routine, check to see whether $_[[0]] is a hash or not. If not, use assignments as you have in the past, ie:

my $title = $_[[0]];
my $image = $_[[1]];
my $help = $_[[2]] if($_[[2]]);
my $config = $_[[3]] if($_[[3]]);

etc.

if $_[[0]] is a hash however, then we can make for much more readable code. I could do the above like this:

&header({
title => $text{'module_title'},
header => $custom_headers,
});

Then in your routine, you assign as such:

my(%config) = $_[[0]]; # for the sake of readability.
my $title = $config{title};
my $image = $config{image};
my $help = $config{help} if($config{help});

and so on.

Dunno. The fact that so many nulls have to be passed in order to pass certain options just doesn't seem clean to me. :) This way at a glance you know precisely what is being passed and why, and doesn't break old code either.
  The administrator has disabled public write access.
#4959
JamieCameron (Admin)
Posts: 342
graphgraph
Re: Remote API, and apache server. 2007/05/06 13:29  
I agree that the header function should use format parameters instead of $_[[X]] .. I just haven't gotten around to fixing it yet :)

If you prefer a hash-based function call, I'd suggest writing your own wrapper around header() instead, so as not to break existing modules and themes.
  The administrator has disabled public write access.
#4960
TonyShadwick (User)
Posts: 140
graphgraph
Re: Remote API, and apache server. 2007/05/06 15:29  
All I was suggesting was maybe doing this:

if(re($_[[0]]) eq 'HASH'){
# Do it that way.
}
else(
# Do it the same way you always have.
}

:D

Oh well, picking nits.
  The administrator has disabled public write access.
#5698
TonyShadwick (User)
Posts: 140
graphgraph
Re: Remote API, and apache server. 2007/06/26 20:03  
Alright. I feel really dumb, but this project isn't dead. I got dragged off into the MySQL balancer mess, and I almost have that fixed up, then I'm going to have to make a trip to Montreal. I'm working on this in what spare time I have. Just FYI.
  The administrator has disabled public write access.
Post Reply
get the latest posts directly to your desktop

Talk and Get Help

Support
Forums
Bugs and Issues

Get Virtualmin

OS Support
Buy Online
Download
Copyright 2005-2007 Virtualmin, Inc. All rights reserved.