Skip Menu |

This queue is for tickets about the Net-Appliance-Session CPAN distribution.

Report information
The Basics
Id: 73418
Status: resolved
Priority: 0/
Queue: Net-Appliance-Session

People
Owner: OLIVER [...] cpan.org
Requestors: ssb [...] umn.edu
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 3.112610
Fixed in: (no value)



Subject: documentation/behavior issue: print $s->cmd('show access-list');
The documentation gives the impression that print should be able to straightforwardly take the output of "cmd" and spit it to output, but in a print "cmd" seems to strip newlines which makes good sense in an array context, but not such great sense in a scalar context. Seems like either the code should append newlines if the request is in a scalar context or else the documentation should be adjusted to make the example do something more directly useful. OHO! Just discovered that it includes the newlines if I force it to be scalar either by storing in a scalar or by joining to a scalar: print '' . $s->cmd('show access-list'); Hmmm...but it turns out that even this is missing the final newline.
Hi, On Wed Dec 21 15:34:16 2011, https://openid.umn.edu/ssb wrote: Show quoted text
> The documentation gives the impression that print should be able to > straightforwardly take the output of "cmd" and spit it to output, but in > a print "cmd" seems to strip newlines which makes good sense in an array > context, but not such great sense in a scalar context.
Many thanks for the bug report. I ended up, as a consequence of another open issue, rewriting the output handling within the module, and I think it's now more consistent both with the documentation and what the user would expect. In particular: In scalar context the response of cmd() or macro() is returned as a single string. In list context the gathered response is returned as a list of lines. In both cases your local platform's newline character will end all lines. The new releases of Net::Appliance::Session and Net::CLI::Interact on CPAN have the new behaviour. I hope this resolves your issue, and please let me know how you get on. regards, oliver.
Subject: Re: [rt.cpan.org #73418] documentation/behavior issue: print $s->cmd('show access-list');
Date: Mon, 9 Jan 2012 14:55:38 -0600
To: bug-Net-Appliance-Session [...] rt.cpan.org
From: Scott Bertilson <ssb [...] umn.edu>
Works great. Thanks and sorry it took me so long to respond. Scott On Mon, Dec 26, 2011 at 7:17 PM, Oliver Gorwits via RT < bug-Net-Appliance-Session@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73418 > > > Hi, > > On Wed Dec 21 15:34:16 2011, https://openid.umn.edu/ssb wrote:
> > The documentation gives the impression that print should be able to > > straightforwardly take the output of "cmd" and spit it to output, but in > > a print "cmd" seems to strip newlines which makes good sense in an array > > context, but not such great sense in a scalar context.
> > Many thanks for the bug report. > > I ended up, as a consequence of another open issue, rewriting the output > handling within the > module, and I think it's now more consistent both with the documentation > and what the user > would expect. In particular: > > In scalar context the response of cmd() or macro() is returned as a single > string. In list context > the gathered response is returned as a list of lines. In both cases your > local platform's newline > character will end all lines. > > The new releases of Net::Appliance::Session and Net::CLI::Interact on CPAN > have the new > behaviour. I hope this resolves your issue, and please let me know how you > get on. > > regards, > oliver. >