I suspect that whatever you are using to "edit" the jpg, isn't editing it in-place, but rather when you save the changes you made, it deletes the original file and then write a new one with the original name and the new contents. This (by design) breaks the link.

For reference and an authoritative description, see this forum post by the guy that implemented link on win32.

To prove it is the editor rather than perl that is at fault, try this sequence of steps:

c:\test\junk>dir 18/02/2012 22:09 633 a.jpg c:\test\junk>perl -E"say link 'a.jpg', 'b.jpg';" 1 c:\test\junk>dir 18/02/2012 22:09 633 a.jpg 18/02/2012 22:09 633 b.jpg c:\test\junk>md5sum a.jpg 56c800418e498e40ae9bc4c1e4023341 *a.jpg c:\test\junk>md5sum b.jpg 56c800418e498e40ae9bc4c1e4023341 *b.jpg c:\test\junk>perl -E"open I,'+<:raw','a.jpg';seek I,400,0;syswrite I,0 +xffffffff,4;close I" c:\test\junk>md5sum a.jpg 8bc46c67f8e5d8c0caf4c7c59db66779 *a.jpg c:\test\junk>md5sum b.jpg 8bc46c67f8e5d8c0caf4c7c59db66779 *b.jpg

Of course, the jpgs aren't valid any more after the edit above, but it should convince you that editing one also edits the other.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?


In reply to Re^5: about link() by BrowserUk
in thread about link() by exilepanda

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.