Is this a Buddhist poem? Ryōkan Taigu is described as,


  Ryōkan Taigu (良寛大愚?) (1758–1831) was a quiet and eccentric Sōtō Zen Buddhist monk who lived much of his life as a hermit. Ryōkan is remembered for his poetry and calligraphy, which present the essence of Zen life. He is also known by the name Ryokwan in English.


I'm reading this poem and am puzzled by it.

In A Dilapidated Three-Room Hut

In a dilapidated three-room hut 
I’ve grown old and tired; 
This winter cold is the 
Worst I’ve ever suffered through. 
I sip thin gruel, waiting for the 
Freezing night to pass. 
Can I last until spring finally arrives? 
Unable to beg for rice, 
How will I survive the chill? 
Even meditation helps no longer; 
Nothing left to do but compose poems 
In memory of deceased friends.


One of the things that puzzles me is the last line ("memory of deceased friends").

I thought (I'm probably mistaken again :-) that Buddhists are advised to "live in the present" and to avoid living "in memory", and to deconstruct the self instead of thinking "I feel" and "I suffer" and "I last".

Can you say what Ryōkan's intention might have been in writing this poem?

Wikipedia says, of Sōtō,


  The meditator strives to be aware of the stream of thoughts, allowing them to arise and pass away without interference.


Perhaps that's what this poem is doing: simply awareness of a stream of thoughts? What's the difference between that and, I don't know, any other ordinary unenlightened mode of thought or life?
I think you are confounding Buddhist principles with Japanese culture - of which veneration of the dead is an important part.  If there is one thing you can say about Buddhism, it's that it doesn't exist in a vacuum and often takes on the cultural customs of its practitioners.

Besides, it's a poem.  He's trying to capture a moment for an audience, not make a statement about the dharma.  ;-)