I don't know the full context, but you must care with two kinds of concerns:
1) If you want to produce a persistent, reusable style, you must explicitly open the styles-focused workspace of the document, through the 'member' option. The default workspace is the content and not the styles. (If you want to process both text content and styles, look at the documentation, for ex. OpenOffice::OODoc::Intro).
2) Whith ODT documents, you can't set the container properties (i.e. the properties of the paragraph "box") and the content properties (i.e. the properties of the text in the paragraph, for ex. font-related properties) in the same instruction. (It's possible with SXW documents.) So, you must create the style and select, say, the paragraph properties area, then update the style in order to deal with the text area properties.
Could you try this sequence:
# open the styles side of the document
$doc->ooDocument(file => "myfile.odt", member => "styles");
# create the style as a child of "Standard"
# and set the 'paragraph' properties
$doc->createStyle
(
'Code',
family=>'paragraph',
parent => "Standard",
properties =>
{
'area' => 'paragraph',
'fo:background-color' => "#e6e6ff",
'fo:border-bottom' => "0.002cm solid #000000",
'fo:border-left' => "0.002cm solid #000000",
'fo:border-right' => "none",
'fo:border-top' => "0.002cm solid #000000",
'fo:padding' => "0.25cm",
'style:shadow' => "none"
}
);
# update the style in order to set
# the 'text' properties (ex: font) separately
$doc->updateStyle
(
'Code',
properties =>
{
'area' => 'text',
'fo:font-size' => "8pt",
'style:font-name' => "Bitstream Vera Sans Mono"
}
);
# commit the changes
$doc->save("targetfile.odt");