Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

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

Hmmm, you are doing this: HTTP::Cookies::Netscape::save($jar, "mycookies.txt"); which as you say has the problem if internally save() calls any of the "overwritten" methods (quoted because they are not overwritten at all). In this case these are just save() and load(). And I see one more special-but-common case: if it recurses save(). Also calling a logger helper method would be printing parent class signature.

I am reblessing from a parent class and not just any class, so all state variables and internal methods that may be needed by the child will be inherited. That minimizes the risks. But are there still any?

I see one, if subclass has its own state variables which are set/changed during operations prior to save() for example if it implements its own set_cookie() or new(). That bug will hurt! But it will not affect subclass-specific constants and such, these will assume their initial value upon reblessing.

The use-case I had in mind is to use this "method" in order to transform from one cookie format to another using all those subclasses under HTTP::Cookies but I will have to examine each of these for above problems. I am not sure if other OO-based languages avoid this problem. I don't think Java does that or indeed can do that. It's up to the programmer to adhere to the "princaiples" (sic).

bw, bliako


In reply to Re^2: Saving HTTP::Cookies into Netscape format using bless/re-bless by bliako
in thread Saving HTTP::Cookies into Netscape format using bless/re-bless by bliako

Title:
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2021-09-20 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?