[Html-widget] HTML::Element bug (was Re: Bug in HTML::Widget::Constraint::In)

A. Pagaltzis pagaltzis at gmx.de
Wed Oct 18 16:47:55 CEST 2006


* Bernhard Graf <html-widget at augensalat.de> [2006-10-18 16:35]:
> > The `/o` switches do nothing here. Also, generally, don’t use
> > `/o`.
> 
> Aha. Why?

Well, `/o` means “if I use a variable, bake its first value that
you ever see when compiling this pattern into the compiled
pattern.” If there’s no variable in the pattern, `/o` is
meaningless. If there *is* a variable, then the behaviour of `/o`
is likely to eventually surprise you.

`/o` is a dirty hack from before `qr//` existed. Everything that

    m/foo $bar baz/o

can do,

    my $rx = qr/foo $bar baz/;

    # ...

    m/$rx/

can do better.

> > What I end up doing is this:
> >
> >      s[ ([&"']) ]{ '&#' . ord( $1 ) . ';' }xge;
> >      s[   <     ][&lt;]xg;
> >      s[   >     ][&gt;]xg;
> 
> And why not
>     s[ ([&"'<>]) ]{ '&#' . ord( $1 ) . ';' }xge;
> then?

Merely because `&lt;` is shorter than `&#60;`.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Html-widget mailing list