Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [Alex] Decide if plugin executed on admin interface or website?

Quote Reply
Re: [Alex] Decide if plugin executed on admin interface or website? In reply to
Alex, I see your point. I also prefer to separate admin functions from user options is possible.
But in this case, if I want to have separate admin and user function, I have to duplicate the code, almost the same code (1-5% difference), except the admin has a few prints to display informational text on admin interface.

So, I have to maintain 2, almost the same (1-5% difference) functions, and I think this is infringement of the reusable code rule. I think, I should not duplicate the same code, because it will make my life difficulter.

Would cause any problem, if you would add a global variable ($admin = 1;), right at the start of admin.cgi?

I collected some advantages, disadvantages of that change:
- Disadvantage:
. . - takes a bit more namespace,
. . - and may need to wrap the admin part in a package (but not necessarily, I think)
- Advantage:
. . - at any point in the code flow, we can know if we are on the admin interface or we are displaying the site pages.
. . - makes possible more flexible coding, by avoiding so stick to the admin.cgi name,
. . - makes possible to avoid duplicating some codes

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Subject Author Views Date
Thread; hot thread Decide if plugin executed on admin interface or website? webmaster33 10770 Sep 5, 2002, 3:47 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Andy 10340 Sep 5, 2002, 3:52 AM
Thread; hot thread Re: [Andy] Decide if plugin executed on admin interface or website?
webmaster33 10322 Sep 5, 2002, 4:01 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Paul 10350 Sep 5, 2002, 4:05 AM
Thread; hot thread Re: [Paul] Decide if plugin executed on admin interface or website?
webmaster33 10378 Sep 5, 2002, 4:09 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Paul 10344 Sep 5, 2002, 4:19 AM
Thread; hot thread Re: [Paul] Decide if plugin executed on admin interface or website?
webmaster33 10306 Sep 5, 2002, 4:30 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Paul 10281 Sep 5, 2002, 5:07 AM
Post; hot thread Re: [Paul] Decide if plugin executed on admin interface or website?
webmaster33 10261 Sep 5, 2002, 5:15 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
yogi 10329 Sep 5, 2002, 4:23 AM
Thread; hot thread Re: [yogi] Decide if plugin executed on admin interface or website?
webmaster33 10369 Sep 5, 2002, 4:33 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
yogi 10333 Sep 5, 2002, 4:41 AM
Thread; hot thread Re: [yogi] Decide if plugin executed on admin interface or website?
webmaster33 10329 Sep 5, 2002, 5:17 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Paul 10272 Sep 5, 2002, 5:23 AM
Post; hot thread Re: [Paul] Decide if plugin executed on admin interface or website?
webmaster33 10327 Sep 5, 2002, 6:03 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Alex 10321 Sep 5, 2002, 1:10 PM
Thread; hot thread Re: [Alex] Decide if plugin executed on admin interface or website?
webmaster33 10235 Sep 6, 2002, 12:56 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Alex 10352 Sep 6, 2002, 10:50 AM
Thread; hot thread Re: [Alex] Decide if plugin executed on admin interface or website?
webmaster33 10346 Sep 6, 2002, 11:05 AM
Thread; hot thread Re: [webmaster33] Decide if plugin executed on admin interface or website?
Alex 10318 Sep 6, 2002, 11:09 AM
Post; hot thread Re: [Alex] Decide if plugin executed on admin interface or website?
webmaster33 10214 Sep 6, 2002, 11:12 AM