Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Code Highlighting in the code tag

by bikeNomad (Priest)
on Aug 10, 2001 at 18:48 UTC ( #103885=note: print w/replies, xml ) Need Help??


in reply to Code Highlighting in the code tag

This is from Vim. I just went:

:ru! syntax/2html.vim

Note that it doesn't handle [] constructs; it could easily be made to do so by adding to the 2html.vim file. I've also used perltidy to make HTML; it too would have to be post-filtered.

package XX;

sub _create_accessors
{
    my %orderObjectFields = @_;

    foreach my $field ( keys %orderObjectFields )
    {
        my $default = $orderObjectFields{$field};
        no strict 'refs';
        *{ __PACKAGE__ . "::$field" } = sub
        {
            my $value =
              ( scalar @_ > 1 ? $_<span style="background-color: #f2f2f2"><font color="#ff00ff">0</font></span>->{$field} = $_<span style="background-color: #f2f2f2"><font color="#ff00ff">1</font></span> : $_<span style="background-color: #f2f2f2"><font color="#ff00ff">0</font></span>->{$field} );
            $value = $default unless defined $value;
            $value;
        };
    }
}

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://103885]
help
Chatterbox?
[GotToBTru]: okay, I see what it does
[GotToBTru]: you;ve answered it .. the expression is meant to be evaluated as written, it is not a symbol for a special operation
[LanX]: '&;@' is a parsing error
[GotToBTru]: by itself, yes, but used in sub pre(&;@) not so
[LanX]: &; is interpreted as a function call, but the @ has no meaning
[LanX]: OH
[LanX]: you are talking about signatures?
[GotToBTru]: yes, it turns out I am
[LanX]: http://perldoc. perl.org/perlsub. html#Prototypes
[GotToBTru]: that page, strangely enough, never mentions that construct

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-01-18 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (164 votes). Check out past polls.