Date: Wednesday March 06, 2019 @ 23:05 Author: argrath Update of /cvsroot/perldocjp/docs/modules/Storable-2.05 In directory sf-cvs:/tmp/cvs-serv78654/modules/Storable-2.05 Modified Files: Storable.pod Log Message: add original =================================================================== File: Storable.pod Status: Up-to-date Working revision: 1.3 Wed Mar 6 14:05:59 2019 Repository revision: 1.3 /cvsroot/perldocjp/docs/modules/Storable-2.05/Storable.pod,v Existing Tags: No Tags Exist -------------- next part -------------- Index: docs/modules/Storable-2.05/Storable.pod diff -u docs/modules/Storable-2.05/Storable.pod:1.2 docs/modules/Storable-2.05/Storable.pod:1.3 --- docs/modules/Storable-2.05/Storable.pod:1.2 Thu Jan 27 22:15:07 2011 +++ docs/modules/Storable-2.05/Storable.pod Wed Mar 6 23:05:59 2019 @@ -1,11 +1,17 @@ =encoding euc-jp -=head1 ̾Á° +=head1 NAME + +=begin original + +Storable - persistence for Perl data structures + +=end original Storable - Perl¥Ç¡¼¥¿¹½Â¤ÂΤαʳ²½ -=head1 ³µÍ× +=head1 SYNOPSIS use Storable; store \%table, 'file'; @@ -13,52 +19,148 @@ use Storable qw(nstore store_fd nstore_fd freeze thaw dclone); +=begin original + + # Network order + nstore \%table, 'file'; + $hashref = retrieve('file'); # There is NO nretrieve() + +=end original + # ¥Í¥Ã¥È¥ï¡¼¥¯Íͼ° nstore \%table, 'file'; $hashref = retrieve('file'); # There is NO nretrieve() +=begin original + + # Storing to and retrieving from an already opened file + store_fd \@array, \*STDOUT; + nstore_fd \%table, \*STDOUT; + $aryref = fd_retrieve(\*SOCKET); + $hashref = fd_retrieve(\*SOCKET); + +=end original + # ´û¤Ë¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¤Ø³ÊǼ¤·¡¢¼è¹þ¤Þ¤¹ store_fd \@array, \*STDOUT; nstore_fd \%table, \*STDOUT; $aryref = fd_retrieve(\*SOCKET); $hashref = fd_retrieve(\*SOCKET); +=begin original + + # Serializing to memory + $serialized = freeze \%table; + %table_clone = %{ thaw($serialized) }; + +=end original + # ¥á¥â¥ê¤Ø¤Î¥·¥ê¥¢¥é¥¤¥º $serialized = freeze \%table; %table_clone = %{ thaw($serialized) }; +=begin original + + # Deep (recursive) cloning + $cloneref = dclone($ref); + +=end original + # ¿¼¤¤¡ÊºÆµ¢Åª¤Ê¡ËÊ£¼Ì $cloneref = dclone($ref); +=begin original + + # Advisory locking + use Storable qw(lock_store lock_nstore lock_retrieve) + lock_store \%table, 'file'; + lock_nstore \%table, 'file'; + $hashref = lock_retrieve('file'); + +=end original + # ¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯ use Storable qw(lock_store lock_nstore lock_retrieve) lock_store \%table, 'file'; lock_nstore \%table, 'file'; $hashref = lock_retrieve('file'); -=head1 ÀâÌÀ +=head1 DESCRIPTION + +=begin original + +The Storable package brings persistence to your Perl data structures +containing SCALAR, ARRAY, HASH or REF objects, i.e. anything that can be +conveniently stored to disk and retrieved at a later time. + +=end original Storable¥Ñ¥Ã¥±¡¼¥¸¤Ï¡¢¥¹¥«¥é¡¼(SCALAR)¡¢ÇÛÎó(ARRAY)¡¢¥Ï¥Ã¥·¥å(HASH)¡¢ ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥ê¥Õ¥¡¥ì¥ó¥¹(REF)¤ò»ý¤Ã¤¿Perl¤Î¥Ç¡¼¥¿¹½Â¤ÂΤò±Ê³²½¤·¤Þ¤¹¡£ ¤Ä¤Þ¤ê´Êñ¤Ë¥Ç¥£¥¹¥¯¤Ë³ÊǼ¤·¡¢¸å¤Ç¼è¤ê¹þ¤à¤³¤È¤ò²Äǽ¤Ë¤·¤Þ¤¹¡£ +=begin original + +It can be used in the regular procedural way by calling C<store> with +a reference to the object to be stored, along with the file name where +the image should be written. + +=end original + ³ÊǼ¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤È¥¤¥á¡¼¥¸¤¬½ñ¤¹þ¤Þ¤ì¤ë¥Õ¥¡¥¤¥ë̾¤ò »ØÄꤷ¤ÆC<store>¤ò¸Æ¤Ó½Ð¤¹¤È¤¤¤¦¡¢Ä̾ï¤Î¼ê³¤Åª¤ÊÊýË¡¤Ç»È¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡£ +=begin original + +The routine returns C<undef> for I/O problems or other internal error, +a true value otherwise. Serious errors are propagated as a C<die> exception. + +=end original + ¤½¤Î¥ë¡¼¥Á¥ó¤ÏI/O¾ã³²¤ä¾¤ÎÆâÉô¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤ÈC<undef>¤òÊÖ¤·¡¢ ¤½¤¦¤Ç¤Ê¤±¤ì¤Ðtrue¤òÊÖ¤·¤Þ¤¹¡£½ÅÂç¤Ê¥¨¥é¡¼¤ÏC<die>Îã³°¤ÇÅÁ¤¨¤é¤ì¤Þ¤¹¡£ +=begin original + +To retrieve data stored to disk, use C<retrieve> with a file name. +The objects stored into that file are recreated into memory for you, +and a I<reference> to the root object is returned. In case an I/O error +occurs while reading, C<undef> is returned instead. Other serious +errors are propagated via C<die>. + +=end original + ¥Ç¥£¥¹¥¯¤Ë³ÊǼ¤µ¤ì¤¿¥Ç¡¼¥¿¤ò¼è¤ê¹þ¤à¤Ë¤Ï¡¢¥Õ¥¡¥¤¥ë̾¤òÉÕ¤±¤ÆC<retrieve>¤ò »È¤¤¤Þ¤¹¡£¤½¤·¤Æ¤½¤Î¥Õ¥¡¥¤¥ë¤Ë³ÊǼ¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Ï¥á¥â¥ê¾å¤ËºÆÀ¸À®¤µ¤ì¤Þ¤¹¡£ ¸µ¤Ë¤Ê¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤ÎI<¥ê¥Õ¥¡¥ì¥ó¥¹>¤¬ÊÖ¤µ¤ì¤Þ¤¹¡£Æɹþ¤ÎÅÓÃæ¤Ç I/O¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤È¡¢C<undef>¤¬Âå¤ï¤ê¤ËÊÖ¤µ¤ì¤Þ¤¹¡£ ¾¤Î½ÅÂç¤Ê¥¨¥é¡¼¤Î¾ì¹ç¤Ë¤Ï¡¢¥¨¥é¡¼¤¬C<die>¤òÄ̤¸¤ÆÅÁ¤¨¤é¤ì¤Þ¤¹¡£ +=begin original + +Since storage is performed recursively, you might want to stuff references +to objects that share a lot of common data into a single array or hash +table, and then store that object. That way, when you retrieve back the +whole thing, the objects will continue to share what they originally shared. + +=end original + ³ÊǼ¤¬ºÆµ¢Åª¤Ë¹Ô¤ï¤ì¤ë¤Î¤Ç¡¢¶¦Ä̤Υǡ¼¥¿¤Î¿¤¯¤ò¶¦Í¤·¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î ¥ê¥Õ¥¡¥ì¥ó¥¹¤¿¤Á¤ò£±¤Ä¤ÎÇÛÎó¤Þ¤¿¤Ï¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤ËµÍ¤á¹þ¤ó¤Ç¤·¤Þ¤¤¡¢ ¤½¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò³ÊǼ¤·¤¿¤¤¤È»×¤¦¤«¤â¤·¤ì¤Þ¤»¤ó¡£¤³¤ÎÊýË¡¤Ç¤Ï¡¢Á´ÂΤò ¼è¤ê¹þ¤ó¤À¤È¤¤Ë¡¢¸µ¡¹¶¦Í¤·¤Æ¤¤¤¿¤â¤Î¤ò°ú¤Â³¤¶¦Í¤·¤Þ¤¹¡£ +=begin original + +At the cost of a slight header overhead, you may store to an already +opened file descriptor using the C<store_fd> routine, and retrieve +from a file via C<fd_retrieve>. Those names aren't imported by default, +so you will have to do that explicitly if you need those routines. +The file descriptor you supply must be already opened, for read +if you're going to retrieve and for write if you wish to store. + +=end original + ¥Ø¥Ã¥À¤Ë¤Á¤ç¤Ã¤È¼ê¤ò¤¤¤ì¤ë¤È¡¢C<store_fd>¥ë¡¼¥Á¥ó¤ò»È¤Ã¤Æ´û¤Ë³«¤¤¤Æ¤¤¤ë ¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ë³ÊǼ¤·¡¢C<fd_retrieve>¤òÄ̤¸¤Æ¥Õ¥¡¥¤¥ë¤«¤é¼è¤ê½Ð¤¹¤³¤È¤¬ ¤Ç¤¤Þ¤¹¡£¤½¤ì¤é¤Î̾Á°¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¥¤¥ó¥Ý¡¼¥È¤µ¤ì¤Þ¤»¤ó¡£¤½¤Î¤¿¤á¡¢ @@ -66,8 +168,21 @@ »ØÄꤹ¤ë¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ï¡¢¼è¤ê¹þ¤à¤Ä¤â¤ê¤Ç¤¢¤ì¤ÐÆɤ߹þ¤ßread)¤Ç¡¢ ³ÊǼ¤¹¤ë¤Ä¤â¤ê¤Ç¤¢¤ì¤Ð½ñ¤¹þ¤ß(write)¤Ç¡¢´û¤Ë³«¤«¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ - store_fd(\%table, *STDOUT) || die "can't store to stdout\n"; - $hashref = fd_retrieve(*STDIN); + store_fd(\%table, *STDOUT) || die "can't store to stdout\n"; + $hashref = fd_retrieve(*STDIN); + +=begin original + +You can also store data in network order to allow easy sharing across +multiple platforms, or when storing on a socket known to be remotely +connected. The routines to call have an initial C<n> prefix for I<network>, +as in C<nstore> and C<nstore_fd>. At retrieval time, your data will be +correctly restored so you don't have to know whether you're restoring +from native or network ordered data. Double values are stored stringified +to ensure portability as well, at the slight risk of loosing some precision +in the last decimals. + +=end original Ê£¿ô¤Î¥×¥é¥Ã¥È¥Û¡¼¥à¤Ç¶¦Í¤¹¤ë¤³¤È¤ò´Êñ¤Ë¤·¤¿¤ê¡¢¥ê¥â¡¼¥È¤ËÀܳ¤µ¤ì¤Æ¤¤¤ë ¤³¤È¤¬Ê¬¤«¤Ã¤Æ¤¤¤ë¥½¥±¥Ã¥È¤Ë³ÊǼ¤¹¤ë¤È¤¤Ë¡¢¥Í¥Ã¥È¥ï¡¼¥¯Íͼ°¤Ç³ÊǼ¤¹¤ë¤³¤È¤â @@ -77,9 +192,28 @@ ¤¢¤ê¤Þ¤»¤ó¡£double¡ÊÇÜÀºÅÙÉâÆ°¾®¿ôÅÀ¿ô·¿¡Ë¤ÎÃͤâ°Ü¿¢À¤¬Êݾڤµ¤ì¤ë¤è¤¦¤Ë ʸ»úÎ󲽤µ¤ì¤Þ¤¹¡£¤¿¤À¤·ºÇ¸å¤Î·å¤ÎÀºÅÙ¤¬¼ã´³¼º¤ï¤ì¤ë´í¸±À¤¬¤¢¤ê¤Þ¤¹¡£ +=begin original + +When using C<fd_retrieve>, objects are retrieved in sequence, one +object (i.e. one recursive tree) per associated C<store_fd>. + +=end original + C<retrieve_fd>¤ò»È¤¦¤È¤¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Ï¡¢Âбþ¤¹¤ëC<store_fd>Ëè¡¢ 1¤Ä¤Î¥ª¥Ö¥¸¥§¥¯¥È¡Ê¤Ä¤Þ¤ê£±¤Ä¤ÎºÆµ¢¥Ä¥ê¡¼¡Ë¤ò½çÈ֤˼è¤ê¹þ¤Þ¤ì¤Þ¤¹¡£ +=begin original + +If you're more from the object-oriented camp, you can inherit from +Storable and directly store your objects by invoking C<store> as +a method. The fact that the root of the to-be-stored tree is a +blessed reference (i.e. an object) is special-cased so that the +retrieve does not provide a reference to that object but rather the +blessed object reference itself. (Otherwise, you'd get a reference +to that blessed object). + +=end original + ¤µ¤é¤Ë¥ª¥Ö¥¸¥§¥¯¥È»Ø¸þ¿Ø±Ä´ó¤ê¤Ç¤¢¤ì¤Ð¡¢Storable¤ò·Ñ¾µ¤·¤Æ¡¢ C<store>¤ò¥á¥½¥Ã¥É¤È¤·¤Æ¸Æ¤Ó½Ð¤¹¤³¤È¤Ë¤è¤ê¡¢¤¢¤Ê¤¿¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò ľÀܳÊǼ¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£³ÊǼ¤µ¤ì¤ë¥Ä¥ê¡¼¤Î¸µ¤¬bless¤µ¤ì¤¿ @@ -89,7 +223,20 @@ ¡Ê¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¤½¤Îbless¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤ò ¼èÆÀ¤¹¤ë¤³¤È¤Ë¤Ç¤·¤ç¤¦¡Ë -=head1 ¥á¥â¥ê¤Ø¤Î³ÊǼ +=head1 MEMORY STORE + +(¥á¥â¥ê¤Ø¤Î³ÊǼ) + +=begin original + +The Storable engine can also store data into a Perl scalar instead, to +later retrieve them. This is mainly used to freeze a complex structure in +some safe compact memory place (where it can possibly be sent to another +process via some IPC, since freezing the structure also serializes it in +effect). Later on, and maybe somewhere else, you can thaw the Perl scalar +out and recreate the original complex structure in memory. + +=end original Storable¥¨¥ó¥¸¥ó¤Ï¸å¤«¤é¼è¤ê¹þ¤à¤¿¤á¤Ë¡¢Perl¥¹¥«¥é¡¼¤Ë¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë ¤³¤È¤â¤Ç¤¤Þ¤¹¡£¤³¤ì¤Ï¼ç¤ËÊ£»¨¤Ê¹½Â¤ÂΤò°ÂÁ´¤Ç¾®¤µ¤Ê¥á¥â¥ê¶õ´Ö¤Ë @@ -98,42 +245,119 @@ ¸å¤Ç¡¢¤½¤·¤Æ¿ʬ¤É¤³¤«Ê̤ΤȤ³¤í¤Ç¡¢Perl¥¹¥«¥é¤ò²òÅà(thaw)¤·¡¢ ¸µ¤ÎÊ£»¨¤Ê¹½Â¤ÂΤò¥á¥â¥ê¾å¤ËºÆÀ¸À®¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ +=begin original + +Surprisingly, the routines to be called are named C<freeze> and C<thaw>. +If you wish to send out the frozen scalar to another machine, use +C<nfreeze> instead to get a portable image. + +=end original + ¶Ã¤¤¤¿¤³¤È¤Ë¡¢¸Æ¤Ð¤ì¤ë¥ë¡¼¥Á¥ó¤Î̾Á°¤ÏC<freeze>¤ÈC<thaw>¤È¤¤¤¤¤Þ¤¹¡£ ¤â¤·¸Ç¤á¤¿¥¹¥«¥é¤ò¾¤Î¥Þ¥·¥ó¤ËÁ÷¿®¤·¤¿¤±¤ì¤Ð¡¢Âå¤ï¤ê¤ËC<nfreeze>¤ò ¥Ý¡¼¥¿¥Ö¥ë¤Ê¥¤¥á¡¼¥¸¤ò¼èÆÀ¤·¤Æ¤¯¤À¤µ¤¤¡£ +=begin original + +Note that freezing an object structure and immediately thawing it +actually achieves a deep cloning of that structure: + +=end original + ¥ª¥Ö¥¸¥§¥¯¥È¹½Â¤¤ò¸Ç¤á¡¢¤¹¤°¤Ë²òÅह¤ë¤È¡¢¼ÂºÝ¤Ë¤Ï¡¢¤½¤Î¹½Â¤¤ò¿¼¤¯ Ê£¼Ì¤¹¤ë¤³¤È¤ò¼Â¸½¤·¤Æ¤¤¤ë¤³¤È¤ËÃí°Õ¤·¤Æ²¼¤µ¤¤¡§ dclone(.) = thaw(freeze(.)) +=begin original + +Storable provides you with a C<dclone> interface which does not create +that intermediary scalar but instead freezes the structure in some +internal memory space and then immediately thaws it out. + +=end original + Storable¤Ï¡¢Ãæ´Ö¤Î¥¹¥«¥é¤òºîÀ®¤¹¤ë¤³¤È¤Ê¤¯¡¢Âå¤ï¤ê¤ËÆâÉô¥á¥â¥ê¶õ´Ö¤Ë ¹½Â¤¤ò¸Ç¤á¡¢¤¹¤°¤Ë²òÅह¤ëC<dclone>¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤òÄ󶡤·¤Æ¤¤¤Þ¤¹¡£ -=head1 ¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯ +=head1 ADVISORY LOCKING + +(¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯) + +=begin original + +The C<lock_store> and C<lock_nstore> routine are equivalent to +C<store> and C<nstore>, except that they get an exclusive lock on +the file before writing. Likewise, C<lock_retrieve> does the same +as C<retrieve>, but also gets a shared lock on the file before reading. + +=end original C<lock_store>¤ÈC<lock_nstore>¤ÏC<store>¤ÈC<nstore>¤ÈƱ¤¸¤Ç¤¹¡£¤¿¤À¤·¡¢ ½ñ¤¹þ¤àÁ°¤ËÀêÍ¥í¥Ã¥¯¤ò¹Ô¤¤¤Þ¤¹¡£Æ±ÍͤËC<lock_retrieve>¤ÏC<retrieve>¤Î¤è¤¦¤Ë Æ°¤¤Þ¤¹¡£¤·¤«¤·Æɤ߹þ¤àÁ°¤Ë¶¦Í¥í¥Ã¥¯¤ò¹Ô¤¤¤Þ¤¹¡£ +=begin original + +As with any advisory locking scheme, the protection only works if you +systematically use C<lock_store> and C<lock_retrieve>. If one side of +your application uses C<store> whilst the other uses C<lock_retrieve>, +you will get no protection at all. + +=end original + Á´¤Æ¤Î¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯¤Î¥¹¥¡¼¥à¤ÈƱ¤¸¤è¤¦¤Ë¡¢Êݸî¤Ï¤¢¤Ê¤¿¤¬ ¥·¥¹¥Æ¥Þ¥Æ¥£¥Ã¥¯¤ËC<lock_store>¤ÈC<lock_retrieve>¤ò»È¤¦¤È¤¤Ë¤À¤±µ¡Ç½¤·¤Þ¤¹¡£ ¤â¤·Â¾¤ÎÉôʬ¤¬C<lock_retrieve>¤ò»È¤Ã¤Æ¤¤¤ë¤È¤¤Ë¡¢¤¢¤Ê¤¿¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î ¤¢¤ëÉôʬ¤¬C<store>¤ò»È¤¦¤È¡¢²¿¤âÊݸ¤ì¤Þ¤»¤ó¡£ +=begin original + +The internal advisory locking is implemented using Perl's flock() +routine. If your system does not support any form of flock(), or if +you share your files across NFS, you might wish to use other forms +of locking by using modules such as LockFile::Simple which lock a +file using a filesystem entry, instead of locking the file descriptor. + +=end original + ¥¢¥É¥Ð¥¤¥¶¥ê¡¦¥í¥Ã¥¯¤ÎÆâÉô¤ÏPerl¤Îflock()¥ë¡¼¥Á¥ó¤ò»È¤Ã¤Æ¼ÂÁõ¤µ¤ì¤Þ¤¹¡£ ¤â¤·¤¢¤Ê¤¿¤Î¥·¥¹¥Æ¥à¤¬flock()¤Î¤¤¤«¤Ê¤ë·Á¼°¤â¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Ê¤«¤Ã¤¿¤ê¡¢ ¤¢¤Ê¤¿¤Î¥Õ¥¡¥¤¥ë¤òNFS±Û¤·¤Ë¥Õ¥¡¥¤¥ë¤ò¶¦Í¤·¤Æ¤¤¤ë¤Î¤Ç¤¢¤ì¤Ð¡¢¥Õ¥¡¥¤¥ëµ½Ò»Ò¤Ç¤Ï¤Ê¤¯ ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥¨¥ó¥È¥ê¤ò»È¤Ã¤Æ¥í¥Ã¥¯¤¹¤ëLockFile:Simple¤Î¤è¤¦¤Ê¥â¥¸¥å¡¼¥ë¤ò »È¤Ã¤Æ¾¤Î·Á¼°¤Î¥í¥Ã¥¯¤ò»È¤¤¤¿¤¤¤³¤È¤Ç¤·¤ç¤¦¡£ -=head1 ¥¹¥Ô¡¼¥É +=head1 SPEED + +(¥¹¥Ô¡¼¥É) + +=begin original + +The heart of Storable is written in C for decent speed. Extra low-level +optimizations have been made when manipulating perl internals, to +sacrifice encapsulation for the benefit of greater speed. + +=end original ¥¹¥Ô¡¼¥É¤ò¾å¤²¤ë¤¿¤á¡¢Storable¤ÎÃæ³ËÉôʬ¤ÏC¤Ç½ñ¤«¤ì¤Æ¤¤¤Þ¤¹¡£ PerlÆâÉô¤òÁàºî¤¹¤ë¤È¤¡¢ ¤è¤ê¥¹¥Ô¡¼¥É¤ò¾å¤²¤ë¤¿¤á¤Ë¥«¥×¥»¥ë²½¤òµ¾À·¤Ë¤¹¤ë¤È¤¤¤¦¡¢ÆÃÊ̤ÊÄã¥ì¥Ù¥ë¤ÎºÇŬ²½¤¬¤Ê ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ -=head1 µ¬ÈÏ·Á¼° +=head1 CANONICAL REPRESENTATION + +(µ¬ÈÏ·Á¼°) + +=begin original + +Normally, Storable stores elements of hashes in the order they are +stored internally by Perl, i.e. pseudo-randomly. If you set +C<$Storable::canonical> to some C<TRUE> value, Storable will store +hashes with the elements sorted by their key. This allows you to +compare data structures by comparing their frozen representations (or +even the compressed frozen representations), which can be useful for +creating lookup tables for complicated queries. + +=end original Ä̾ïStorable¤Ï¥Ï¥Ã¥·¥å¤òPerl¤¬ÆâÉôŪ¤Ë³ÊǼ¤·¤Æ¤¤¤ë½ç½ø¤ÇÍ×ÁǤò³ÊǼ¤·¤Þ¤¹¡£¤Ä¤Þ¤ê µ¿»÷¥é¥ó¥À¥à¤Ë¤Ê¤ê¤Þ¤¹¡£¤â¤·C<$Storable::canonical>¤òC<TRUE>ÃͤËÀßÄꤹ¤ë¤È¡¢ @@ -141,9 +365,32 @@ ¸Ç¤á¤é¤ì¤¿·Á¼°¤Ç(¤Þ¤¿¤Ï¸Ç¤á¤é¤ì°µ½Ì¤µ¤ì·Á¼°¤Ç¤µ¤¨¡ËÈæ³Ó¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¤è¤¦¤Ë ¤Ê¤ê¤Þ¤¹¡£¤³¤ì¤ÏÊ£»¨¤ÊÌ䤤¹ç¤ï¤»¤Î¤¿¤á¤Î»²¾È¥Æ¡¼¥Ö¥ë¤òºî¤ë¤Î¤ËÊØÍø¤Ç¤·¤ç¤¦¡£ +=begin original + +Canonical order does not imply network order; those are two orthogonal +settings. + +=end original + µ¬ÈÏÍͼ°(=Canonical)¤Ï¥Í¥Ã¥È¥ï¡¼¥¯Íͼ°¤ò°ÕÌ£¤·¤Æ¤¤¤Þ¤»¤ó¡£¤½¤ì¤é¤Ï¤Þ¤Ã¤¿¤¯°ã¤¦ÀßÄê¤Ç¤¹¡£ -=head1 ¥³¡¼¥É¡¦¥ê¥Õ¥¡¥ì¥ó¥¹ +=head1 CODE REFERENCES + +(¥³¡¼¥É¡¦¥ê¥Õ¥¡¥ì¥ó¥¹) + +=begin original + +Since Storable version 2.05, CODE references may be serialized with +the help of L<B::Deparse>. To enable this feature, set +C<$Storable::Deparse> to a true value. To enable deserializazion, +C<$Storable::Eval> should be set to a true value. Be aware that +deserialization is done through C<eval>, which is dangerous if the +Storable file contains malicious data. You can set C<$Storable::Eval> +to a subroutine reference which would be used instead of C<eval>. See +below for an example using a L<Safe> compartment for deserialization +of CODE references. + +=end original Storable ¥Ð¡¼¥¸¥ç¥ó 2.05¤«¤é¡¢¥³¡¼¥É(CODE)¥ê¥Õ¥¡¥ì¥ó¥¹¤¬L<B::Deparse>¤Î ½õ¤±¤ò¼Ú¤ê¤Æ¥·¥ê¥¢¥é¥¤¥º¤Ç¤¤Þ¤¹¡£¤³¤Îµ¡Ç½¤ò͸ú¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢ @@ -156,7 +403,19 @@ ¥³¡¼¥É(CODE)¥ê¥Õ¥¡¥ì¥ó¥¹¤Î¥Ç¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤Ë¤Ä¤¤¤Æ¤Ï¡¢L<Safe> ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò»È¤Ã¤Æ¤¤¤ë²¼µ¤ÎÎã¤ò¤´Í÷¤¯¤À¤µ¤¤¡£ -=head1 ¾Íè¤Ø¤Î¸ß´¹À +=head1 FORWARD COMPATIBILITY + +(¾Íè¤Ø¤Î¸ß´¹À) + +=begin original + +This release of Storable can be used on a newer version of Perl to +serialize data which is not supported by earlier Perls. By default, +Storable will attempt to do the right thing, by C<croak()>ing if it +encounters data that it cannot deserialize. However, the defaults +can be changed as follows: + +=end original º£²ó¤ÎStorable¤Î¥ê¥ê¡¼¥¹¤Ç¤Ï¡¢Perl¤Î¤è¤ê¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤Ç°ÊÁ°¤ÎPerl¤Ç¤Ï ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤«¤Ã¤¿¥Ç¡¼¥¿¤ò¥·¥ê¥¢¥é¥¤¥º¤¹¤ë¤¿¤á¤Ë»È¤¦¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ @@ -166,7 +425,25 @@ =over 4 -=item utf8¥Ç¡¼¥¿ +=item utf8 data + +(utf8¥Ç¡¼¥¿) + +=begin original + +Perl 5.6 added support for Unicode characters with code points > 255, +and Perl 5.8 has full support for Unicode characters in hash keys. +Perl internally encodes strings with these characters using utf8, and +Storable serializes them as utf8. By default, if an older version of +Perl encounters a utf8 value it cannot represent, it will C<croak()>. +To change this behaviour so that Storable deserializes utf8 encoded +values as the string of bytes (effectively dropping the I<is_utf8> flag) +set C<$Storable::drop_utf8> to some C<TRUE> value. This is a form of +data loss, because with C<$drop_utf8> true, it becomes impossible to tell +whether the original data was the Unicode string, or a series of bytes +that happen to be valid utf8. + +=end original Perl 5.6 ¤Ï255¤è¤ê¤âÂ礤ʥ³¡¼¥ÉÃͤò»ý¤ÄUnicodeʸ»ú¤Î¥µ¥Ý¡¼¥È¤¬²Ã¤ï¤ê¤Þ¤·¤¿¡£ ¤½¤·¤ÆPerl5.8¤Ç¤Ï¡¢¥Ï¥Ã¥·¥å¥¡¼¤Ç¤Î¥Õ¥ë¥µ¥Ý¡¼¥È¤ò»ý¤Á¤Þ¤¹¡£Perl¤ÏÆâÉôŪ¤Ë¡¢ @@ -179,7 +456,22 @@ ¤È¤¤¤¦¤Î¤âC<$drop_utf8>¤¬true¤Ç¤¢¤ë¤È¡¢¤â¤È¤Î¥Ç¡¼¥¿¤¬Unicodeʸ»úÎó¤À¤Ã¤¿¤Î¤«¡¢ ¤¿¤Þ¤¿¤Þutf8¤È¤·¤ÆÀµ¤·¤¤¥Ð¥¤¥È¤ÎʤӤÀ¤Ã¤¿¤Î¤«¤¬Ê¬¤«¤é¤Ê¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ -=item ¸ÂÄê¥Ï¥Ã¥·¥å +=item restricted hashes + +(¸ÂÄê¥Ï¥Ã¥·¥å) + +=begin original + +Perl 5.8 adds support for restricted hashes, which have keys +restricted to a given set, and can have values locked to be read only. +By default, when Storable encounters a restricted hash on a perl +that doesn't support them, it will deserialize it as a normal hash, +silently discarding any placeholder keys and leaving the keys and +all values unlocked. To make Storable C<croak()> instead, set +C<$Storable::downgrade_restricted> to a C<FALSE> value. To restore +the default set it back to some C<TRUE> value. + +=end original Perl 5.8¤Ï¸ÂÄê¥Ï¥Ã¥·¥å(restricted hash) ¤Î¥µ¥Ý¡¼¥È¤òÄɲä·¤Þ¤¹¡£ ¤½¤ì¤ÏÍ¿¤¨¤é¤ì¤¿½¸¹ç¤Ë¤Î¤ß¥¡¼¤¬À©¸Â¤µ¤ì¡¢ÃͤòÆɹþ¤Î¤ß¤Ë¥í¥Ã¥¯¤¹¤ë¤³¤È¤¬ @@ -190,7 +482,21 @@ C<FALSE>¤ÎÃͤËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£¥Ç¥Õ¥©¥ë¥È¤ÎÀßÄê¤ËÌ᤹¤¿¤á¤Ë¤Ï²¿¤é¤«¤ÎC<TRUE>ÃÍ¤Ë Ìᤷ¤Æ¤¯¤À¤µ¤¤¡£ -=item ¾Íè¤Î¥Ð¡¼¥¸¥ç¥ó¤ÎStorable¤«¤é¤Î¥Õ¥¡¥¤¥ë +=item files from future versions of Storable + +(¾Íè¤Î¥Ð¡¼¥¸¥ç¥ó¤ÎStorable¤«¤é¤Î¥Õ¥¡¥¤¥ë) + +=begin original + +Earlier versions of Storable would immediately croak if they encountered +a file with a higher internal version number than the reading Storable +knew about. Internal version numbers are increased each time new data +types (such as restricted hashes) are added to the vocabulary of the file +format. This meant that a newer Storable module had no way of writing a +file readable by an older Storable, even if the writer didn't store newer +data types. + +=end original °ÊÁ°¤ÎStorable¤Ï¡¢Æɤó¤Ç¤¤¤ëStorable¤¬ÃΤäƤ¤¤ë¤â¤Î¤è¤ê¹â¤¤ÆâÉô¥Ð¡¼¥¸¥ç¥ó¤ò »ý¤Ã¤¿¥Õ¥¡¥¤¥ë¤Ë¤Ö¤Ä¤«¤ë¤È¤¹¤°¤Ëcroak¤·¤Þ¤·¤¿¡£ÆâÉô¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤Ï¿·¤·¤¤¥Ç¡¼¥¿·¿ @@ -198,35 +504,97 @@ ¤è¤ê¿·¤·¤¤Storable¥â¥¸¥å¡¼¥ë¤Ë¤Ï¡¢¤¿¤È¤¨¿·¤·¤¤¥Ç¡¼¥¿·¿¤ò³ÊǼ¤·¤Ê¤«¤Ã¤¿¤È¤·¤Æ¤â¡¢ ¸Å¤¤Storable¤ÇÆɤá¤ë¤è¤¦¤Ê¥Õ¥¡¥¤¥ë¤ò½ñ¤¯ÊýË¡¤¬¤Ê¤¤¤³¤È¤ò°ÕÌ£¤·¤Þ¤¹¡£ +=begin original + +This version of Storable will defer croaking until it encounters a data +type in the file that it does not recognize. This means that it will +continue to read files generated by newer Storable modules which are careful +in what they write out, making it easier to upgrade Storable modules in a +mixed environment. + +=end original + Storable¤Î¤³¤Î¥Ð¡¼¥¸¥ç¥ó¤Ï¡¢¥Õ¥¡¥¤¥ë¤ÎÃæ¤Ç¡¢¤½¤ì¤¬Íý²ò¤·¤Ê¤¤¥Ç¡¼¥¿·¿¤Ë¤Ö¤Ä¤«¤ë¤Þ¤Ç croak¤·¤Ê¤¤¤È¤¤¤¦ÅÀ¤Ç°Û¤Ê¤ê¤Þ¤¹¡£¤Ä¤Þ¤ê¤³¤ì¤Ï½ÐÎϤ¹¤ë¤â¤Î¤ËÃí°Õ¤òʧ¤¨¤Ð¡¢ ¿·¤·¤¤Storable¥â¥¸¥å¡¼¥ë¤Çºî¤é¤ì¤¿¥Õ¥¡¥¤¥ë¤Ç¤âÆɤळ¤È¤¬½ÐÍè¤ë¤È¤¤¤¦¤³¤È¤Ç¤¹¡£ ¤³¤ì¤Ë¤è¤êº®ºß¤¹¤ë´Ä¶¤ÇStorable¤ò¥¢¥Ã¥×¥°¥ì¡¼¥É¤¹¤ë¤³¤È¤¬´Êñ¤Ë¤Ê¤ê¤Þ¤¹¡£ +=begin original + +The old behaviour of immediate croaking can be re-instated by setting +C<$Storable::accept_future_minor> to some C<FALSE> value. + +=end original + C<$Storable::accept_future_minor>¤òC<FALSE>Ãͤˤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢Â¨ºÂ¤Ëcroak¤¹¤ë ¤È¤¤¤¦Storable¤Î¸Å¤¤Æ°¤¤ËÌ᤹¤³¤È¤¬½ÐÍè¤Þ¤¹¡£ =back +=begin original + +All these variables have no effect on a newer Perl which supports the +relevant feature. + +=end original + ¤³¤ì¤é¤ÎÊÑ¿ô¤Ï´ØÏ¢¤¹¤ëµ¡Ç½¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¿·¤·¤¤Perl¤Ç¤Ï²¿¤Î¸ú²Ì¤â¤¢¤ê¤Þ¤»¤ó¡£ -=head1 ¥¨¥é¡¼¡¦¥ì¥Ý¡¼¥È +=head1 ERROR REPORTING + +(¥¨¥é¡¼¡¦¥ì¥Ý¡¼¥È) + +=begin original + +Storable uses the "exception" paradigm, in that it does not try to workaround +failures: if something bad happens, an exception is generated from the +caller's perspective (see L<Carp> and C<croak()>). Use eval {} to trap +those exceptions. + +=end original Storable¤Ï"Îã³°"¥Ñ¥é¥À¥¤¥à¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£¤½¤ì¤Ç¤Ï¾ã³²¤ò²óÈò¤·¤è¤¦¤È¤Ï¤·¤Þ¤»¤ó: ²¿¤«¤è¤¯¤Ê¤¤¤³¤È¤¬È¯À¸¤·¤¿¤é¡¢¸Æ¤Ó½Ð¤·¤¿Â¦¤Î»ëÅÀ¤ÇÎã³°¤¬È¯À¸¤·¤Þ¤¹ ¡ÊL<Carp>¤ÈC<croak()>¤ò¤´Í÷¤¯¤À¤µ¤¤¡Ë¡£¤½¤ì¤é¤ÎÎã³°¤òÊá¤é¤¨¤ë¤¿¤á¤Ë¤Ïeval{}¤ò »È¤Ã¤Æ¤¯¤À¤µ¤¤¡£ +=begin original + +When Storable croaks, it tries to report the error via the C<logcroak()> +routine from the C<Log::Agent> package, if it is available. + +=end original + Storable¤¬croak¤¹¤ë¤È¤¡¢C<Log::Agent>¥Ñ¥Ã¥±¡¼¥¸¤¬ÍøÍѤǤ¤ë¤Î¤Ç¤¢¤ì¤Ð¡¢ ¤½¤ÎC<logcroak()>¥ë¡¼¥Á¥ó¤ò·Ðͳ¤·¤Æ¥¨¥é¡¼¤òÊó¹ð¤·¤è¤¦¤È¤·¤Þ¤¹¡£ +=begin original + +Normal errors are reported by having store() or retrieve() return C<undef>. +Such errors are usually I/O errors (or truncated stream errors at retrieval). + +=end original + Ä̾ï¤Î¥¨¥é¡¼¤Ïstorable()¤äretrieve()¤ËC<undef>¤òÊÖ¤¹¤³¤È¤Ë¤è¤êÊó¹ð¤µ¤ì¤Þ¤¹¡£ ¤½¤Î¤è¤¦¤Ê¥¨¥é¡¼¤ÏÄ̾ïI/O¤Î¥¨¥é¡¼¡Ê¤¢¤ë¤¤¤Ïretrieve¤Î¤µ¤¤¤Ë¥¹¥È¥ê¡¼¥à¤¬ ÀÚ¤ê¼Î¤Æ¤é¤ì¤¿¤«¡Ë¤Ç¤¹¡£ -=head1 ¾åµé¼Ô¤Î¤ß +=head1 WIZARDS ONLY + +(¾åµé¼Ô¤Î¤ß) -=head2 ¥Õ¥Ã¥¯ +=head2 Hooks + +(¥Õ¥Ã¥¯) + +=begin original + +Any class may define hooks that will be called during the serialization +and deserialization process on objects that are instances of that class. +Those hooks can redefine the way serialization is performed (and therefore, +how the symmetrical deserialization should be conducted). + +=end original Á´¤Æ¤Î¥¯¥é¥¹¤Ç¡¢¤½¤Î¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò¥·¥ê¥¢¥é¥¤¥º¤ä¥Ç¥·¥ê¥¢¥é¥¤¥º¤Î ½èÍý¤ÎÅÓÃæ¤Ç¸Æ¤Ð¤ì¤ë¥Õ¥Ã¥¯¤òÄêµÁ¤¹¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£¤½¤ì¤é¤Î¥Õ¥Ã¥¯¤Ï @@ -234,72 +602,201 @@ ¡Ê¤½¤Î¤¿¤á¡¢ÂФˤʤë¥Ç¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤â¡¢¤½¤Î¤è¤¦¤Ë¿¶Éñ¤ï¤Ê¤±¤ì¤Ð ¤Ê¤ê¤Þ¤»¤ó¡Ë +=begin original + +Since we said earlier: + +=end original + Á°½Ò¤ÎÄ̤ê: dclone(.) = thaw(freeze(.)) +=begin original + +everything we say about hooks should also hold for deep cloning. However, +hooks get to know whether the operation is a mere serialization, or a cloning. + +=end original + ¥Õ¥Ã¥¯¤Ë¤Ä¤¤¤Æ½Ò¤Ù¤¿¤³¤È¤Ï¤¹¤Ù¤Æ¡¢¿¼¤¤¥¯¥í¡¼¥óºîÀ®¤Ë¤âÅö¤Æ¤Ï¤Þ¤ê¤Þ¤¹¡£ ¤·¤«¤·¥Õ¥Ã¥¯¤Ë¤Ï¡¢¤½¤Î½èÍý¤¬Ã±¤Ê¤ë¥·¥ê¥é¥¤¥¼¡¼¥·¥ç¥ó¤Ê¤Î¤«¥¯¥í¡¼¥ó¤Ê¤Î¤«¤¬ ¤ï¤«¤ê¤Þ¤¹¡£ +=begin original + +Therefore, when serializing hooks are involved, + +=end original + ¤³¤Î¤¿¤á¡¢¥·¥ê¥¢¥é¥¤¥º²½¤Î¥Õ¥Ã¥¯¤¬¸Æ¤Ó½Ð¤µ¤ì¤ë¤È¤Ë¤Ê¤ê¤Þ¤¹¡£ dclone(.) <> thaw(freeze(.)) +=begin original + +Well, you could keep them in sync, but there's no guarantee it will always +hold on classes somebody else wrote. Besides, there is little to gain in +doing so: a serializing hook could keep only one attribute of an object, +which is probably not what should happen during a deep cloning of that +same object. + +=end original + Ʊ´ü¤ò¼è¤ë¤³¤È¤â¤Ç¤¤Þ¤¹¡£¤·¤«¤·Ã¯¤«Â¾¤Î¿Í¤¬½ñ¤¤¤¿¥¯¥é¥¹¤Ë¤Ä¤¤¤Æ¾ï¤Ë Åö¤Æ¤Ï¤Þ¤ë¤è¤¦¤ÊÊݾڤϤ¢¤ê¤Þ¤»¤ó¡£¤µ¤é¤Ë¡¢¤½¤¦¤¹¤ë¤³¤È¤Ë¤è¤Ã¤ÆÆÀ¤é¤ì¤ë¤â¤Î¤Ï ¤¢¤Þ¤ê¤¢¤ê¤Þ¤»¤ó:¥·¥ê¥¢¥é¥¤¥º¤Î¥Õ¥Ã¥¯¤Ï¡¢¤¢¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Î£±¤Ä¤Î°À¤ò ÊÝ»ý¤¹¤ë¤³¤È¤À¤±¤¬¤Ç¤¤Þ¤¹¡£¤½¤ì¤Ï¡¢¤½¤ÎƱ¤¸¥ª¥Ö¥¸¥§¥¯¥È¤Î¿¼¤¤Ê£¼Ì¤Î´Ö¤Ëµ¯¤¤ë ¤³¤È¤È¤Ï¿ʬ¡¢°ã¤¤¤Þ¤¹¡£ +=begin original + +Here is the hooking interface: + +=end original + °Ê²¼¤Ë¥Õ¥Ã¥¯¤Î¥¤¥ó¥¿¡¼¥Õ¥§¥¤¥¹¤ò¼¨¤·¤Þ¤¹¡§ =over 4 =item C<STORABLE_freeze> I<obj>, I<cloning> +=begin original + +The serializing hook, called on the object during serialization. It can be +inherited, or defined in the class itself, like any other method. + +=end original + ¥·¥ê¥¢¥é¥¤¥º²½¥Õ¥Ã¥¯¡£¥ª¥Ö¥¸¥§¥¯¥È¤¬¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤ë¤È¤¤Ë¸Æ¤Ð¤ì¤Þ¤¹¡£ ¤³¤ì¤Ï¾¤Î¥á¥½¥Ã¥É¤ÈƱÍͤ˷Ѿµ¤·¤¿¤ê¡¢¥¯¥é¥¹¤ÎÃæ¤ÇºÆÄêµÁ¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ +=begin original + +Arguments: I<obj> is the object to serialize, I<cloning> is a flag indicating +whether we're in a dclone() or a regular serialization via store() or freeze(). + +=end original + °ú¿ô:I<obj>¤Ï¥·¥ê¥¢¥é¥º¤¹¤ë¥ª¥Ö¥¸¥§¥¯¥È¡¢I<cloning>¤Ïdclone()¤ÎÃæ¤Ç¤¢¤ë¤«¡¢ store()¤äfreeze()¤ò·Ðͳ¤·¤¿Ä̾ï¤Î¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤«¤ò¼¨¤·¤Þ¤¹¡£ +=begin original + +Returned value: A LIST C<($serialized, $ref1, $ref2, ...)> where $serialized +is the serialized form to be used, and the optional $ref1, $ref2, etc... are +extra references that you wish to let the Storable engine serialize. + +=end original + Ìá¤êÃÍ:¥ê¥¹¥È C<($serialized, $ref1, $ref2, ...) >¡£ $serialized ¤Ï¡¢ »È¤ï¤ì¤ë¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿·Á¼°¡¢¥ª¥×¥·¥ç¥ó¤Î$ref1¡¢$ref2¤Ê¤É¤Ï¡¢ Storable¥¨¥ó¥¸¥ó¤Ë¥·¥ê¥¢¥é¥º¤µ¤»¤¿¤¤ÆÃÊ̤ʥê¥Õ¥¡¥ì¥ó¥¹¤Ç¤¹¡£ +=begin original + +At deserialization time, you will be given back the same LIST, but all the +extra references will be pointing into the deserialized structure. + +=end original + ¥Ç¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤Î¤È¤¤Ë¤Ï¡¢¤¢¤Ê¤¿¤ÏƱ¤¸¥ê¥¹¥È(LIST)¤¬Í¿¤¨¤é¤ì¤Þ¤¹¡£ ¤·¤«¤·ÆÃÊ̤ʥê¥Õ¥¡¥ì¥ó¥¹¤ÏÁ´¤Æ¥Ç¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿¹½Â¤ÂΤò¼¨¤·¤Þ¤¹¡£ +=begin original + +The B<first time> the hook is hit in a serialization flow, you may have it +return an empty list. That will signal the Storable engine to further +discard that hook for this class and to therefore revert to the default +serialization of the underlying Perl data. The hook will again be normally +processed in the next serialization. + +=end original + B<ºÇ½é¤Ë>¥Õ¥Ã¥¯¤¬¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤Îή¤ì¤ÎÃæ¤Ç¥Ò¥Ã¥È¤·¤¿¤È¤¡¢ ¤¢¤Ê¤¿¤Ï¶õ¤Î¥ê¥¹¥È¤òÊÖ¤¹¤³¤È¤¬¤Ç¤¤Þ¤¹¡£¤½¤ì¤Ï¤³¤Î¥¯¥é¥¹¤Î¤¿¤á¤Î¥Õ¥Ã¥¯¤ò¡¢ ¤½¤ì¤«¤éÀè¡¢¼Î¤Æ¤é¤ë¤è¤¦Storable¥¨¥ó¥¸¥ó¤Ë¹ç¿Þ¤·¡¢¤³¤Î¤¿¤á¸µ¤Ë¤Ê¤Ã¤Æ¤¤¤ë Perl¥Ç¡¼¥¿¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤ËÌá¤ê¤Þ¤¹¡£¤½¤Î¥Õ¥Ã¥¯¤Ï¼¡¤Î ¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤Ç¤ÏºÆ¤ÓÄ̾ïÄ̤ê½èÍý¤µ¤ì¤Þ¤¹¡£ -¤è¤¯Ê¬¤«¤é¤Ê¤±¤ì¤Ð¡¢dclone()¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤Ç¤â¹çÍýŪ¤Ë¤Ê¤ë¤è¤¦¡¢¥·¥ê¥¢¥é¥¤¥º¤Î +=begin original + +Unless you know better, serializing hook should always say: + +=end original + +¤è¤¯Ê¬¤«¤é¤Ê¤±¤ì¤Ð¡¢¥·¥ê¥¢¥é¥¤¥º¤Î ¥Õ¥Ã¥¯¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¤Ù¤¤Ç¤¹¡§ +=begin original + + sub STORABLE_freeze { + my ($self, $cloning) = @_; + return if $cloning; # Regular default serialization + .... + } + +=end original + sub STORABLE_freeze { my ($self, $cloning) = @_; return if $cloning; # Ä̾ï¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó .... } +=begin original + +in order to keep reasonable dclone() semantics. + +=end original + +dclone()¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤Ç¤â¹çÍýŪ¤Ë¤Ê¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£ =item C<STORABLE_thaw> I<obj>, I<cloning>, I<serialized>, ... +=begin original + +The deserializing hook called on the object during deserialization. +But wait: if we're deserializing, there's no object yet... right? + +=end original + ¥ª¥Ö¥¸¥§¥¯¥È¤¬¥Ç¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤ë¤È¤¤Ë¸Æ¤Ð¤ì¤ë¥Ç¥·¥ê¥¢¥é¥¤¥º²½¥Õ¥Ã¥¯¡£ ¤·¤«¤·ÂԤäƤ¯¤À¤µ¤¤: ¤â¤·¥Ç¥·¥ê¥¢¥é¥¤¥º¤·¤Æ¤¤¤ë¤Î¤Ç¤¢¤ì¤Ð¡¢ ¥ª¥Ö¥¸¥§¥¯¥È¤Ï¤Þ¤À¤Ê¤¤¤Î¤Ç¤Ï...¡© +=begin original + +Wrong: the Storable engine creates an empty one for you. If you know Eiffel, +you can view C<STORABLE_thaw> as an alternate creation routine. + +=end original + °ã¤¤¤Þ¤¹¡§Storable¥¨¥ó¥¸¥ó¤Ï¤¢¤Ê¤¿¤Î¤¿¤á¤Ë¶õ¤Î¤â¤Î¤òÀ¸À®¤·¤Þ¤¹¡£ Eiffel¤ò¤´Â¸ÃΤǤ¢¤ì¤Ð¡¢C<STORABLE_thaw>¤ÏÂåÂØÀ¸À®¥ë¡¼¥Á¥ó¤È¤·¤Æ ¤ß¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£ +=begin original + +This means the hook can be inherited like any other method, and that +I<obj> is your blessed reference for this particular instance. + +=end original + ¤Ä¤Þ¤ê¡¢¥Õ¥Ã¥¯¤Ï¾¤Î¥á¥½¥Ã¥É¤ÈƱ¤¸¤è¤¦¤Ë·Ñ¾µ¤¹¤ë¤³¤È¤¬¤Ç¤¡¢ C<obj>¤Ï¤³¤ÎÆÃÄê¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Î¤¿¤á¤Îbless¤µ¤ì¤¿¥ê¥Õ¥¡¥ì¥ó¥¹¤Ë¤Ê¤ê¤Þ¤¹¡£ +=begin original + +The other arguments should look familiar if you know C<STORABLE_freeze>: +I<cloning> is true when we're part of a deep clone operation, I<serialized> +is the serialized string you returned to the engine in C<STORABLE_freeze>, +and there may be an optional list of references, in the same order you gave +them at serialization time, pointing to the deserialized objects (which +have been processed courtesy of the Storable engine). + +=end original + ¤½¤Î¾¤Î°ú¿ô¤ÏC<STORABLE_freeze>¤òÃΤäƤ¤¤ì¤Ð´·¤ì¤Æ¤¤¤ë¤Ç¤·¤ç¤¦:¿¼¤¤ ¥¯¥í¡¼¥ó½èÍý¤Î°ìÉô¤Ç¤¢¤ì¤ÐI<cloning>¤Ïtrue¤Ë¤Ê¤ê¤Þ¤¹¡£I<serialized>¤Ï I<STORABLE_freeze>¤Ç¥¨¥ó¥¸¥ó¤ËÊÖ¤·¤¿¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿Ê¸»úÎó¤Ç¤¹¡£ @@ -307,6 +804,17 @@ ¤½¤ì¤Ï¥·¥ê¥¢¥ë²½¤Î¤È¤¤Ë¤¢¤Ê¤¿¤¬Í¿¤¨¤¿½çÈ֤ǡ¢¥Ç¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿ ¥ª¥Ö¥¸¥§¥¯¥È¤ò»Ø¤·¤Þ¤¹¡Ê¤½¤ì¤é¤ÏStorable¥¨¥ó¥¸¥ó¤Ë¤è¤Ã¤ÆÆÃÊ̤˰·¤ï¤ì¤Þ¤¹¡Ë +=begin original + +When the Storable engine does not find any C<STORABLE_thaw> hook routine, +it tries to load the class by requiring the package dynamically (using +the blessed package name), and then re-attempts the lookup. If at that +time the hook cannot be located, the engine croaks. Note that this mechanism +will fail if you define several classes in the same file, but L<perlmod> +warned you. + +=end original + Storable¥¨¥ó¥¸¥ó¤¬²¿¤âSTORABLE_thaw¥Õ¥Ã¥¯¡¦¥ë¡¼¥Á¥ó¤ò¸«¤Ä¤±¤é¤ì¤Ê¤±¤ì¤Ð¡¢ ¤½¤ì¤ÏưŪ¤Ë¥Ñ¥Ã¥±¡¼¥¸¤ò¡Êbless¤µ¤ì¤¿¥Ñ¥Ã¥±¡¼¥¸Ì¾¤ò»È¤Ã¤Æ¡Ërequire¤¹¤ë¤³¤È¤Ë¤è¤ê ¥í¡¼¥É¤·¤è¤¦¤È¤·¤Þ¤¹¡£¤½¤·¤ÆºÆ¤Ó»²¾È¤·¤è¤¦¤È¤·¤Þ¤¹¡£¤â¤·¤³¤Î»þÅÀ¤Ç @@ -314,13 +822,34 @@ ¤¤¤¯¤Ä¤â¤Î¥¯¥é¥¹¤òÄêµÁ¤·¤Æ¤¤¤ë¤È¤¦¤Þ¤¯¤¤¤¤Þ¤»¤ó¡£¤·¤«¤·L<perlmod>¤¬·Ù¹ð ¤¹¤ë¤Ç¤·¤ç¤¦¡£ +=begin original + +It is up to you to use this information to populate I<obj> the way you want. + +=end original + ¤³¤ì¤é¤Î¾ðÊó¤ò»È¤Ã¤Æ¡¢¤É¤Î¤è¤¦¤ËI<obj>¤òºîÀ®¤¹¤ë¤«¤Ï¡¢¤¢¤Ê¤¿¼¡Âè¤Ç¤¹¡£ +=begin original + +Returned value: none. + +=end original + Ìá¤êÃÍ:¤¢¤ê¤Þ¤»¤ó¡£ =back -=head2 ½Ò¸ì +=head2 Predicates + +(½Ò¸ì) + +=begin original + +Predicates are not exportable. They must be called by explicitly prefixing +them with the Storable package name. + +=end original ½Ò¸ì¡ÊPredicates)¤Ï¥¨¥¯¥¹¥Ý¡¼¥È²Äǽ¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£¤½¤ì¤é¤ÏStorable¥Ñ¥Ã¥±¡¼¥¸Ì¾¤ò ÌÀ¼¨Åª¤ËÁ°¤Ë¤Ä¤±¤Æ¸Æ¤Ó½Ð¤µ¤ì¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ @@ -329,39 +858,94 @@ =item C<Storable::last_op_in_netorder> +=begin original + +The C<Storable::last_op_in_netorder()> predicate will tell you whether +network order was used in the last store or retrieve operation. If you +don't know how to use this, just forget about it. + +=end original + ½Ò¸ìC<Storable::last_op_in_netorder()>¤Ï¡¢ºÇ¸å¤Îstore¤¢¤ë¤¤¤ÏretrieveÁàºî¤Î¤µ¤¤ ¥Í¥Ã¥È¥ï¡¼¥¯¡¦¥ª¡¼¥À¡¼¤Ç¤¢¤Ã¤¿¤«¤ò¼¨¤·¤Þ¤¹¡£¤â¤·¤³¤Î»È¤¤Êý¤¬¤ï¤«¤é¤Ê¤±¤ì¤Ð¡¢ ˺¤ì¤Æ¤¯¤À¤µ¤¤¡£ =item C<Storable::is_storing> +=begin original + +Returns true if within a store operation (via STORABLE_freeze hook). + +=end original + (STORABLE_freeze¥Õ¥Ã¥¯¤ò·Ðͳ¤·¤Æ)storeÁàºî¤ÎÃæ¤Ç¤¢¤ì¤Ðtrue¤òÊÖ¤·¤Þ¤¹¡£ =item C<Storable::is_retrieving> +=begin original + +Returns true if within a retrieve operation (via STORABLE_thaw hook). + +=end original + (STORABLE_thaw¥Õ¥Ã¥¯¤ò·Ðͳ¤·¤Æ)retrieveÁàºî¤ÎÃæ¤Ç¤¢¤ì¤Ðtrue¤òÊÖ¤·¤Þ¤¹¡£ =back -=head2 ºÆµ¢ +=head2 Recursion + +(ºÆµ¢) + +=begin original + +With hooks comes the ability to recurse back to the Storable engine. +Indeed, hooks are regular Perl code, and Storable is convenient when +it comes to serializing and deserializing things, so why not use it +to handle the serialization string? + +=end original ¥Õ¥Ã¥¯¤Ë¤è¤Ã¤ÆStorable¥¨¥ó¥¸¥ó¤ËºÆµ¢Åª¤ËÌá¤Ã¤Æ¤¯¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£ ¼ÂºÝ¡¢¥Õ¥Ã¥¯¤ÏÄ̾ï¤ÎPerl¥³¡¼¥É¤Ç¤¹¡£¤½¤·¤ÆStorable¤Ï¡¢¤¢¤ë¤â¤Î¤ò¥·¥ê¥¢¥é¥¤¥º ¤·¤¿¤ê¥Ç¥·¥ê¥¢¥é¥¤¥º¤¹¤ë¤È¤¤ËÊØÍø¤Ç¤¹¡£¤½¤ì¤Ê¤é¤Ð¡¢¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿ ʸ»úÎó¤ò°·¤¦¤¿¤á¤Ë¡¢¤½¤ì¤ò»È¤Ã¤Æ¤¤¤±¤Ê¤¤¤Ê¤ó¤Æ¤³¤È¤¢¤ë¤ó¤Ç¤·¤ç¤¦¤«¡© +=begin original + +There are a few things you need to know, however: + +=end original + ¤·¤«¤·¤¤¤¯¤Ä¤«³Ð¤¨¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¤³¤È¤¬¤¢¤ê¤Þ¤¹: =over 4 =item * +=begin original + +You can create endless loops if the things you serialize via freeze() +(for instance) point back to the object we're trying to serialize in +the hook. + +=end original + ¤â¤·freeze()¤Ç¥·¥ê¥¢¥é¥¤¥º¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¤â¤Î¤¬¡¢¡ÊÎ㤨¤Ð¡Ë¥Õ¥Ã¥¯¤ÎÃæ¤Ç ¥·¥ê¥¢¥é¥¤¥º¤·¤è¤¦¤È¤·¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥È¤ò»Ø¤·¤Æ¤¤¤ë¤È¤¹¤ë¤È̵¸Â¥ë¡¼¥×¤ò ºî¤Ã¤Æ¤·¤Þ¤¦¤«¤â¤·¤ì¤Þ¤»¤ó¡£ =item * +=begin original + +Shared references among objects will not stay shared: if we're serializing +the list of object [A, C] where both object A and C refer to the SAME object +B, and if there is a serializing hook in A that says freeze(B), then when +deserializing, we'll get [A', C'] where A' refers to B', but C' refers to D, +a deep clone of B'. The topology was not preserved. + +=end original + ¥ª¥Ö¥¸¥§¥¯¥È´Ö¤Ç¶¦Í¤µ¤ì¤ë»²¾È¤Ï¶¦Í¤µ¤ì¤Ê¤¯¤Ê¤ê¤Þ¤¹:¥ª¥Ö¥¸¥§¥¯¥ÈA¤ÈC¤ÎξÊý¤¬ Ʊ¤¸¥ª¥Ö¥¸¥§¥¯¥ÈB¤ò»²¾È¤·¤Æ¤¤¤ë¤È¤¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Î¥ê¥¹¥È[A, C]¤ò¥·¥ê¥¢¥é¥¤¥º¤·¡¢ ¤½¤·¤ÆA¤Ëfreeze(B)¤È½ñ¤¤¤Æ¤¢¤ë¥·¥ê¥¢¥é¥¤¥º¤Î¤¿¤á¤Î¥Õ¥Ã¥¯¤¬¤¢¤ë¤Ê¤Ð¡¢¡¢ @@ -370,21 +954,60 @@ =back +=begin original + +That's why C<STORABLE_freeze> lets you provide a list of references +to serialize. The engine guarantees that those will be serialized in the +same context as the other objects, and therefore that shared objects will +stay shared. + +=end original + ¤³¤Î¤¿¤á¤ËC<STORABLE_freeze>¤Ï¥·¥ê¥¢¥é¥¤¥º¤¹¤ë¥ê¥Õ¥¡¥ì¥ó¥¹¤Î¥ê¥¹¥È¤òÄ󶡤µ¤»¤Æ ¤¤¤ë¤Î¤Ç¤¹¡£¥¨¥ó¥¸¥ó¤Ï¾¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ÈƱ¤¸¥³¥ó¥Æ¥¥¹¥È¤ÎÃæ¤Ç¡¢¤½¤ì¤é¤¬ ¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤ë¤³¤È¤ò¡¢¤½¤Î¤¿¤á¶¦Í¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Ï¶¦Í¤µ¤ì¤¿¤Þ¤Þ¤Ë ¤Ê¤ë¤³¤È¤òÊݾڤ·¤Þ¤¹¡£ +=begin original + +In the above [A, C] example, the C<STORABLE_freeze> hook could return: + +=end original + ¾åµ¤Î[A, C]¤ÎÎã¤Ç¤Ï¡¢C<STORABLE_freeze>¥Õ¥Ã¥¯¤Ï°Ê²¼¤Î¤è¤¦¤ËÊÖ¤¹¤³¤È¤¬¤Ç¤¤Þ¤¹: - ("something", $self->{B}) + ("something", $self->{B}) + +=begin original + +and the B part would be serialized by the engine. In C<STORABLE_thaw>, you +would get back the reference to the B' object, deserialized for you. + +=end original ¤½¤·¤ÆBÉôʬ¤Ï¥¨¥ó¥¸¥ó¤Ë¤è¤Ã¤Æ¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤Þ¤¹¡£C<STORABLE_thaw>¤Ç¤Ï¡¢ ¥Ç¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤¿B'¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤ò¼èÆÀ¤¹¤ë¤Ç¤·¤ç¤¦¡£ +=begin original + +Therefore, recursion should normally be avoided, but is nonetheless supported. + +=end original + ¤³¤Î¤¿¤áºÆµ¢¤ÏÄ̾ï¤ÏÈò¤±¤é¤ì¤ë¤Ï¤º¤Ç¤¹¡£¤·¤«¤·¤½¤ì¤Ç¤â¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ -=head2 ¿¼¤¤¥¯¥í¡¼¥óºîÀ® +=head2 Deep Cloning + +(¿¼¤¤¥¯¥í¡¼¥óºîÀ®) + +=begin original + +There is a Clone module available on CPAN which implements deep cloning +natively, i.e. without freezing to memory and thawing the result. It is +aimed to replace Storable's dclone() some day. However, it does not currently +support Storable hooks to redefine the way deep cloning is performed. + +=end original CPAN¤«¤é¡¢¿¼¤¤¥¯¥í¡¼¥óºîÀ®¤ò¥Í¥¤¥Æ¥£¥Ö¤Ë¡¢¤Ä¤Þ¤ê¥á¥â¥ê¾å¤Ë¸Ç¤á¡¢ ¤½¤Î·ë²Ì¤ò²òÅह¤ë¤³¤È¤¬¤Ê¤·¤Ë¼ÂÁõ¤¹¤ë¿·¤·¤¤Clone¥â¥¸¥å¡¼¥ë¤¬ÍøÍѤǤ¤Þ¤¹¡£ @@ -392,7 +1015,26 @@ ¤·¤«¤·¡¢¼Â¹Ô¤µ¤ì¤ë¿¼¤¤¥¯¥í¡¼¥óºîÀ®¤ÎÊýË¡¤òºÆÄêµÁ¤¹¤ë¤¿¤á¤ÎStorable¥Õ¥Ã¥¯¤Ï¡¢ ¤Þ¤À¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£ -=head1 Storable¤Îmagic +=head1 Storable magic + +(Storable¤Îmagic) + +=begin original + +Yes, there's a lot of that :-) But more precisely, in UNIX systems +there's a utility called C<file>, which recognizes data files based on +their contents (usually their first few bytes). For this to work, +a certain file called F<magic> needs to taught about the I<signature> +of the data. Where that configuration file lives depends on the UNIX +flavour; often it's something like F</usr/share/misc/magic> or +F</etc/magic>. Your system administrator needs to do the updating of +the F<magic> file. The necessary signature information is output to +STDOUT by invoking Storable::show_file_magic(). Note that the GNU +implementation of the C<file> utility, version 3.38 or later, +is expected to contain support for recognising Storable files +out-of-the-box, in addition to other kinds of Perl files. + +=end original ¤½¤¦¡¢¤½¤ì¤Ï¤¿¤¯¤µ¤ó:-)¡£¤·¤«¤·¤è¤êÀµ³Î¤Ë¤Ï¡¢UNIX¥·¥¹¥Æ¥à¤Ç¤ÏC<file>¤È ¸Æ¤Ð¤ì¤ë¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤¬¤¢¤ê¤Þ¤¹¡£¤½¤ì¤Ï¤½¤ÎÆâÍÆ¡ÊÄ̾ï¤Ï¤½¤ÎÀèƬ¤Î¿ô¥Ð¥¤¥È¡Ë¤ò @@ -405,48 +1047,95 @@ GNU¤Î¼ÂÁõ¤Ë¤Ï¡¢Â¾¤Î¼ïÎà¤ÎPerl¥Õ¥¡¥¤¥ë¤Ë²Ã¤¨¤Æ¡¢Stoable¥Õ¥¡¥¤¥ë¤òɾ²Á¤¹¤ë¤¿¤á¤Î ¥µ¥Ý¡¼¥È¤¬Æþ¤Ã¤Æ¤¤¤ë¤È´üÂÔ¤¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£ -=head1 »ÈÍÑÎã +=head1 EXAMPLES + +=begin original + +Here are some code samples showing a possible usage of Storable: + +=end original Storable¤Î»ÈÍÑË¡¤ò¼¨¤¹¥³¡¼¥É¡¦¥µ¥ó¥×¥ë¤ò°Ê²¼¤Ë¼¨¤·¤Þ¤¹: - use Storable qw(store retrieve freeze thaw dclone); + use Storable qw(store retrieve freeze thaw dclone); + + %color = ('Blue' => 0.1, 'Red' => 0.8, 'Black' => 0, 'White' => 1); + + store(\%color, '/tmp/colors') or die "Can't store %a in /tmp/colors!\n"; + + $colref = retrieve('/tmp/colors'); + die "Unable to retrieve from /tmp/colors!\n" unless defined $colref; + printf "Blue is still %lf\n", $colref->{'Blue'}; - %color = ('Blue' => 0.1, 'Red' => 0.8, 'Black' => 0, 'White' => 1); + $colref2 = dclone(\%color); - store(\%color, '/tmp/colors') or die "Can't store %a in /tmp/colors!\n"; + $str = freeze(\%color); + printf "Serialization of %%color is %d bytes long.\n", length($str); + $colref3 = thaw($str); - $colref = retrieve('/tmp/colors'); - die "Unable to retrieve from /tmp/colors!\n" unless defined $colref; - printf "Blue is still %lf\n", $colref->{'Blue'}; +=begin original - $colref2 = dclone(\%color); +which prints (on my machine): - $str = freeze(\%color); - printf "Serialization of %%color is %d bytes long.\n", length($str); - $colref3 = thaw($str); +=end original ¡Ê»ä¤Î¥Þ¥·¥ó¤Ç¤Î¡Ë½ÐÎÏ·ë²Ì¡§ - Blue is still 0.100000 - Serialization of %color is 102 bytes long. + Blue is still 0.100000 + Serialization of %color is 102 bytes long. + +=begin original + +Serialization of CODE references and deserialization in a safe +compartment: + +=end original Safe¥³¥ó¥Ý¡¼¥Í¥ó¥ÈÆâ¤Ç¤Î¥³¡¼¥É(CODE)¥ê¥Õ¥¡¥ì¥ó¥¹¤Î¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó¤È ¥Ç¥·¥ê¥¢¥é¥¤¥¼¡¼¥·¥ç¥ó: - use Storable qw(freeze thaw); - use Safe; - use strict; - my $safe = new Safe; - # opcode¤ò"require"¤¹¤ë¤³¤È¤òµö¤¹¤³¤È¤Ï"use strict"¤ò»È¤¦»þ¤Ë¤Ïɬ¿Ü¤Ç¤¹ - $safe->permit(qw(:default require)); - local $Storable::Deparse = 1; - local $Storable::Eval = sub { $safe->reval($_[0]) }; - my $serialized = freeze(sub { print "42\n" }); - my $code = thaw($serialized); - $code->(); # prints 42 +=begin original -=head1 ·Ù¹ð + use Storable qw(freeze thaw); + use Safe; + use strict; + my $safe = new Safe; + # permitting the "require" opcode is necessary when using "use strict" + $safe->permit(qw(:default require)); + local $Storable::Deparse = 1; + local $Storable::Eval = sub { $safe->reval($_[0]) }; + my $serialized = freeze(sub { print "42\n" }); + my $code = thaw($serialized); + $code->(); # prints 42 + +=end original + + use Storable qw(freeze thaw); + use Safe; + use strict; + my $safe = new Safe; + # opcode¤ò"require"¤¹¤ë¤³¤È¤òµö¤¹¤³¤È¤Ï"use strict"¤ò»È¤¦»þ¤Ë¤Ïɬ¿Ü¤Ç¤¹ + $safe->permit(qw(:default require)); + local $Storable::Deparse = 1; + local $Storable::Eval = sub { $safe->reval($_[0]) }; + my $serialized = freeze(sub { print "42\n" }); + my $code = thaw($serialized); + $code->(); # prints 42 + + +=head1 WARNING + +=begin original + +If you're using references as keys within your hash tables, you're bound +to be disappointed when retrieving your data. Indeed, Perl stringifies +references used as hash table keys. If you later wish to access the +items via another reference stringification (i.e. using the same +reference that was used for the key originally to record the value into +the hash table), it will work because both references stringify to the +same string. +=end original ¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤Î¥¡¼¤È¤·¤Æ¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤Ã¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢¥Ç¡¼¥¿¤ò ¼è¤ê½Ð¤·¤¿¤È¤¤Ë¥¬¥Ã¥«¥ê¤¹¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£¼ÂºÝ¤Î¤È¤³¤íPerl¤Ï @@ -456,14 +1145,42 @@ Ʊ¤¸¥ê¥Õ¥¡¥ì¥ó¥¹¤ò»È¤Ã¤Æ¡ËÍ×ÁǤ˥¢¥¯¥»¥¹¤·¤¿¤±¤ì¤Ð¡¢Î¾Êý¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤¬ ʸ»úÎ󲽤µ¤ì¤¿¤â¤Î¤¬Æ±¤¸Ê¸»úÎó¤Ê¤Î¤Çµ¡Ç½¤·¤Þ¤¹¡£ +=begin original + +It won't work across a sequence of C<store> and C<retrieve> operations, +however, because the addresses in the retrieved objects, which are +part of the stringified references, will probably differ from the +original addresses. The topology of your structure is preserved, +but not hidden semantics like those. + +=end original + ¤·¤«¤·¡¢C<store>¤ÈC<retieve>Áàºî¤ò¤Þ¤¿¤°¤ÈÆ°¤¤Þ¤»¤ó¡£¤Ê¤¼¤Ê¤é¼è¤ê¹þ¤Þ¤ì¤¿ ¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤Î¥¢¥É¥ì¥¹¡Êʸ»úÎ󲽤µ¤ì¤¿¥ê¥Õ¥¡¥ì¥ó¥¹¤Î°ìÉô¤Ç¤¹¡Ë¤¬¡¢ ¤ª¤½¤é¤¯¸µ¤Î¥¢¥É¥ì¥¹¤È¤Ï°ã¤Ã¤Æ¤¤¤ë¤«¤é¤Ç¤¹¡£¹½Â¤ÂΤηÁ¤ÏÊÝ»ý¤µ¤ì¤Þ¤¹¤¬¡¢ ¤³¤Î¤è¤¦¤Ê±£¤µ¤ì¤¿°ÕÌ£¤ÏÊݸ¤µ¤ì¤Þ¤»¤ó¡£ +=begin original + +On platforms where it matters, be sure to call C<binmode()> on the +descriptors that you pass to Storable functions. + +=end original + ÌäÂê¤È¤Ê¤ë¥×¥é¥Ã¥È¥Û¡¼¥à¤Ç¤Ï¡¢Storable´Ø¿ô¤ËÅϤ¹µ½Ò»Ò¤ËC<binmode>¤ò ¸Æ¤Ö¤è¤¦¤Ë¤·¤Æ²¼¤µ¤¤¡£ +=begin original + +Storing data canonically that contains large hashes can be +significantly slower than storing the same data normally, as +temporary arrays to hold the keys for each hash have to be allocated, +populated, sorted and freed. Some tests have shown a halving of the +speed of storing -- the exact penalty will depend on the complexity of +your data. There is no slowdown on retrieval. + +=end original + ¥Ç¡¼¥¿¤òµ¬ÈÏ·Á¼°¤Ç³ÊǼ¤¹¤ë¤È¡¢Â礤ʥϥå·¥å¤Ç¤ÏÄ̾ï¤Ë¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë¤Î¤Ë Èæ¤Ù¤ÆÈó¾ï¤ËÃÙ¤¯¤Ê¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£¤È¤¤¤¦¤Î¤â³Æ¥Ï¥Ã¥·¥å¤Î¤¿¤á¤Î¥¡¼¤ò ÊÝ»ý¤¹¤ë¤¿¤á¤Î°ì»þŪ¤ÊÇÛÎó¤òÀêͤ·¡¢À¸¤±ä¤Ó¤µ¤»¡¢¥½¡¼¥È¤·¡¢²òÊü¤·¤Ê¤±¤ì¤Ð @@ -471,26 +1188,75 @@ ¤É¤ì¤¯¤é¤¤ÃÙ¤¯¤Ê¤ë¤«¤Ï¥Ç¡¼¥¿¤ÎÊ£»¨¤µ¤Ë°Í¸¤·¤Þ¤¹¡£¼è¹þ¤Ç¤ÏÃÙ¤¯¤Ê¤ë¤³¤È¤Ï ¤¢¤ê¤Þ¤»¤ó¡£ -=head1 ¥Ð¥° +=head1 BUGS + +=begin original + +You can't store GLOB, CODE, FORMLINE, etc.... If you can define +semantics for those operations, feel free to enhance Storable so that +it can deal with them. + +=end original GLOB, CODE, FORMLINEÅù¤Ï³ÊǼ¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£¤³¤ì¤é¤ÎÁàºî¤Î¤¿¤á¤Î °ÕÌ£¤ò¤Ï¤Ã¤¤ê·è¤á¤¿¤é¡¢¤½¤ì¤é¤ò°·¤¨¤ë¤è¤¦¼«Í³¤ËStorable¤ò³ÈÄ¥¤·¤Æ²¼¤µ¤¤¡£ +=begin original + +The store functions will C<croak> if they run into such references +unless you set C<$Storable::forgive_me> to some C<TRUE> value. In that +case, the fatal message is turned in a warning and some +meaningless string is stored instead. + +=end original + store´Ø¿ô¤Ï¡¢C<$Strable::forgive_me>¤ò¤Ê¤ó¤é¤«¤ÎC<TRUE>ÃͤËÀßÄꤷ¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¡¢ ¤½¤ì¤é¤Î¥ê¥Õ¥¡¥ì¥ó¥¹¤ËƧ¤ß¹þ¤à¤ÈC<croak>¤·¤Þ¤¹¡£¤½¤Î¾ì¹ç¡¢·Ù¹ð¤ÇÃ×̿Ū¤Ê ¥á¥Ã¥»¡¼¥¸¤¬ÊÖ¤µ¤ì¡¢Âå¤ï¤ê¤Ë°ÕÌ£¤Î¤Ê¤¤Ê¸»úÎ󤬳ÊǼ¤µ¤ì¤Þ¤¹¡£ +=begin original + +Setting C<$Storable::canonical> may not yield frozen strings that +compare equal due to possible stringification of numbers. When the +string version of a scalar exists, it is the form stored; therefore, +if you happen to use your numbers as strings between two freezing +operations on the same data structures, you will get different +results. + +=end original + C<$Storable::canonical>¤òÀßÄꤹ¤ë¤È¡¢¿ôÃͤ¬Ê¸»úÎ󲽤µ¤ì¤ë²ÄǽÀ¤«¤é Ʊ¤¸¤â¤Î¤Ç¤¢¤ë¤ÈÈæ³Ó¤µ¤ì¤ë¸Ç¤á¤é¤ì¤¿Ê¸»úÎó¤òºî¤ê½Ð¤µ¤Ê¤¤¤«¤â¤·¤ì¤Þ¤»¤ó¡£ ¥¹¥«¥é¡¼¤Îʸ»úÎó¥Ð¡¼¥¸¥ç¥ó¤¬Â¸ºß¤¹¤ë¤È¤¤Ë¤Ï¡¢¤½¤ì¤¬³ÊǼ¤µ¤ì¤ë·Á¼°¤Ë ¤Ê¤ê¤Þ¤¹¡£¤³¤Î¤¿¤á¡¢¤â¤·Æ±¤¸¥Ç¡¼¥¿¹½Â¤¤Î2²ó¸Ç¤á¤ëÁàºî¤ò¤¹¤ë´Ö¤Ë¡¢ ¤¿¤Þ¤¿¤Þ¿ôÃͤòʸ»úÎó¤È¤·¤Æ»È¤Ã¤Æ¤·¤Þ¤¦¤È¡¢°ã¤¦·ë²Ì¤Ë¤Ê¤ê¤Þ¤¹¡£ +=begin original + +When storing doubles in network order, their value is stored as text. +However, you should also not expect non-numeric floating-point values +such as infinity and "not a number" to pass successfully through a +nstore()/retrieve() pair. + +=end original + double(ÇÜÀºÅÙÉâÆ°¾®¿ôÅÀ¡Ë¤ò¥Í¥Ã¥È¥ï¡¼¥¯Íͼ°¤Ç³ÊǼ¤¹¤ë¤È¤¡¢¤½¤ÎÃÍ¤Ï ¥Æ¥¥¹¥È¤È¤·¤Æ³ÊǼ¤µ¤ì¤Þ¤¹¡£¤·¤«¤·¡¢nstore()/retrieve()¤ÎÁȤ߹ç¤ï¤»¤Ë Àµ¾ï¤ËÅϤ¹¤³¤È¤Ë¤è¤ê¡¢Ìµ¸Â¤ä"¿ôÃͤǤϤʤ¤"¤è¤¦¤Ê¤Î¤è¤¦¤Ê¿ôÃͤǤʤ¤ ÉâÆ°¾®¿ôÅÀ¤òͽÁÛ¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£ +=begin original + +As Storable neither knows nor cares about character sets (although it +does know that characters may be more than eight bits wide), any difference +in the interpretation of character codes between a host and a target +system is your problem. In particular, if host and target use different +code points to represent the characters used in the text representation +of floating-point numbers, you will not be able be able to exchange +floating-point data, even with nstore(). + +=end original + Storable¤Ïʸ»ú½¸¹ç¤Ë¤Ä¤¤¤ÆÃΤê¤Þ¤»¤ó¤·¡¢µ¤¤Ë¤â¤·¤Þ¤»¤ó ¡Ê¤½¤ì¤Ïʸ»ú¤¬8¥Ó¥Ã¥È¤è¤ê¤âÂ礤¤¤«¤â¤·¤ì¤Ê¤¤¤È¤¤¤¦¤³¤È¤ÏÃΤäƤ¤¤Þ¤¹¡Ë¡£ ¥Û¥¹¥È¤È¥¿¡¼¥²¥Ã¥È¡¦¥·¥¹¥Æ¥à¤Ç¤Îʸ»ú¥³¡¼¥É¤Î²ò¼á¤Ë¤ª¤±¤ë°ã¤¤¤Ï¡¢ @@ -498,17 +1264,51 @@ ¥Æ¥¥¹¥È·Á¼°¤Ç°Û¤Ê¤ë¥³¡¼¥É¥Ý¥¤¥ó¥È¤ò»È¤¦¤Î¤Ç¤¢¤ì¤Ð¡¢nstore()¤ò»È¤Ã¤¿ ¤È¤·¤Æ¤âÉâÆ°¾®¿ôÅÀ¤Î¥Ç¡¼¥¿¤ò¤ä¤ê¤È¤ê¤Ç¤¤Ê¤¤¤«¤â¤·¤ì¤Þ¤»¤ó¡£ +=begin original + +C<Storable::drop_utf8> is a blunt tool. There is no facility either to +return B<all> strings as utf8 sequences, or to attempt to convert utf8 +data back to 8 bit and C<croak()> if the conversion fails. + +=end original + C<Storable::drop_utf8>¤ÏÆß´ï¤Î¤è¤¦¤Ê¤â¤Î¤Ç¤¹¡£¤½¤ì¤Ë¤ÏB<Á´¤Æ¤Î>ʸ»úÎó¤ò utf8¤ÎʤӤȤ·¤ÆÊÖ¤¹¤«¡¢utf8¥Ç¡¼¥¿¤ò8¥Ó¥Ã¥È¤ËÊÑ´¹¤·¤è¤¦¤È¤·¡¢ ÊÑ´¹¤Ë¼ºÇÔ¤·¤¿¤éC<croak()>¤¹¤ë°Ê³°¤Ëµ¡Ç½¤Ï¤¢¤ê¤Þ¤»¤ó¡£ +=begin original + +Prior to Storable 2.01, no distinction was made between signed and +unsigned integers on storing. By default Storable prefers to store a +scalars string representation (if it has one) so this would only cause +problems when storing large unsigned integers that had never been coverted +to string or floating point. In other words values that had been generated +by integer operations such as logic ops and then not used in any string or +arithmetic context before storing. + +=end original + Storable 2.01¤è¤ê°ÊÁ°¡¢³ÊǼ»þ¤ËÉä¹æÉÕ¤ÈÉä¹æ¤Ê¤·À°¿ô¤Ç¤Î¶èÊ̤ϤĤ±¤é¤ì¤Þ¤»¤ó¤Ç¤·¤¿¡£ ¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏStorable¤Ï¡Ê¤â¤·»ý¤Ã¤Æ¤¤¤ì¤Ð¡Ë¥¹¥«¥é¡¼¤òʸ»úÎóɽ¸½¤òÁª¤Ó¤Þ¤¹¡£ ¤½¤Î¤¿¤áʸ»úÎó¤äÉÔÆ°¾ÞÀ£ÅÀ¿ô¤ËÊÑ´¹¤µ¤ì¤¿¤³¤È¤¬¤Ê¤¤Â礤ÊÉä¹æ¤Ê¤·À°¿ô¤ò³ÊǼ¤¹¤ë¤È¤ ¤Ë¤À¤±ÌäÂê¤Ë¤Ê¤ê¤Þ¤¹¡£¸À¤¤´¹¤¨¤ì¤Ð¡¢ÏÀÍý±é»»¤Î¤è¤¦¤ÊÀ°¿ô½èÍý¤Ë¤è¤êºîÀ®¤µ¤ì¡¢ ³ÊǼ¤ÎÁ°¤Ë²¿¤âʸ»úÎóÁàºî¤ä»»½Ñ¥³¥ó¥Æ¥¥¹¥È¤Ç»È¤ï¤ì¤Ê¤«¤Ã¤¿ÃͤǤ¹¡£ -=head2 perl 5.6.0 ¤È 5.6.1¤Ç¤Î64¥Ó¥Ã¥È¡¦¥Ç¡¼¥¿ +=head2 64 bit data in perl 5.6.0 and 5.6.1 + +(perl 5.6.0 ¤È 5.6.1¤Ç¤Î64¥Ó¥Ã¥È¡¦¥Ç¡¼¥¿) + +=begin original + +This section only applies to you if you have existing data written out +by Storable 2.02 or earlier on perl 5.6.0 or 5.6.1 on Unix or Linux which +has been configured with 64 bit integer support (not the default) +If you got a precompiled perl, rather than running Configure to build +your own perl from source, then it almost certainly does not affect you, +and you can stop reading now (unless you're curious). If you're using perl +on Windows it does not affect you. + +=end original ¤³¤Î¥»¥¯¥·¥ç¥ó¤Ï¡¢64¥Ó¥Ã¥Èinteger(¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡Ë¤ò ¥µ¥Ý¡¼¥È¤¹¤ë¤è¤¦¤Ë¹½À®ÀßÄꤵ¤ì¤Æ¤¤¤ëUnix¤¢¤ë¤¤¤ÏLinux¾å¤Îperl5.6.0¤ä5.6.1¤Ç @@ -519,6 +1319,20 @@ ¤³¤³¤ÇÆɤà¤Î¤ò»ß¤á¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£Windows¤Çperl¤ò»È¤Ã¤Æ¤¤¤ì¤Ð¡¢²¿¤â±Æ¶Á¤Ï ¤¢¤ê¤Þ¤»¤ó¡£ +=begin original + +Storable writes a file header which contains the sizes of various C +language types for the C compiler that built Storable (when not writing in +network order), and will refuse to load files written by a Storable not +on the same (or compatible) architecture. This check and a check on +machine byteorder is needed because the size of various fields in the file +are given by the sizes of the C language types, and so files written on +different architectures are incompatible. This is done for increased speed. +(When writing in network order, all fields are written out as standard +lengths, which allows full interworking, but takes longer to read and write) + +=end original + Storable¤Ï¡¢Storable¤ò¹½ÃÛ¤·¤¿C¥³¥ó¥Ñ¥¤¥é¤Î¤µ¤Þ¤¶¤Þ¤ÊC¸À¸ì¤Î·¿¤ÎÂ礤µ¤¬Æþ¤Ã¤¿ ¥Õ¥¡¥¤¥ë¥Ø¥Ã¥À¤ò½ÐÎϤ·¤Þ¤¹¡£¤½¤·¤ÆƱ¤¸¡Ê¤¢¤ë¤¤¤Ï¸ß´¹À¤Î¤¢¤ë¡Ë¥¢¡¼¥¥Æ¥¯¥Á¥ã¤Ç¤Ï ¤Ê¤¤Storable¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤¿¥Õ¥¡¥¤¥ë¤ò¥í¡¼¥É¤¹¤ë¤³¤È¤òµñÀ䤷¤Þ¤¹¡£ @@ -529,6 +1343,22 @@ Á´¤Æ¤Î¥Õ¥£¡¼¥ë¥É¤Ïɸ½à¤ÎŤµ¤Ç¤«¤«¤ì¤Þ¤¹¡£¤³¤ì¤Ï´°Á´¤Ë¥Í¥Ã¥È¥ï¡¼¥¯±Û¤¨¤ë ¤³¤È¤ò²Äǽ¤Ë¤·¤Þ¤¹¤¬¡¢Æɤ߹þ¤ß¤È½ñ¹þ¤ß¤Ï¤è¤ê»þ´Ö¤¬¤«¤«¤ê¤Þ¤¹¡Ë +=begin original + +Perl 5.6.x introduced the ability to optional configure the perl interpreter +to use C's C<long long> type to allow scalars to store 64 bit integers on 32 +bit systems. However, due to the way the Perl configuration system +generated the C configuration files on non-Windows platforms, and the way +Storable generates its header, nothing in the Storable file header reflected +whether the perl writing was using 32 or 64 bit integers, despite the fact +that Storable was storing some data differently in the file. Hence Storable +running on perl with 64 bit integers will read the header from a file +written by a 32 bit perl, not realise that the data is actually in a subtly +incompatible format, and then go horribly wrong (possibly crashing) if it +encountered a stored integer. This is a design failure. + +=end original + Perl 5.6.x ¤Ï¡¢perl¥¤¥ó¥¿¡¼¥×¥ê¥¿¤¬32¥Ó¥Ã¥È¡¦¥·¥¹¥Æ¥à¤Ç64¥Ó¥Ã¥Èinteger¤ò ³ÊǼ¤Ç¤¤ë¥¹¥«¥é¤ò²Äǽ¤Ë¤¹¤ëC¤ÎC<long long>·¿¤ò»È¤¦¡¢¥ª¥×¥·¥ç¥ó¤Î¹½À®ÀßÄê¤Î µ¡Ç½¤òƳÆþ¤·¤Þ¤·¤¿¡£¤·¤«¤·Windows¥×¥é¥Ã¥È¥Û¡¼¥à°Ê³°¤Ç @@ -537,18 +1367,41 @@ Storable¤ÏÊ̤ˤ¤¤¯¤Ä¤«¤Î¥Ç¡¼¥¿¤ò¥Õ¥¡¥¤¥ë¤Ë³ÊǼ¤·¤Æ¤¤¤ë¤Ë¤â´Ø¤ï¤é¤º perl¤¬32¤¢¤ë¤¤¤Ï64¥Ó¥Ã¥Èinteger¤ò»È¤Ã¤Æ½ÐÎϤ·¤¿¤«¤Ï¡¢ Storable¥Õ¥¡¥¤¥ë¡¦¥Ø¥Ã¥À¤ÎÆâÍƤËÈ¿±Ç¤µ¤ì¤Þ¤»¤ó¡£ - ¤³¤Î¤¿¤á64¥Ó¥Ã¥Èinteger¤Çperl¤ò¼Â¹Ô¤·¤Æ¤¤¤ëStorable¤Ï32¥Ó¥Ã¥Èperl¤Ë¤è¤Ã¤Æ ½ÐÎϤµ¤ì¤¿¥Õ¥¡¥¤¥ë¤«¤é¤Î¥Ø¥Ã¥À¤òÆɤߡ¢¥Ç¡¼¥¿¤¬¼ÂºÝ¤Ë¤ÏÈù̯¤Ë¸ß´¹À¤Î¤Ê¤¤ ¤â¤Î¤Ç¤¢¤ë¤ÈÍý²ò¤»¤º¡¢³ÊǼ¤µ¤ì¤¿integer¤Ë¤Ö¤Ä¤«¤ë¤È¶²¤í¤·¤¤´Ö°ã¤¤¤òµ¯¤³¤¹¤Ç¤·¤ç¤¦ ¡Ê¤ª¤½¤é¤¯¤Ï¥¯¥é¥Ã¥·¥å¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡Ë¡£¤³¤ì¤ÏÀß·×¾å¤Î¼ºÇԤǤ¹¡£ +=begin original + +Storable has now been changed to write out and read in a file header with +information about the size of integers. It's impossible to detect whether +an old file being read in was written with 32 or 64 bit integers (they have +the same header) so it's impossible to automatically switch to a correct +backwards compatibility mode. Hence this Storable defaults to the new, +correct behaviour. + +=end original + Storable¤Ï¸½ºß¤Ïinteger¤ÎÂ礤µ¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò»ý¤Ã¤¿¥Õ¥¡¥¤¥ë¡¦¥Ø¥Ã¥À¤ò ½ÐÎϤ·¡¢Æɤ߹þ¤à¤è¤¦¤ËÊѹ¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£Æɤ߹þ¤Þ¤ì¤¿¸Å¤¤¥Õ¥¡¥¤¥ë¤¬¡¢32¥Ó¥Ã¥È integer¤Ê¤Î¤«64¥Ó¥Ã¥È¤Ê¤Î¤«¤òȽÄꤹ¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡ÊƱ¤¸¥Ø¥Ã¥À¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡Ë¡£ ¤½¤Î¤¿¤á¼«Æ°Åª¤ËÀµ¤·¤¤¸åÊý¸ß´¹À¥â¡¼¥É¤Ë¼«Æ°Åª¤Ë°Ü¤ë¤³¤È¤Ï¤Ç¤¤Þ¤»¤ó¡£ ¤½¤Î¤¿¤áStorable¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¿·¤·¤¤Àµ¤·¤¤Æ°¤¤ò¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£ +=begin original + +What this means is that if you have data written by Storable 1.x running +on perl 5.6.0 or 5.6.1 configured with 64 bit integers on Unix or Linux +then by default this Storable will refuse to read it, giving the error +I<Byte order is not compatible>. If you have such data then you you +should set C<$Storable::interwork_56_64bit> to a true value to make this +Storable read and write files with the old header. You should also +migrate your data, or any older perl you are communicating with, to this +current version of Storable. + +=end original + ¤³¤ì¤¬°ÕÌ£¤¹¤ë¤³¤È¤Ï¡¢Unix¤¢¤ë¤¤¤ÏLinux¾å¤Ç64¥Ó¥Ã¥Èinteger¤Ç¹½À®ÀßÄꤵ¤ì¤¿ perl 5.6.0¤ä5.6.1¤Ç¼Â¹Ô¤·¤¿ Storable 1.x¤Ë¤è¤Ã¤Æ½ñ¤«¤ì¤¿¥Ç¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤ë ¤Î¤Ç¤¢¤ì¤Ð¡¢¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¤³¤ÎStorable¤Ï¤½¤ì¤òÆɤ߹þ¤à¤³¤È¤òµñÀ䤷¡¢ @@ -559,29 +1412,68 @@ ¤¢¤Ê¤¿¥Ç¡¼¥¿¤ä¤¢¤Ê¤¿¤¬ÄÌ¿®¤¹¤ë¸Å¤¤perl¤ò¡¢Storable¤³¤Î¸½¹Ô¥Ð¡¼¥¸¥ç¥ó¤Ë °Ü¤¹¤³¤È¤â¤·¤Ê¤±¤ì¤Ð¤Ê¤ê¤Þ¤»¤ó¡£ +=begin original + +If you don't have data written with specific configuration of perl described +above, then you do not and should not do anything. Don't set the flag - +not only will Storable on an identically configured perl refuse to load them, +but Storable a differently configured perl will load them believing them +to be correct for it, and then may well fail or crash part way through +reading them. + +=end original + ¾åµ¤Çµ½Ò¤µ¤ì¤¿ÆÃÄê¤Îperl¤Î¹½À®ÀßÄê¤Ç½ñ¤«¤ì¤¿¥Ç¡¼¥¿¤ò»ý¤Ã¤Æ¤¤¤Ê¤±¤ì¤Ð¡¢ ²¿¤â¤·¤Ê¤¯¤Æ¤â¤¤¤¤¤Ç¤¹¤·¡¢¤¹¤ë¤Ù¤¤Ç¤â¤¢¤ê¤Þ¤»¤ó¡£¥Õ¥é¥°¤òÀßÄꤷ¤Ê¤¤¤Ç¤¯¤À¤µ¤¤- Ʊ¤¸¤è¤¦¤Ë¹½À®ÀßÄꤵ¤ì¤¿perl¤Ç¤ÎStorable¤¬¡¢¤½¤ì¤é¤ò¥í¡¼¥É¤¹¤ë¤³¤È¤òµñÀ䤹¤ë ¤À¤±¤Ç¤Ê¤¯¡¢°ã¤¦¤è¤¦¤Ë¹½À®ÀßÄꤵ¤ì¤¿perl¤Ç¤ÎStorable¤¬¡¢¤½¤ì¤é¤ò¤½¤ì¤Ë¤È¤Ã¤Æ Àµ¤·¤¤¤â¤Î¤È¿®¤¸¤Æ¥í¡¼¥É¤·¡¢Æɤ߹þ¤ó¤Ç¤¤¤ëÅÓÃæ¤Ç¼ºÇÔ¤·¤¿¤ê¡¢¥¯¥é¥Ã¥·¥å¤·¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ -=head1 ¼Õ¼ +=head1 CREDITS + +=begin original + +Thank you to (in chronological order): + +=end original + +°Ê²¼¤ÎÊý¤Ë´¶¼Õ¤¤¤¿¤·¤Þ¤¹¡£ (»þ´Ö½ç¡Ë¡§ + + Jarkko Hietaniemi <jhi****@iki*****> + Ulrich Pfeifer <pfeif****@charl*****> + Benjamin A. Holzman <bah****@ecnva*****> + Andrew Ford <A.For****@ford-*****> + Gisle Aas <gisle****@aas*****> + Jeff Gresham <gresham_jeffr****@jpmor*****> + Murray Nesbitt <murra****@activ*****> + Marc Lehmann <pcg****@openg*****> + Justin Banks <justi****@wamne*****> + Jarkko Hietaniemi <jhi****@iki*****> (AGAIN, as perl 5.7.0 Pumpkin!) + Salvador Ortiz Garcia <sog****@msg*****> + Dominic Dunlop <domo****@compu*****> + Erik Haugan <erik****@solbo*****> + +=begin original + +for their bug reports, suggestions and contributions. -°Ê²¼¤ÎÊý¤Î¥Ð¥°Êó¹ð¡¢Äó°Æ¡¢¹×¸¥¤Ë´¶¼Õ¤¤¤¿¤·¤Þ¤¹¡£ (»þ´Ö½ç¡Ë¡§ +=end original - Jarkko Hietaniemi <jhi****@iki*****> - Ulrich Pfeifer <pfeif****@charl*****> - Benjamin A. Holzman <bah****@ecnva*****> - Andrew Ford <A.For****@ford-*****> - Gisle Aas <gisle****@aas*****> - Jeff Gresham <gresham_jeffr****@jpmor*****> - Murray Nesbitt <murra****@activ*****> - Marc Lehmann <pcg****@openg*****> - Justin Banks <justi****@wamne*****> - Jarkko Hietaniemi <jhi****@iki*****> (AGAIN, as perl 5.7.0 Pumpkin!) - Salvador Ortiz Garcia <sog****@msg*****> - Dominic Dunlop <domo****@compu*****> - Erik Haugan <erik****@solbo*****> +¥Ð¥°Êó¹ð¡¢Äó°Æ¡¢¹×¸¥¤¬¤¢¤ê¤Þ¤·¤¿¡£ + +=begin original + +Benjamin Holzman contributed the tied variable support, Andrew Ford +contributed the canonical order for hashes, and Gisle Aas fixed +a few misunderstandings of mine regarding the perl internals, +and optimized the emission of "tags" in the output streams by +simply counting the objects instead of tagging them (leading to +a binary incompatibility for the Storable image starting at version +0.6--older images are, of course, still properly understood). +Murray Nesbitt made Storable thread-safe. Marc Lehmann added overloading +and references to tied items support. + +=end original Benjamin Holzman ¤Ïtie¤µ¤ì¤¿ÊÑ¿ô¤Î¥µ¥Ý¡¼¥È¤Ë¹×¸¥¤·¤Æ¤¯¤ì¤Þ¤·¤¿¡£ Andrew Ford ¤Ï¥Ï¥Ã¥·¥å¤¿¤á¤Îɸ½àÍͼ°¤Ë¹×¸¥¤·¤Æ¤¯¤ì¤Þ¤·¤¿¡£ @@ -594,17 +1486,35 @@ Marc Lehmann¤Ïtie¤µ¤ì¤Æ¤¤¤ëÍ×ÁǤؤΥª¡¼¥Ð¡¼¥í¡¼¥É¤È»²¾È¤Î¥µ¥Ý¡¼¥È¤ò Äɲ䷤Ƥ¯¤ì¤Þ¤·¤¿¡£ -=head1 ºî¼Ô +=head1 AUTHOR + +=begin original + +Storable was written by Raphael Manfredi F<E<lt>Raphael_Manfr****@pobox*****<gt>> +Maintenance is now done by the perl5-porters F<E<lt>perl5****@perl*****<gt>> + +=end original Storable¤ÏRaphael Manfredi <Raphael_Manfr****@pobox*****> ¤Ë¤è¤Ã¤ÆºîÀ®¤µ¤ì¤Þ¤·¤¿¡£ ¸½ºß¡¢perl5-porters <perl5****@perl*****>¡¡¤Ë¤è¤Ã¤Æ¥á¥ó¥Æ¥Ê¥ó¥¹¤µ¤ì¤Æ¤¤¤Þ¤¹¡£ +=begin original + +Please e-mail us with problems, bug fixes, comments and complaints, +although if you have complements you should send them to Raphael. +Please don't e-mail Raphael with problems, as he no longer works on +Storable, and your message will be delayed while he forwards it to us. + +=end original + ¤¿¤È¤¨Raphael¤ËÁ÷¿®¤¹¤ë¤Ù¤Ê䤹¤ë¤â¤Î¤ò»ý¤Ã¤Æ¤¤¤¿¤È¤·¤Æ¤â¡¢¾ã³²¡¢¥Ð¥°½¤Àµ¡¢ ¥³¥á¥ó¥È¡¢¶ì¾ð¤Ë¤Ä¤¤¤Æ¤Ï»ä¤¿¤Á¤Ë¥á¡¼¥ë¤·¤Æ¤¯¤À¤µ¤¤¡£¤É¤¦¤«¾ã³²¤Ë¤Ä¤¤¤ÆRaphae¤Ë ¥á¡¼¥ë¤·¤Ê¤¤¤Ç¤¯¤À¤µ¤¤¡£Èà¤Ï¤â¤¦Storable¤Ë¤Ä¤¤¤Æ¼è¤êÁȤó¤Ç¤¤¤Þ¤»¤ó¡£ ¤½¤·¤Æ¤¢¤Ê¤¿¤Î¥á¥Ã¥»¡¼¥¸¤ÏÈब»ä¤¿¤Á¤ËžÁ÷¤¹¤ë¤Þ¤ÇÃÙ¤ì¤Æ¤·¤Þ¤¤¤Þ¤¹¡£ -=head1 »²¹Í»ñÎÁ +=head1 SEE ALSO L<Clone>. +=cut +