Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984893]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-02-18 04:00 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (250 votes). Check out past polls.