向数组添加新值

时间:2017-02-14 16:08:16

标签: arrays perl

在perl调试器中,我为对象$ this

提供了这些值
DB<4> x $this
0  Parsers::SourceParser::OpenURL_0_1::doi::SAXHandler=HASH(0xdbcf1b0)
   'Handler' => XML::SAX::Base::NoHandler=HASH(0xf7c19a98)
        empty hash
   'XML::SAX::Base::Features' => HASH(0xdbcf3d0)
      'http://xml.org/sax/features/namespaces' => 1
   'atitle' => 0
   'author_sequence' => 'additional'
   'chars' => 'S1555415514003390'
   'ctx_object' => ContextObject::Generic=HASH(0xca853b0)
      '@rfe_id' => ARRAY(0xdb3d6c8)
           empty array
      '@rfr_id' => ARRAY(0xdb38d10)
         0  'primo.exlibrisgroup.com-sciversesciencedirect_elsevier'
      '@rft.au' => ARRAY(0xdb390b0)
         0  'Gladkowski, Cassandra A.'
      '@rft.aufirst' => ARRAY(0xdf2a750)
         0  ''
         1  'Cassandra A.'
         2  'Chelsey L.'
         3  'Heather M.'
         4  'Angela Tallie'
         5  'Margaret'
      '@rft.aulast' => ARRAY(0xdf381a0)
         0  'Gladkowski'
         1  'Gladkowski'
         2  'Medley'
         3  'Nelson'
         4  'Price'
         5  'Harvey'
      '@rft_id' => ARRAY(0xdb47768)
         0  'doi:10.1016/j.nurpra.2014.05.008'
         1  'bibcode:'
         2  'hdl:'
         3  'lccn:'
         4  'oclcnum:'
         5  'pmid:'
         6  'eric:((addata/eric'
      '_stash' => HASH(0xdb1bd58)
         '@rfr_id' => ARRAY(0xda23530)
            0  'info:sid/primo.exlibrisgroup.com-sciversesciencedirect_elsevier'
         '@rft_id' => ARRAY(0xdb41240)
            0  'info:doi/10.1016/j.nurpra.2014.05.008'
            1  'info:bibcode/'
            2  'info:hdl/'
            3  'info:lccn/'
            4  'info:oclcnum/'
            5  'info:pmid/'
            6  'info:eric/((addata/eric'
      'ctx_enc' => 'info:ofi/enc:UTF-8'
      'ctx_id' => '10_1'
      'ctx_tim' => '2016-01-21T10:34:31IST'
      'ctx_ver' => 'Z39.88-2004'
      'fetchid' => '/query/xref.cgi?sid=null:null&id=10.1016/j.nurpra.2014.05.008&pid=sfx-exl:crpw222&format=unixref'
      'rfr.rfr' => 'primo.exlibrisgroup.com-sciversesciencedirect_elsevier'
      'rft.atitle' => 'Opioids Versus Physical Therapy for Management of Chronic Back Pain'
      'rft.bibcode' => ''
      'rft.date' => '2014-09'
      'rft.doi' => '10.1016/j.nurpra.2014.05.008'
      'rft.epage' => 559
      'rft.eric' => '((addata/eric'
      'rft.genre' => 'article'
      'rft.hdl' => ''
      'rft.issn' => 15554155
      'rft.issue' => 8
      'rft.jtitle' => 'The Journal for Nurse Practitioners'
      'rft.lccn' => ''
      'rft.month' => 09
      'rft.oclcnum' => ''
      'rft.pages' => '552-559'
      'rft.pmid' => ''
      'rft.spage' => 552
      'rft.title' => 'The Journal for Nurse Practitioners'
      'rft.volume' => 10
      'rft.year' => 2014
      'rft_dat' => '<sciversesciencedirect_elsevier>S1555-4155(14)00339-0</sciversesciencedirect_elsevier>,language=eng,view=TWU-A'
      'rft_val_fmt' => 'info:ofi/fmt:kev:mtx:'
      'sfx.ignore_char_set' => 1
      'sfx.openurl' => 'http://localhost/http://il-kblwe02:3410/dev1?ctx_enc=info%3Aofi%2Fenc%3AUTF-8&ctx_id=10_1&ctx_tim=2016-01-21T10%3A34%3A31IST&ctx_ver=Z39.88-2004&url_ctx_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Actx&url_ver=Z39.88-2004&rfr_id=info%3Asid%2Fprimo.exlibrisgroup.com-sciversesciencedirect_elsevier&req_id=&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3A&rft.genre=article&rft.atitle=Opioids%20Versus%20Physical%20Therapy%20for%20Management%20of%20Chronic%20Back%20Pain&rft.jtitle=The%20Journal%20for%20Nurse%20Practitioners&rft_dat=%3Csciversesciencedirect_elsevier%3ES1555-4155%2814%2900339-0%3C%2Fsciversesciencedirect_elsevier%3E%2Clanguage%3Deng%2Cview%3DTWU-A&rft.btitle=&rft.aulast=Gladkowski&rft.auinit=&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Gladkowski%2C%20Cassandra%20A.&rft.aucorp=&rft.date=2014&rft.volume=10&rft.issue=8&rft.part=&rft.quarter=&rft.ssn=&rft.spage=552&rft.epage=559&rft.pages=552-559&rft.artnum=&rft.issn=1555-4155&rft.eissn=&rft.isbn=&rft.sici=&rft.coden=&rft_id=info%3Adoi%2F10.1016%2Fj.nurpra.2014.05.008&rft_id=info%3Abibcode%2F&rft_id=info%3Ahdl%2F&rft_id=info%3Alccn%2F&rft_id=info%3Aoclcnum%2F&rft_id=info%3Apmid%2F&rft_id=info%3Aeric%2F%28%28addata%2Feric&rft.object_id=&rft.eisbn=&rft.edition=&rft.pub=&rft.place=&rft.series=&rft.stitle=&rft.bici='
      'sfx.sid' => 'doi'
      'sfx.sourcename' => 'DEFAULT'
      'url_ctx_fmt' => 'info:ofi/fmt:kev:mtx:ctx'
      'url_ver' => 'Z39.88-2004'
   'eisbns' => 0
   'media_type' => 'print'
   'pickup' => 'doi_records/doi_record/crossref/journal/journal_article/publisher_item/identifier/Pii'
   'stack' => ARRAY(0xdb478e8)
      0  'doi_records'
      1  'doi_record'
      2  'crossref'
      3  'journal'
      4  'journal_article'
      5  'publisher_item'
      6  'identifier'
   'title_value' => ''

