Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: How do I print the page header/footer from an excel spreadsheet

by bmann (Priest)
on Nov 08, 2006 at 18:54 UTC ( #582949=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How do I print the page header/footer from an excel spreadsheet
in thread How di I print the page header/footer from an excel spreadsheet

You can use the "hash syntax" to access object properties (see Win32::OLE documentation)Properties of an object are implemented as a hashref, so more simply:

$Sheet->PageSetup->{"$element$position"} # or $Sheet->PageSetup->{$element . $position}
Update: pr


Comment on Re^3: How do I print the page header/footer from an excel spreadsheet
Download Code
Re^4: How do I print the page header/footer from an excel spreadsheet
by friedo (Prior) on Nov 08, 2006 at 19:12 UTC
    Not all objects work that way under the hood, though. It's bad practice to access the hash data directly. (Though it's probably not very good practice to use arcane syntax for dynamic method names either!)
      Not sure if you replied before the update, but why is it bad practice? I know some properties can't be set that way, but what problems do avoid by not using the hash syntax?

        It's bad practice because if you access object data from outside the object's class, you make it difficult to change how that object operates internally later. One of the goals of OOP is to present a well-defined interface to the outside world (a class's methods) so that you can refactor the inside while keeping the client code the same.

        Suppose that in a new version of your class, you change how the data is represented internally in the hash. You also change your accessor methods to deal with the new data format and you confirm that they return the same results as before with unit tests. As long as everybody was using the accessors to get the data, everything's hunky-dory. But that one guy who accessed the hash data directly will now have broken code.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://582949]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (10)
As of 2014-08-29 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls