Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I had reason to use the perl functionality built into a vendors software package today. The package comes with 5.8.3, and it's own set of perl modules to do software related tasks like tweaking data records.

At one point, I have to figure out why this didn't work:

$valobj->value = undef;

but this did:

$valobj->value = '';

After looking into the source code, the object and it's methods use the :lvalue attribute.

sub value : lvalue { my $this = shift; $this->{VALUE}; }

So, that doesn't work if lvalue is undef, but does work if lvalue is an empty string. Is that a 'feature' of the lvalue attribute, or something about the method?

I wouldn't expect this traditional setup to work:

sub value { my ($self, $value) = @_; if (defined $value) { $self->{value} = $value; }; }; $valobj->value(undef);

But I would've expected all the work behind :lvalue to fix that.

Updated: Yes, I've read the pod. It's experimental. Good thing they're using it. The pod doesn't really mention what would happen in the case of setting undef though.


In reply to :lvalue, How I Hate Thee by jk2addict

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-05-25 12:18 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.