或采用数据转储器格式

$VAR1 = bless( {
'XML::SAX::Base::Features' => {
                            'http://xml.org/sax/features/namespaces' => 1
                          },
'ctx_object' => bless( {
                         'rft.issn' => '15554155',
                         'ctx_tim' => '2016-01-21T10:34:31IST',
                         '_stash' => {
                                       '@rft_id' => [
                                                      'info:doi/10.1016/j.nurpra.2014.05.008',
                                                      'info:bibcode/',
                                                      'info:hdl/',
                                                      'info:lccn/',
                                                      'info:oclcnum/',
                                                      'info:pmid/',
                                                      'info:eric/((addata/eric'
                                                    ],
                                       '@rfr_id' => [
                                                      'info:sid/primo.exlibrisgroup.com-sciversesciencedirect_elsevier'
                                                    ]
                                     },
                         'ctx_ver' => 'Z39.88-2004',
                         'rft.year' => '2014',
                         'rft.pages' => '552-559',
                         'rft.eric' => '((addata/eric',
                         '@rfr_id' => [
                                        'primo.exlibrisgroup.com-sciversesciencedirect_elsevier'
                                      ],
                         'rft.lccn' => '',
                         'rft.oclcnum' => '',
                         '@rft_id' => [
                                        'doi:10.1016/j.nurpra.2014.05.008',
                                        'bibcode:',
                                        'hdl:',
                                        'lccn:',
                                        'oclcnum:',
                                        'pmid:',
                                        'eric:((addata/eric'
                                      ],
                         'rft.atitle' => 'Opioids Versus Physical Therapy for Management of Chronic Back Pain',
                         'sfx.ignore_char_set' => 1,
                         'ctx_enc' => 'info:ofi/enc:UTF-8',
                         'ctx_id' => '10_1',
                         'url_ver' => 'Z39.88-2004',
                         'rft.volume' => '10',
                         'rft.hdl' => '',
                         'rft.month' => '09',
                         'rft.genre' => 'article',
                         'rfr.rfr' => 'primo.exlibrisgroup.com-sciversesciencedirect_elsevier',
                         'rft.issue' => '8',
                         'sfx.openurl' => 'http://il-kblwe02:3410/dev1?ctx_enc=info%3Aofi%2Fenc%3AUTF-8&ctx_id=10_1&ctx_tim=2016-01-21T10%3A34%3A31IST&ctx_ver=Z39.88-2004&url_ctx_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Actx&url_ver=Z39.88-2004&rfr_id=info%3Asid%2Fprimo.exlibrisgroup.com-sciversesciencedirect_elsevier&req_id=&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3A&rft.genre=article&rft.atitle=Opioids%20Versus%20Physical%20Therapy%20for%20Management%20of%20Chronic%20Back%20Pain&rft.jtitle=The%20Journal%20for%20Nurse%20Practitioners&rft_dat=%3Csciversesciencedirect_elsevier%3ES1555-4155%2814%2900339-0%3C%2Fsciversesciencedirect_elsevier%3E%2Clanguage%3Deng%2Cview%3DTWU-A&rft.btitle=&rft.aulast=Gladkowski&rft.auinit=&rft.auinit1=&rft.auinitm=&rft.ausuffix=&rft.au=Gladkowski%2C%20Cassandra%20A.&rft.aucorp=&rft.date=2014&rft.volume=10&rft.issue=8&rft.part=&rft.quarter=&rft.ssn=&rft.spage=552&rft.epage=559&rft.pages=552-559&rft.artnum=&rft.issn=1555-4155&rft.eissn=&rft.isbn=&rft.sici=&rft.coden=&rft_id=info%3Adoi%2F10.1016%2Fj.nurpra.2014.05.008&rft_id=info%3Abibcode%2F&rft_id=info%3Ahdl%2F&rft_id=info%3Alccn%2F&rft_id=info%3Aoclcnum%2F&rft_id=info%3Apmid%2F&rft_id=info%3Aeric%2F%28%28addata%2Feric&rft.object_id=&rft.eisbn=&rft.edition=&rft.pub=&rft.place=&rft.series=&rft.stitle=&rft.bici=',
                         'rft.doi' => '10.1016/j.nurpra.2014.05.008',
                         'rft.title' => 'The Journal for Nurse Practitioners',
                         'url_ctx_fmt' => 'info:ofi/fmt:kev:mtx:ctx',
                         '@rfe_id' => [],
                         '@rft.aufirst' => [
                                             '',
                                             'Cassandra A.',
                                             'Chelsey L.',
                                             'Heather M.',
                                             'Angela Tallie',
                                             'Margaret'
                                           ],
                         '@rft.aulast' => [
                                            'Gladkowski',
                                            'Gladkowski',
                                            'Medley',
                                            'Nelson',
                                            'Price',
                                            'Harvey'
                                          ],
                         'rft.jtitle' => 'The Journal for Nurse Practitioners',
                         'sfx.sourcename' => 'DEFAULT',
                         'rft_val_fmt' => 'info:ofi/fmt:kev:mtx:',
                         'sfx.sid' => 'doi',
                         'rft.date' => '2014-09',
                         '@rft.au' => [
                                        'Gladkowski, Cassandra A.'
                                      ],
                         'rft.epage' => '559',
                         'fetchid' => '/query/xref.cgi?sid=null:null&id=10.1016/j.nurpra.2014.05.008&pid=sfx-exl:crpw222&format=unixref',
                         'rft.spage' => '552',
                         'rft.pmid' => '',
                         'rft.bibcode' => '',
                         'rft_dat' => '<sciversesciencedirect_elsevier>S1555-4155(14)00339-0</sciversesciencedirect_elsevier>,language=eng,view=TWU-A'
                       }, 'ContextObject::Generic' ),
'author_sequence' => 'additional',
'atitle' => 0,
'stack' => [
             'doi_records',
             'doi_record',
             'crossref',
             'journal',
             'journal_article',
             'publisher_item',
             'identifier'
           ],
'eisbns' => 0,
'pickup' => 'doi_records/doi_record/crossref/journal/journal_article/publisher_item/identifier/Pii',
'title_value' => '',
'Handler' => bless( {}, 'XML::SAX::Base::NoHandler' ),
'chars' => 'S1555415514003390',
'media_type' => 'print'

当我尝试通过编写

为上下文对象设置新值时
$this->{ctx_object}->set('pii',$this->{chars});

它似乎没有设置它。

我猜这个集合只能为已经存在的项目(例如rft.issn)设置一个值。如何添加一个名为pii的项目以便我可以设置值?

0 个答案:

没有答案