dwater
asked on
How to I add CGI::small()?
Most html tags can be generated by CGI.pm methods. The <SMALL></SMALL> tag is missing, however, How can I add it, without creating a derived class.
Max.
Max.
ASKER
Yes, this is what I've done, but it doesn't fit in with the rest of the script which uses the CGI:: methods. I wanted to make it all clean. I'm sure there are other html tags which aren't in the module but this is the only one I need which isn't.
Max.
Max.
You could also just add it to the module.
(even submit it to L. Stein so you'll be portable when he adds it)
(even submit it to L. Stein so you'll be portable when he adds it)
ASKER
OK. I may well do this. I'm guessing this is the only way of doing it.
Thanks.
Max.
Thanks.
Max.
In Perl? Surely not the "only way of doing it":-)
use CGI;
sub CGI::small {
my $self = shift;
print "<SMALL>@_</SMALL>\n";
}
use CGI;
sub CGI::small {
my $self = shift;
print "<SMALL>@_</SMALL>\n";
}
ASKER
Great! Just what I'm after.
Although, I guess I don't want it to print the string, just return it. Correct?
Thanks.
Max.
Although, I guess I don't want it to print the string, just return it. Correct?
Thanks.
Max.
Yes, return instead of print would fit in better with the other methods.
I only wanted to illustrate that it was possible, and got careless.
I'll check the CGI.pm source to if it wants a prototype to fit in, then post it as an answer.
I only wanted to illustrate that it was possible, and got careless.
I'll check the CGI.pm source to if it wants a prototype to fit in, then post it as an answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Actually, I found a preferable solution, which is documented in the CGI.pm file and read using the command 'pod2text CGI.pm' - pod2text is one of a family supplied with CPAN which consists of pod2html, pod2latex, pod2man, pod2text.
The relevant part of the text is :-
Generating new HTML tags
Since no mere mortal can keep up with Netscape and Microsoft
as they battle it out for control of HTML, the code that
generates HTML tags is general and extensible. You can create
new HTML tags freely just by referring to them on the import
line:
use CGI shortcuts,winkin,blinkin,n od;
Now, in addition to the standard CGI shortcuts, you've
created HTML tags named "winkin", "blinkin" and "nod". You
can use them like this:
print blinkin {color=>'blue',rate=>'fast '},"Yahoo! ";
# <blinkin COLOR="blue" RATE="fast">Yahoo!</blinki n>
I supplied this information, just for the record.
Max.
The relevant part of the text is :-
Generating new HTML tags
Since no mere mortal can keep up with Netscape and Microsoft
as they battle it out for control of HTML, the code that
generates HTML tags is general and extensible. You can create
new HTML tags freely just by referring to them on the import
line:
use CGI shortcuts,winkin,blinkin,n
Now, in addition to the standard CGI shortcuts, you've
created HTML tags named "winkin", "blinkin" and "nod". You
can use them like this:
print blinkin {color=>'blue',rate=>'fast
# <blinkin COLOR="blue" RATE="fast">Yahoo!</blinki
I supplied this information, just for the record.
Max.
print "<SMALL>...</SMALL>";