Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: slice of ptr-based-output routines?

by perl-diddler (Hermit)
on Aug 01, 2012 at 21:02 UTC ( #984893=note: print w/ replies, xml ) Need Help??


in reply to Re: slice of ptr-based-output routines?
in thread slice of ptr-based-output routines?

Are you saying a slice is less clear than spelling out the pointer with each element?

I don't think I emphasized the point clearly enough -- the above was a transitory debug line put in to look at those values. I didn't want a loop or supporting routines... just wanted to print. Pe is a shortcut routine all in of itself, It' alternate of P, which prints to STDOUT by default (or to a string, in string context). Auto traps/handles undef's in printed args and auto deals with linefeed (adds as final char going to a file handle if needed).

Each item I am printing is a 'class variable' and all of those subs are 'accessor routines'...writing additional routines just to print the value of accessor routines is way overkill for a debug statement.

It's all about easy of programming... computers were designed to be the servants of humans -- not the otherway around.

I just thought a slice like statement where each accessor is called off the same pointer would be more clear than retyping the accessor 5 times. Aren't we supposed to avoid duplication in code?

Sorry if I was unclear, but I did try to stress it was only debugging code.


Comment on Re^2: slice of ptr-based-output routines?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2014-09-21 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls