Yohoho and a bottle of rum,
what kind of pasty land-lubbers need a fence not to go overboard?
Back to the real model-world:
What sort of pirate ship are we talking about?
On a "classic" pirate ship, i.e. a wooden sailing ship, I'd go for solid bulwarks, perhaps crowned by a small wooden railing. So ornate toothpicks with a 2 x 4mm scale timber on top would look the part.
If you want a steel railing, I recommend brass wire. The top rail sits on top of the stanchions, the lower one (or two) behind them. Of course this does not look exactly like the real thing, but from the usual viewing distance you don't see much difference. Another advantage is that you are free to chose the height you want. So this is how I do it:
1. Drill holes into the deck, protect deck with masking tape
2. cut stanchions to length, file the top end flat and set them into the holes
3. Lay the top rail onto stanchions (stick some clothes pegs on so it doesn't fall off sideways)
4. Solder one stanchion after the other
5. Lay the lower rail on wooden blocks of the correct height and fix it again with clothes pegs or whatever Comes in Handy
6. Solder lower rail to stanchions
7. Take to whole thing off, clean off flux residue, paint and glue to the deck
8. Bob's your uncle!
It takes good practice at soldering, you need to be quick, otherwise previous solder joints will spring open again, and subsequent coarse language may occur. I found it helpful to have a bowl of water and some q-tips at the ready.
The result is quite strong and will punish anyone who steps on your model (apparently this happens sometimes, according to the less-than-brilliant-model-making thread).
This is how it Looks on my freighter:

The lower rails in this case are made from guitar-string, which I do NOT recommend, you can't solder it.
And don't be surprised if you feel a bit befuddled after making it all in one go.
Peter