Filename | /usr/share/perl5/XML/SAX/Base.pm |
Statements | Executed 3449023 statements in 17.7s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
607406 | 1 | 1 | 5.74s | 14.3s | characters | XML::SAX::Base::
602406 | 1 | 1 | 4.77s | 8.50s | __ANON__[:200] | XML::SAX::Base::
185299 | 1 | 1 | 1.89s | 5.54s | start_element | XML::SAX::Base::
185299 | 1 | 1 | 1.85s | 12.7s | end_element | XML::SAX::Base::
180299 | 1 | 1 | 1.47s | 3.51s | __ANON__[:292] | XML::SAX::Base::
180299 | 1 | 1 | 1.40s | 10.6s | __ANON__[:2201] | XML::SAX::Base::
10000 | 1 | 1 | 357ms | 602ms | get_feature | XML::SAX::Base::
10000 | 2 | 2 | 282ms | 297ms | end_document (recurses: max depth 1, inclusive time 116ms) | XML::SAX::Base::
10000 | 2 | 2 | 271ms | 283ms | start_document (recurses: max depth 1, inclusive time 104ms) | XML::SAX::Base::
5000 | 1 | 1 | 217ms | 368ms | set_feature | XML::SAX::Base::
5000 | 1 | 1 | 158ms | 88.7s | parse | XML::SAX::Base::
5000 | 1 | 1 | 130ms | 88.9s | parse_string | XML::SAX::Base::
15000 | 2 | 1 | 130ms | 130ms | get_features | XML::SAX::Base::
5000 | 1 | 1 | 118ms | 486ms | new | XML::SAX::Base::
10000 | 2 | 1 | 92.1ms | 92.1ms | get_options | XML::SAX::Base::
15000 | 1 | 1 | 73.8ms | 73.8ms | supported_features | XML::SAX::Base::
1 | 1 | 1 | 22µs | 29µs | BEGIN@28 | XML::SAX::Base::
1 | 1 | 1 | 15µs | 57µs | BEGIN@29 | XML::SAX::Base::
1 | 1 | 1 | 8µs | 8µs | BEGIN@30 | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | new | XML::SAX::Base::NoHandler::
0 | 0 | 0 | 0s | 0s | __ANON__[:1012] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1017] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1041] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1046] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1063] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1081] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1086] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1110] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1115] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1132] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1150] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1155] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1179] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1184] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1201] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1219] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:121] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1224] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1248] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1253] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1258] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:126] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1275] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1293] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1311] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1316] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1340] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1345] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1350] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1367] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1385] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1403] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1408] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1432] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1437] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:143] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1442] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1459] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1477] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1495] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1500] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1524] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1529] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1534] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1551] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1569] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1587] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1592] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1616] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:161] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1621] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1626] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1643] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1661] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:166] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1679] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1684] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1708] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1713] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1730] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1748] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1753] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1777] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1782] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1799] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1817] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1822] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1846] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1851] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1868] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1886] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1891] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:190] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1915] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1920] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1937] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1955] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:195] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1960] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1984] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:1989] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2006] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2024] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2029] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2053] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2058] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2075] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2093] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2098] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2122] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2127] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2144] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2162] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2167] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:217] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2191] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2196] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2218] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2236] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2254] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2259] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2283] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2288] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2305] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2323] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2328] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2352] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2357] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:235] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2362] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2379] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2397] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2415] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2420] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2444] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2449] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2466] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2484] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2489] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2513] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2518] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2535] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:253] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2553] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:2558] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:258] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:282] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:287] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:309] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:327] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:345] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:350] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:374] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:379] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:396] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:414] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:419] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:443] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:448] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:465] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:483] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:488] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:512] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:517] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:52] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:534] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:552] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:557] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:57] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:581] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:586] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:603] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:621] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:626] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:650] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:655] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:672] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:690] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:695] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:719] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:724] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:729] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:746] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:74] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:764] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:782] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:787] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:811] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:816] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:833] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:851] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:856] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:880] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:885] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:902] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:920] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:925] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:92] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:949] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:954] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:959] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:976] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:97] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | __ANON__[:994] | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | attlist_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | attribute_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | comment | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | doctype_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | element_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | end_cdata | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | end_dtd | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | end_entity | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | end_prefix_mapping | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | entity_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | entity_reference | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | error | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | external_entity_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | fatal_error | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_content_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_decl_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_document_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_dtd_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_entity_resolver | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_error_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | get_lexical_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | ignorable_whitespace | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | internal_entity_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | no_op | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | notation_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | parse_file | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | parse_uri | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | processing_instruction | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | resolve_entity | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_content_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_decl_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_document_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_document_locator | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_dtd_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_entity_resolver | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_error_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | set_lexical_handler | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | skipped_entity | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | start_cdata | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | start_dtd | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | start_entity | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | start_prefix_mapping | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | unparsed_entity_decl | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | warning | XML::SAX::Base::
0 | 0 | 0 | 0s | 0s | xml_decl | XML::SAX::Base::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package XML::SAX::Base; | ||||
2 | |||||
3 | # version 0.10 - Kip Hampton <khampton@totalcinema.com> | ||||
4 | # version 0.13 - Robin Berjon <robin@knowscape.com> | ||||
5 | # version 0.15 - Kip Hampton <khampton@totalcinema.com> | ||||
6 | # version 0.17 - Kip Hampton <khampton@totalcinema.com> | ||||
7 | # version 0.19 - Kip Hampton <khampton@totalcinema.com> | ||||
8 | # version 0.21 - Kip Hampton <khampton@totalcinema.com> | ||||
9 | # version 0.22 - Robin Berjon <robin@knowscape.com> | ||||
10 | # version 0.23 - Matt Sergeant <matt@sergeant.org> | ||||
11 | # version 0.24 - Robin Berjon <robin@knowscape.com> | ||||
12 | # version 0.25 - Kip Hampton <khampton@totalcinema.com> | ||||
13 | # version 1.00 - Kip Hampton <khampton@totalcinema.com> | ||||
14 | # version 1.01 - Kip Hampton <khampton@totalcinema.com> | ||||
15 | # version 1.02 - Robin Berjon <robin@knowscape.com> | ||||
16 | # version 1.03 - Matt Sergeant <matt@sergeant.org> | ||||
17 | # version 1.04 - Kip Hampton <khampton@totalcinema.com> | ||||
18 | |||||
19 | #-----------------------------------------------------# | ||||
20 | # STOP!!!!! | ||||
21 | # | ||||
22 | # This file is generated by the 'Makefile.PL' file | ||||
23 | # that ships with the XML::SAX distribution. | ||||
24 | # If you need to make changes, patch that file NOT | ||||
25 | # this one. | ||||
26 | #-----------------------------------------------------# | ||||
27 | |||||
28 | 3 | 42µs | 2 | 36µs | # spent 29µs (22+7) within XML::SAX::Base::BEGIN@28 which was called:
# once (22µs+7µs) by base::import at line 28 # spent 29µs making 1 call to XML::SAX::Base::BEGIN@28
# spent 7µs making 1 call to strict::import |
29 | 3 | 49µs | 2 | 99µs | # spent 57µs (15+42) within XML::SAX::Base::BEGIN@29 which was called:
# once (15µs+42µs) by base::import at line 29 # spent 57µs making 1 call to XML::SAX::Base::BEGIN@29
# spent 42µs making 1 call to vars::import |
30 | 3 | 23.2ms | 1 | 8µs | # spent 8µs within XML::SAX::Base::BEGIN@30 which was called:
# once (8µs+0s) by base::import at line 30 # spent 8µs making 1 call to XML::SAX::Base::BEGIN@30 |
31 | |||||
32 | 1 | 6µs | $VERSION = '1.04'; | ||
33 | |||||
34 | sub end_prefix_mapping { | ||||
35 | my $self = shift; | ||||
36 | if (defined $self->{Methods}->{'end_prefix_mapping'}) { | ||||
37 | $self->{Methods}->{'end_prefix_mapping'}->(@_); | ||||
38 | } | ||||
39 | else { | ||||
40 | my $method; | ||||
41 | my $callbacks; | ||||
42 | if (exists $self->{ParseOptions}) { | ||||
43 | $callbacks = $self->{ParseOptions}; | ||||
44 | } | ||||
45 | else { | ||||
46 | $callbacks = $self; | ||||
47 | } | ||||
48 | if (0) { # dummy to make elsif's below compile | ||||
49 | } | ||||
50 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_prefix_mapping') ) { | ||||
51 | my $handler = $callbacks->{'ContentHandler'}; | ||||
52 | $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) }; | ||||
53 | return $method->($handler, @_); | ||||
54 | } | ||||
55 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_prefix_mapping') ) { | ||||
56 | my $handler = $callbacks->{'Handler'}; | ||||
57 | $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) }; | ||||
58 | return $method->($handler, @_); | ||||
59 | } | ||||
60 | elsif (defined $callbacks->{'ContentHandler'} | ||||
61 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
62 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
63 | ) | ||||
64 | { | ||||
65 | my $res = eval { $callbacks->{'ContentHandler'}->end_prefix_mapping(@_) }; | ||||
66 | if ($@) { | ||||
67 | die $@; | ||||
68 | } | ||||
69 | else { | ||||
70 | # I think there's a buggette here... | ||||
71 | # if the first call throws an exception, we don't set it up right. | ||||
72 | # Not fatal, but we might want to address it. | ||||
73 | my $handler = $callbacks->{'ContentHandler'}; | ||||
74 | $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) }; | ||||
75 | } | ||||
76 | return $res; | ||||
77 | } | ||||
78 | elsif (defined $callbacks->{'Handler'} | ||||
79 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
80 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
81 | ) | ||||
82 | { | ||||
83 | my $res = eval { $callbacks->{'Handler'}->end_prefix_mapping(@_) }; | ||||
84 | if ($@) { | ||||
85 | die $@; | ||||
86 | } | ||||
87 | else { | ||||
88 | # I think there's a buggette here... | ||||
89 | # if the first call throws an exception, we don't set it up right. | ||||
90 | # Not fatal, but we might want to address it. | ||||
91 | my $handler = $callbacks->{'Handler'}; | ||||
92 | $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) }; | ||||
93 | } | ||||
94 | return $res; | ||||
95 | } | ||||
96 | else { | ||||
97 | $self->{Methods}->{'end_prefix_mapping'} = sub { }; | ||||
98 | } | ||||
99 | } | ||||
100 | |||||
101 | } | ||||
102 | |||||
103 | sub internal_entity_decl { | ||||
104 | my $self = shift; | ||||
105 | if (defined $self->{Methods}->{'internal_entity_decl'}) { | ||||
106 | $self->{Methods}->{'internal_entity_decl'}->(@_); | ||||
107 | } | ||||
108 | else { | ||||
109 | my $method; | ||||
110 | my $callbacks; | ||||
111 | if (exists $self->{ParseOptions}) { | ||||
112 | $callbacks = $self->{ParseOptions}; | ||||
113 | } | ||||
114 | else { | ||||
115 | $callbacks = $self; | ||||
116 | } | ||||
117 | if (0) { # dummy to make elsif's below compile | ||||
118 | } | ||||
119 | elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('internal_entity_decl') ) { | ||||
120 | my $handler = $callbacks->{'DeclHandler'}; | ||||
121 | $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) }; | ||||
122 | return $method->($handler, @_); | ||||
123 | } | ||||
124 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('internal_entity_decl') ) { | ||||
125 | my $handler = $callbacks->{'Handler'}; | ||||
126 | $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) }; | ||||
127 | return $method->($handler, @_); | ||||
128 | } | ||||
129 | elsif (defined $callbacks->{'DeclHandler'} | ||||
130 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') | ||||
131 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
132 | ) | ||||
133 | { | ||||
134 | my $res = eval { $callbacks->{'DeclHandler'}->internal_entity_decl(@_) }; | ||||
135 | if ($@) { | ||||
136 | die $@; | ||||
137 | } | ||||
138 | else { | ||||
139 | # I think there's a buggette here... | ||||
140 | # if the first call throws an exception, we don't set it up right. | ||||
141 | # Not fatal, but we might want to address it. | ||||
142 | my $handler = $callbacks->{'DeclHandler'}; | ||||
143 | $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) }; | ||||
144 | } | ||||
145 | return $res; | ||||
146 | } | ||||
147 | elsif (defined $callbacks->{'Handler'} | ||||
148 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
149 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
150 | ) | ||||
151 | { | ||||
152 | my $res = eval { $callbacks->{'Handler'}->internal_entity_decl(@_) }; | ||||
153 | if ($@) { | ||||
154 | die $@; | ||||
155 | } | ||||
156 | else { | ||||
157 | # I think there's a buggette here... | ||||
158 | # if the first call throws an exception, we don't set it up right. | ||||
159 | # Not fatal, but we might want to address it. | ||||
160 | my $handler = $callbacks->{'Handler'}; | ||||
161 | $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) }; | ||||
162 | } | ||||
163 | return $res; | ||||
164 | } | ||||
165 | else { | ||||
166 | $self->{Methods}->{'internal_entity_decl'} = sub { }; | ||||
167 | } | ||||
168 | } | ||||
169 | |||||
170 | } | ||||
171 | |||||
172 | # spent 14.3s (5.74+8.54) within XML::SAX::Base::characters which was called 607406 times, avg 24µs/call:
# 607406 times (5.74s+8.54s) by XML::SAX::Expat::_handle_char at line 252 of XML/SAX/Expat.pm, avg 24µs/call | ||||
173 | 1249812 | 5.59s | my $self = shift; | ||
174 | 602406 | 8.50s | if (defined $self->{Methods}->{'characters'}) { # spent 8.50s making 602406 calls to XML::SAX::Base::__ANON__[XML/SAX/Base.pm:200], avg 14µs/call | ||
175 | $self->{Methods}->{'characters'}->(@_); | ||||
176 | } | ||||
177 | else { | ||||
178 | my $method; | ||||
179 | my $callbacks; | ||||
180 | if (exists $self->{ParseOptions}) { | ||||
181 | $callbacks = $self->{ParseOptions}; | ||||
182 | } | ||||
183 | else { | ||||
184 | $callbacks = $self; | ||||
185 | } | ||||
186 | 5000 | 12.0ms | if (0) { # dummy to make elsif's below compile # spent 12.0ms making 5000 calls to UNIVERSAL::can, avg 2µs/call | ||
187 | } | ||||
188 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('characters') ) { | ||||
189 | my $handler = $callbacks->{'ContentHandler'}; | ||||
190 | $self->{Methods}->{'characters'} = sub { $method->($handler, @_) }; | ||||
191 | return $method->($handler, @_); | ||||
192 | } | ||||
193 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('characters') ) { | ||||
194 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
195 | $self->{Methods}->{'characters'} = sub { $method->($handler, @_) }; | ||||
196 | return $method->($handler, @_); | ||||
197 | } | ||||
198 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('characters') ) { | ||||
199 | my $handler = $callbacks->{'Handler'}; | ||||
200 | 602406 | 4.06s | 602406 | 3.73s | # spent 8.50s (4.77+3.73) within XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:200] which was called 602406 times, avg 14µs/call:
# 602406 times (4.77s+3.73s) by XML::SAX::Base::characters at line 174, avg 14µs/call # spent 3.73s making 602406 calls to MARC::File::SAX::characters, avg 6µs/call |
201 | 5000 | 29.1ms | return $method->($handler, @_); # spent 29.1ms making 5000 calls to MARC::File::SAX::characters, avg 6µs/call | ||
202 | } | ||||
203 | elsif (defined $callbacks->{'ContentHandler'} | ||||
204 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
205 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
206 | ) | ||||
207 | { | ||||
208 | my $res = eval { $callbacks->{'ContentHandler'}->characters(@_) }; | ||||
209 | if ($@) { | ||||
210 | die $@; | ||||
211 | } | ||||
212 | else { | ||||
213 | # I think there's a buggette here... | ||||
214 | # if the first call throws an exception, we don't set it up right. | ||||
215 | # Not fatal, but we might want to address it. | ||||
216 | my $handler = $callbacks->{'ContentHandler'}; | ||||
217 | $self->{Methods}->{'characters'} = sub { $handler->characters(@_) }; | ||||
218 | } | ||||
219 | return $res; | ||||
220 | } | ||||
221 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
222 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
223 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
224 | ) | ||||
225 | { | ||||
226 | my $res = eval { $callbacks->{'DocumentHandler'}->characters(@_) }; | ||||
227 | if ($@) { | ||||
228 | die $@; | ||||
229 | } | ||||
230 | else { | ||||
231 | # I think there's a buggette here... | ||||
232 | # if the first call throws an exception, we don't set it up right. | ||||
233 | # Not fatal, but we might want to address it. | ||||
234 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
235 | $self->{Methods}->{'characters'} = sub { $handler->characters(@_) }; | ||||
236 | } | ||||
237 | return $res; | ||||
238 | } | ||||
239 | elsif (defined $callbacks->{'Handler'} | ||||
240 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
241 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
242 | ) | ||||
243 | { | ||||
244 | my $res = eval { $callbacks->{'Handler'}->characters(@_) }; | ||||
245 | if ($@) { | ||||
246 | die $@; | ||||
247 | } | ||||
248 | else { | ||||
249 | # I think there's a buggette here... | ||||
250 | # if the first call throws an exception, we don't set it up right. | ||||
251 | # Not fatal, but we might want to address it. | ||||
252 | my $handler = $callbacks->{'Handler'}; | ||||
253 | $self->{Methods}->{'characters'} = sub { $handler->characters(@_) }; | ||||
254 | } | ||||
255 | return $res; | ||||
256 | } | ||||
257 | else { | ||||
258 | $self->{Methods}->{'characters'} = sub { }; | ||||
259 | } | ||||
260 | } | ||||
261 | |||||
262 | } | ||||
263 | |||||
264 | # spent 5.54s (1.89+3.66) within XML::SAX::Base::start_element which was called 185299 times, avg 30µs/call:
# 185299 times (1.89s+3.66s) by XML::SAX::Expat::_handle_start at line 225 of XML/SAX/Expat.pm, avg 30µs/call | ||||
265 | 405598 | 1.85s | my $self = shift; | ||
266 | 180299 | 3.51s | if (defined $self->{Methods}->{'start_element'}) { # spent 3.51s making 180299 calls to XML::SAX::Base::__ANON__[XML/SAX/Base.pm:292], avg 19µs/call | ||
267 | $self->{Methods}->{'start_element'}->(@_); | ||||
268 | } | ||||
269 | else { | ||||
270 | my $method; | ||||
271 | my $callbacks; | ||||
272 | if (exists $self->{ParseOptions}) { | ||||
273 | $callbacks = $self->{ParseOptions}; | ||||
274 | } | ||||
275 | else { | ||||
276 | $callbacks = $self; | ||||
277 | } | ||||
278 | 5000 | 12.6ms | if (0) { # dummy to make elsif's below compile # spent 12.6ms making 5000 calls to UNIVERSAL::can, avg 3µs/call | ||
279 | } | ||||
280 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_element') ) { | ||||
281 | my $handler = $callbacks->{'ContentHandler'}; | ||||
282 | $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) }; | ||||
283 | return $method->($handler, @_); | ||||
284 | } | ||||
285 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_element') ) { | ||||
286 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
287 | $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) }; | ||||
288 | return $method->($handler, @_); | ||||
289 | } | ||||
290 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_element') ) { | ||||
291 | my $handler = $callbacks->{'Handler'}; | ||||
292 | 180299 | 1.27s | 180299 | 2.04s | # spent 3.51s (1.47+2.04) within XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:292] which was called 180299 times, avg 19µs/call:
# 180299 times (1.47s+2.04s) by XML::SAX::Base::start_element at line 266, avg 19µs/call # spent 2.04s making 180299 calls to MARC::File::SAX::start_element, avg 11µs/call |
293 | 5000 | 133ms | return $method->($handler, @_); # spent 133ms making 5000 calls to MARC::File::SAX::start_element, avg 27µs/call | ||
294 | } | ||||
295 | elsif (defined $callbacks->{'ContentHandler'} | ||||
296 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
297 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
298 | ) | ||||
299 | { | ||||
300 | my $res = eval { $callbacks->{'ContentHandler'}->start_element(@_) }; | ||||
301 | if ($@) { | ||||
302 | die $@; | ||||
303 | } | ||||
304 | else { | ||||
305 | # I think there's a buggette here... | ||||
306 | # if the first call throws an exception, we don't set it up right. | ||||
307 | # Not fatal, but we might want to address it. | ||||
308 | my $handler = $callbacks->{'ContentHandler'}; | ||||
309 | $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) }; | ||||
310 | } | ||||
311 | return $res; | ||||
312 | } | ||||
313 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
314 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
315 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
316 | ) | ||||
317 | { | ||||
318 | my $res = eval { $callbacks->{'DocumentHandler'}->start_element(@_) }; | ||||
319 | if ($@) { | ||||
320 | die $@; | ||||
321 | } | ||||
322 | else { | ||||
323 | # I think there's a buggette here... | ||||
324 | # if the first call throws an exception, we don't set it up right. | ||||
325 | # Not fatal, but we might want to address it. | ||||
326 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
327 | $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) }; | ||||
328 | } | ||||
329 | return $res; | ||||
330 | } | ||||
331 | elsif (defined $callbacks->{'Handler'} | ||||
332 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
333 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
334 | ) | ||||
335 | { | ||||
336 | my $res = eval { $callbacks->{'Handler'}->start_element(@_) }; | ||||
337 | if ($@) { | ||||
338 | die $@; | ||||
339 | } | ||||
340 | else { | ||||
341 | # I think there's a buggette here... | ||||
342 | # if the first call throws an exception, we don't set it up right. | ||||
343 | # Not fatal, but we might want to address it. | ||||
344 | my $handler = $callbacks->{'Handler'}; | ||||
345 | $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) }; | ||||
346 | } | ||||
347 | return $res; | ||||
348 | } | ||||
349 | else { | ||||
350 | $self->{Methods}->{'start_element'} = sub { }; | ||||
351 | } | ||||
352 | } | ||||
353 | |||||
354 | } | ||||
355 | |||||
356 | sub external_entity_decl { | ||||
357 | my $self = shift; | ||||
358 | if (defined $self->{Methods}->{'external_entity_decl'}) { | ||||
359 | $self->{Methods}->{'external_entity_decl'}->(@_); | ||||
360 | } | ||||
361 | else { | ||||
362 | my $method; | ||||
363 | my $callbacks; | ||||
364 | if (exists $self->{ParseOptions}) { | ||||
365 | $callbacks = $self->{ParseOptions}; | ||||
366 | } | ||||
367 | else { | ||||
368 | $callbacks = $self; | ||||
369 | } | ||||
370 | if (0) { # dummy to make elsif's below compile | ||||
371 | } | ||||
372 | elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('external_entity_decl') ) { | ||||
373 | my $handler = $callbacks->{'DeclHandler'}; | ||||
374 | $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) }; | ||||
375 | return $method->($handler, @_); | ||||
376 | } | ||||
377 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('external_entity_decl') ) { | ||||
378 | my $handler = $callbacks->{'Handler'}; | ||||
379 | $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) }; | ||||
380 | return $method->($handler, @_); | ||||
381 | } | ||||
382 | elsif (defined $callbacks->{'DeclHandler'} | ||||
383 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') | ||||
384 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
385 | ) | ||||
386 | { | ||||
387 | my $res = eval { $callbacks->{'DeclHandler'}->external_entity_decl(@_) }; | ||||
388 | if ($@) { | ||||
389 | die $@; | ||||
390 | } | ||||
391 | else { | ||||
392 | # I think there's a buggette here... | ||||
393 | # if the first call throws an exception, we don't set it up right. | ||||
394 | # Not fatal, but we might want to address it. | ||||
395 | my $handler = $callbacks->{'DeclHandler'}; | ||||
396 | $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) }; | ||||
397 | } | ||||
398 | return $res; | ||||
399 | } | ||||
400 | elsif (defined $callbacks->{'Handler'} | ||||
401 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
402 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
403 | ) | ||||
404 | { | ||||
405 | my $res = eval { $callbacks->{'Handler'}->external_entity_decl(@_) }; | ||||
406 | if ($@) { | ||||
407 | die $@; | ||||
408 | } | ||||
409 | else { | ||||
410 | # I think there's a buggette here... | ||||
411 | # if the first call throws an exception, we don't set it up right. | ||||
412 | # Not fatal, but we might want to address it. | ||||
413 | my $handler = $callbacks->{'Handler'}; | ||||
414 | $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) }; | ||||
415 | } | ||||
416 | return $res; | ||||
417 | } | ||||
418 | else { | ||||
419 | $self->{Methods}->{'external_entity_decl'} = sub { }; | ||||
420 | } | ||||
421 | } | ||||
422 | |||||
423 | } | ||||
424 | |||||
425 | sub xml_decl { | ||||
426 | my $self = shift; | ||||
427 | if (defined $self->{Methods}->{'xml_decl'}) { | ||||
428 | $self->{Methods}->{'xml_decl'}->(@_); | ||||
429 | } | ||||
430 | else { | ||||
431 | my $method; | ||||
432 | my $callbacks; | ||||
433 | if (exists $self->{ParseOptions}) { | ||||
434 | $callbacks = $self->{ParseOptions}; | ||||
435 | } | ||||
436 | else { | ||||
437 | $callbacks = $self; | ||||
438 | } | ||||
439 | if (0) { # dummy to make elsif's below compile | ||||
440 | } | ||||
441 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('xml_decl') ) { | ||||
442 | my $handler = $callbacks->{'DTDHandler'}; | ||||
443 | $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) }; | ||||
444 | return $method->($handler, @_); | ||||
445 | } | ||||
446 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('xml_decl') ) { | ||||
447 | my $handler = $callbacks->{'Handler'}; | ||||
448 | $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) }; | ||||
449 | return $method->($handler, @_); | ||||
450 | } | ||||
451 | elsif (defined $callbacks->{'DTDHandler'} | ||||
452 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
453 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
454 | ) | ||||
455 | { | ||||
456 | my $res = eval { $callbacks->{'DTDHandler'}->xml_decl(@_) }; | ||||
457 | if ($@) { | ||||
458 | die $@; | ||||
459 | } | ||||
460 | else { | ||||
461 | # I think there's a buggette here... | ||||
462 | # if the first call throws an exception, we don't set it up right. | ||||
463 | # Not fatal, but we might want to address it. | ||||
464 | my $handler = $callbacks->{'DTDHandler'}; | ||||
465 | $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) }; | ||||
466 | } | ||||
467 | return $res; | ||||
468 | } | ||||
469 | elsif (defined $callbacks->{'Handler'} | ||||
470 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
471 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
472 | ) | ||||
473 | { | ||||
474 | my $res = eval { $callbacks->{'Handler'}->xml_decl(@_) }; | ||||
475 | if ($@) { | ||||
476 | die $@; | ||||
477 | } | ||||
478 | else { | ||||
479 | # I think there's a buggette here... | ||||
480 | # if the first call throws an exception, we don't set it up right. | ||||
481 | # Not fatal, but we might want to address it. | ||||
482 | my $handler = $callbacks->{'Handler'}; | ||||
483 | $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) }; | ||||
484 | } | ||||
485 | return $res; | ||||
486 | } | ||||
487 | else { | ||||
488 | $self->{Methods}->{'xml_decl'} = sub { }; | ||||
489 | } | ||||
490 | } | ||||
491 | |||||
492 | } | ||||
493 | |||||
494 | sub entity_decl { | ||||
495 | my $self = shift; | ||||
496 | if (defined $self->{Methods}->{'entity_decl'}) { | ||||
497 | $self->{Methods}->{'entity_decl'}->(@_); | ||||
498 | } | ||||
499 | else { | ||||
500 | my $method; | ||||
501 | my $callbacks; | ||||
502 | if (exists $self->{ParseOptions}) { | ||||
503 | $callbacks = $self->{ParseOptions}; | ||||
504 | } | ||||
505 | else { | ||||
506 | $callbacks = $self; | ||||
507 | } | ||||
508 | if (0) { # dummy to make elsif's below compile | ||||
509 | } | ||||
510 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('entity_decl') ) { | ||||
511 | my $handler = $callbacks->{'DTDHandler'}; | ||||
512 | $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) }; | ||||
513 | return $method->($handler, @_); | ||||
514 | } | ||||
515 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_decl') ) { | ||||
516 | my $handler = $callbacks->{'Handler'}; | ||||
517 | $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) }; | ||||
518 | return $method->($handler, @_); | ||||
519 | } | ||||
520 | elsif (defined $callbacks->{'DTDHandler'} | ||||
521 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
522 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
523 | ) | ||||
524 | { | ||||
525 | my $res = eval { $callbacks->{'DTDHandler'}->entity_decl(@_) }; | ||||
526 | if ($@) { | ||||
527 | die $@; | ||||
528 | } | ||||
529 | else { | ||||
530 | # I think there's a buggette here... | ||||
531 | # if the first call throws an exception, we don't set it up right. | ||||
532 | # Not fatal, but we might want to address it. | ||||
533 | my $handler = $callbacks->{'DTDHandler'}; | ||||
534 | $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) }; | ||||
535 | } | ||||
536 | return $res; | ||||
537 | } | ||||
538 | elsif (defined $callbacks->{'Handler'} | ||||
539 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
540 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
541 | ) | ||||
542 | { | ||||
543 | my $res = eval { $callbacks->{'Handler'}->entity_decl(@_) }; | ||||
544 | if ($@) { | ||||
545 | die $@; | ||||
546 | } | ||||
547 | else { | ||||
548 | # I think there's a buggette here... | ||||
549 | # if the first call throws an exception, we don't set it up right. | ||||
550 | # Not fatal, but we might want to address it. | ||||
551 | my $handler = $callbacks->{'Handler'}; | ||||
552 | $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) }; | ||||
553 | } | ||||
554 | return $res; | ||||
555 | } | ||||
556 | else { | ||||
557 | $self->{Methods}->{'entity_decl'} = sub { }; | ||||
558 | } | ||||
559 | } | ||||
560 | |||||
561 | } | ||||
562 | |||||
563 | sub end_dtd { | ||||
564 | my $self = shift; | ||||
565 | if (defined $self->{Methods}->{'end_dtd'}) { | ||||
566 | $self->{Methods}->{'end_dtd'}->(@_); | ||||
567 | } | ||||
568 | else { | ||||
569 | my $method; | ||||
570 | my $callbacks; | ||||
571 | if (exists $self->{ParseOptions}) { | ||||
572 | $callbacks = $self->{ParseOptions}; | ||||
573 | } | ||||
574 | else { | ||||
575 | $callbacks = $self; | ||||
576 | } | ||||
577 | if (0) { # dummy to make elsif's below compile | ||||
578 | } | ||||
579 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_dtd') ) { | ||||
580 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
581 | $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) }; | ||||
582 | return $method->($handler, @_); | ||||
583 | } | ||||
584 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_dtd') ) { | ||||
585 | my $handler = $callbacks->{'Handler'}; | ||||
586 | $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) }; | ||||
587 | return $method->($handler, @_); | ||||
588 | } | ||||
589 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
590 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
591 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
592 | ) | ||||
593 | { | ||||
594 | my $res = eval { $callbacks->{'LexicalHandler'}->end_dtd(@_) }; | ||||
595 | if ($@) { | ||||
596 | die $@; | ||||
597 | } | ||||
598 | else { | ||||
599 | # I think there's a buggette here... | ||||
600 | # if the first call throws an exception, we don't set it up right. | ||||
601 | # Not fatal, but we might want to address it. | ||||
602 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
603 | $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) }; | ||||
604 | } | ||||
605 | return $res; | ||||
606 | } | ||||
607 | elsif (defined $callbacks->{'Handler'} | ||||
608 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
609 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
610 | ) | ||||
611 | { | ||||
612 | my $res = eval { $callbacks->{'Handler'}->end_dtd(@_) }; | ||||
613 | if ($@) { | ||||
614 | die $@; | ||||
615 | } | ||||
616 | else { | ||||
617 | # I think there's a buggette here... | ||||
618 | # if the first call throws an exception, we don't set it up right. | ||||
619 | # Not fatal, but we might want to address it. | ||||
620 | my $handler = $callbacks->{'Handler'}; | ||||
621 | $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) }; | ||||
622 | } | ||||
623 | return $res; | ||||
624 | } | ||||
625 | else { | ||||
626 | $self->{Methods}->{'end_dtd'} = sub { }; | ||||
627 | } | ||||
628 | } | ||||
629 | |||||
630 | } | ||||
631 | |||||
632 | sub unparsed_entity_decl { | ||||
633 | my $self = shift; | ||||
634 | if (defined $self->{Methods}->{'unparsed_entity_decl'}) { | ||||
635 | $self->{Methods}->{'unparsed_entity_decl'}->(@_); | ||||
636 | } | ||||
637 | else { | ||||
638 | my $method; | ||||
639 | my $callbacks; | ||||
640 | if (exists $self->{ParseOptions}) { | ||||
641 | $callbacks = $self->{ParseOptions}; | ||||
642 | } | ||||
643 | else { | ||||
644 | $callbacks = $self; | ||||
645 | } | ||||
646 | if (0) { # dummy to make elsif's below compile | ||||
647 | } | ||||
648 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('unparsed_entity_decl') ) { | ||||
649 | my $handler = $callbacks->{'DTDHandler'}; | ||||
650 | $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) }; | ||||
651 | return $method->($handler, @_); | ||||
652 | } | ||||
653 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('unparsed_entity_decl') ) { | ||||
654 | my $handler = $callbacks->{'Handler'}; | ||||
655 | $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) }; | ||||
656 | return $method->($handler, @_); | ||||
657 | } | ||||
658 | elsif (defined $callbacks->{'DTDHandler'} | ||||
659 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
660 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
661 | ) | ||||
662 | { | ||||
663 | my $res = eval { $callbacks->{'DTDHandler'}->unparsed_entity_decl(@_) }; | ||||
664 | if ($@) { | ||||
665 | die $@; | ||||
666 | } | ||||
667 | else { | ||||
668 | # I think there's a buggette here... | ||||
669 | # if the first call throws an exception, we don't set it up right. | ||||
670 | # Not fatal, but we might want to address it. | ||||
671 | my $handler = $callbacks->{'DTDHandler'}; | ||||
672 | $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) }; | ||||
673 | } | ||||
674 | return $res; | ||||
675 | } | ||||
676 | elsif (defined $callbacks->{'Handler'} | ||||
677 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
678 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
679 | ) | ||||
680 | { | ||||
681 | my $res = eval { $callbacks->{'Handler'}->unparsed_entity_decl(@_) }; | ||||
682 | if ($@) { | ||||
683 | die $@; | ||||
684 | } | ||||
685 | else { | ||||
686 | # I think there's a buggette here... | ||||
687 | # if the first call throws an exception, we don't set it up right. | ||||
688 | # Not fatal, but we might want to address it. | ||||
689 | my $handler = $callbacks->{'Handler'}; | ||||
690 | $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) }; | ||||
691 | } | ||||
692 | return $res; | ||||
693 | } | ||||
694 | else { | ||||
695 | $self->{Methods}->{'unparsed_entity_decl'} = sub { }; | ||||
696 | } | ||||
697 | } | ||||
698 | |||||
699 | } | ||||
700 | |||||
701 | sub processing_instruction { | ||||
702 | my $self = shift; | ||||
703 | if (defined $self->{Methods}->{'processing_instruction'}) { | ||||
704 | $self->{Methods}->{'processing_instruction'}->(@_); | ||||
705 | } | ||||
706 | else { | ||||
707 | my $method; | ||||
708 | my $callbacks; | ||||
709 | if (exists $self->{ParseOptions}) { | ||||
710 | $callbacks = $self->{ParseOptions}; | ||||
711 | } | ||||
712 | else { | ||||
713 | $callbacks = $self; | ||||
714 | } | ||||
715 | if (0) { # dummy to make elsif's below compile | ||||
716 | } | ||||
717 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('processing_instruction') ) { | ||||
718 | my $handler = $callbacks->{'ContentHandler'}; | ||||
719 | $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) }; | ||||
720 | return $method->($handler, @_); | ||||
721 | } | ||||
722 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('processing_instruction') ) { | ||||
723 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
724 | $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) }; | ||||
725 | return $method->($handler, @_); | ||||
726 | } | ||||
727 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('processing_instruction') ) { | ||||
728 | my $handler = $callbacks->{'Handler'}; | ||||
729 | $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) }; | ||||
730 | return $method->($handler, @_); | ||||
731 | } | ||||
732 | elsif (defined $callbacks->{'ContentHandler'} | ||||
733 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
734 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
735 | ) | ||||
736 | { | ||||
737 | my $res = eval { $callbacks->{'ContentHandler'}->processing_instruction(@_) }; | ||||
738 | if ($@) { | ||||
739 | die $@; | ||||
740 | } | ||||
741 | else { | ||||
742 | # I think there's a buggette here... | ||||
743 | # if the first call throws an exception, we don't set it up right. | ||||
744 | # Not fatal, but we might want to address it. | ||||
745 | my $handler = $callbacks->{'ContentHandler'}; | ||||
746 | $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) }; | ||||
747 | } | ||||
748 | return $res; | ||||
749 | } | ||||
750 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
751 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
752 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
753 | ) | ||||
754 | { | ||||
755 | my $res = eval { $callbacks->{'DocumentHandler'}->processing_instruction(@_) }; | ||||
756 | if ($@) { | ||||
757 | die $@; | ||||
758 | } | ||||
759 | else { | ||||
760 | # I think there's a buggette here... | ||||
761 | # if the first call throws an exception, we don't set it up right. | ||||
762 | # Not fatal, but we might want to address it. | ||||
763 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
764 | $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) }; | ||||
765 | } | ||||
766 | return $res; | ||||
767 | } | ||||
768 | elsif (defined $callbacks->{'Handler'} | ||||
769 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
770 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
771 | ) | ||||
772 | { | ||||
773 | my $res = eval { $callbacks->{'Handler'}->processing_instruction(@_) }; | ||||
774 | if ($@) { | ||||
775 | die $@; | ||||
776 | } | ||||
777 | else { | ||||
778 | # I think there's a buggette here... | ||||
779 | # if the first call throws an exception, we don't set it up right. | ||||
780 | # Not fatal, but we might want to address it. | ||||
781 | my $handler = $callbacks->{'Handler'}; | ||||
782 | $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) }; | ||||
783 | } | ||||
784 | return $res; | ||||
785 | } | ||||
786 | else { | ||||
787 | $self->{Methods}->{'processing_instruction'} = sub { }; | ||||
788 | } | ||||
789 | } | ||||
790 | |||||
791 | } | ||||
792 | |||||
793 | sub attribute_decl { | ||||
794 | my $self = shift; | ||||
795 | if (defined $self->{Methods}->{'attribute_decl'}) { | ||||
796 | $self->{Methods}->{'attribute_decl'}->(@_); | ||||
797 | } | ||||
798 | else { | ||||
799 | my $method; | ||||
800 | my $callbacks; | ||||
801 | if (exists $self->{ParseOptions}) { | ||||
802 | $callbacks = $self->{ParseOptions}; | ||||
803 | } | ||||
804 | else { | ||||
805 | $callbacks = $self; | ||||
806 | } | ||||
807 | if (0) { # dummy to make elsif's below compile | ||||
808 | } | ||||
809 | elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('attribute_decl') ) { | ||||
810 | my $handler = $callbacks->{'DeclHandler'}; | ||||
811 | $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) }; | ||||
812 | return $method->($handler, @_); | ||||
813 | } | ||||
814 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attribute_decl') ) { | ||||
815 | my $handler = $callbacks->{'Handler'}; | ||||
816 | $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) }; | ||||
817 | return $method->($handler, @_); | ||||
818 | } | ||||
819 | elsif (defined $callbacks->{'DeclHandler'} | ||||
820 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') | ||||
821 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
822 | ) | ||||
823 | { | ||||
824 | my $res = eval { $callbacks->{'DeclHandler'}->attribute_decl(@_) }; | ||||
825 | if ($@) { | ||||
826 | die $@; | ||||
827 | } | ||||
828 | else { | ||||
829 | # I think there's a buggette here... | ||||
830 | # if the first call throws an exception, we don't set it up right. | ||||
831 | # Not fatal, but we might want to address it. | ||||
832 | my $handler = $callbacks->{'DeclHandler'}; | ||||
833 | $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) }; | ||||
834 | } | ||||
835 | return $res; | ||||
836 | } | ||||
837 | elsif (defined $callbacks->{'Handler'} | ||||
838 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
839 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
840 | ) | ||||
841 | { | ||||
842 | my $res = eval { $callbacks->{'Handler'}->attribute_decl(@_) }; | ||||
843 | if ($@) { | ||||
844 | die $@; | ||||
845 | } | ||||
846 | else { | ||||
847 | # I think there's a buggette here... | ||||
848 | # if the first call throws an exception, we don't set it up right. | ||||
849 | # Not fatal, but we might want to address it. | ||||
850 | my $handler = $callbacks->{'Handler'}; | ||||
851 | $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) }; | ||||
852 | } | ||||
853 | return $res; | ||||
854 | } | ||||
855 | else { | ||||
856 | $self->{Methods}->{'attribute_decl'} = sub { }; | ||||
857 | } | ||||
858 | } | ||||
859 | |||||
860 | } | ||||
861 | |||||
862 | sub fatal_error { | ||||
863 | my $self = shift; | ||||
864 | if (defined $self->{Methods}->{'fatal_error'}) { | ||||
865 | $self->{Methods}->{'fatal_error'}->(@_); | ||||
866 | } | ||||
867 | else { | ||||
868 | my $method; | ||||
869 | my $callbacks; | ||||
870 | if (exists $self->{ParseOptions}) { | ||||
871 | $callbacks = $self->{ParseOptions}; | ||||
872 | } | ||||
873 | else { | ||||
874 | $callbacks = $self; | ||||
875 | } | ||||
876 | if (0) { # dummy to make elsif's below compile | ||||
877 | } | ||||
878 | elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('fatal_error') ) { | ||||
879 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
880 | $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) }; | ||||
881 | return $method->($handler, @_); | ||||
882 | } | ||||
883 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('fatal_error') ) { | ||||
884 | my $handler = $callbacks->{'Handler'}; | ||||
885 | $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) }; | ||||
886 | return $method->($handler, @_); | ||||
887 | } | ||||
888 | elsif (defined $callbacks->{'ErrorHandler'} | ||||
889 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') | ||||
890 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
891 | ) | ||||
892 | { | ||||
893 | my $res = eval { $callbacks->{'ErrorHandler'}->fatal_error(@_) }; | ||||
894 | if ($@) { | ||||
895 | die $@; | ||||
896 | } | ||||
897 | else { | ||||
898 | # I think there's a buggette here... | ||||
899 | # if the first call throws an exception, we don't set it up right. | ||||
900 | # Not fatal, but we might want to address it. | ||||
901 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
902 | $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) }; | ||||
903 | } | ||||
904 | return $res; | ||||
905 | } | ||||
906 | elsif (defined $callbacks->{'Handler'} | ||||
907 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
908 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
909 | ) | ||||
910 | { | ||||
911 | my $res = eval { $callbacks->{'Handler'}->fatal_error(@_) }; | ||||
912 | if ($@) { | ||||
913 | die $@; | ||||
914 | } | ||||
915 | else { | ||||
916 | # I think there's a buggette here... | ||||
917 | # if the first call throws an exception, we don't set it up right. | ||||
918 | # Not fatal, but we might want to address it. | ||||
919 | my $handler = $callbacks->{'Handler'}; | ||||
920 | $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) }; | ||||
921 | } | ||||
922 | return $res; | ||||
923 | } | ||||
924 | else { | ||||
925 | $self->{Methods}->{'fatal_error'} = sub { }; | ||||
926 | } | ||||
927 | } | ||||
928 | |||||
929 | } | ||||
930 | |||||
931 | sub end_cdata { | ||||
932 | my $self = shift; | ||||
933 | if (defined $self->{Methods}->{'end_cdata'}) { | ||||
934 | $self->{Methods}->{'end_cdata'}->(@_); | ||||
935 | } | ||||
936 | else { | ||||
937 | my $method; | ||||
938 | my $callbacks; | ||||
939 | if (exists $self->{ParseOptions}) { | ||||
940 | $callbacks = $self->{ParseOptions}; | ||||
941 | } | ||||
942 | else { | ||||
943 | $callbacks = $self; | ||||
944 | } | ||||
945 | if (0) { # dummy to make elsif's below compile | ||||
946 | } | ||||
947 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_cdata') ) { | ||||
948 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
949 | $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) }; | ||||
950 | return $method->($handler, @_); | ||||
951 | } | ||||
952 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_cdata') ) { | ||||
953 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
954 | $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) }; | ||||
955 | return $method->($handler, @_); | ||||
956 | } | ||||
957 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_cdata') ) { | ||||
958 | my $handler = $callbacks->{'Handler'}; | ||||
959 | $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) }; | ||||
960 | return $method->($handler, @_); | ||||
961 | } | ||||
962 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
963 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
964 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
965 | ) | ||||
966 | { | ||||
967 | my $res = eval { $callbacks->{'DocumentHandler'}->end_cdata(@_) }; | ||||
968 | if ($@) { | ||||
969 | die $@; | ||||
970 | } | ||||
971 | else { | ||||
972 | # I think there's a buggette here... | ||||
973 | # if the first call throws an exception, we don't set it up right. | ||||
974 | # Not fatal, but we might want to address it. | ||||
975 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
976 | $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) }; | ||||
977 | } | ||||
978 | return $res; | ||||
979 | } | ||||
980 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
981 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
982 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
983 | ) | ||||
984 | { | ||||
985 | my $res = eval { $callbacks->{'LexicalHandler'}->end_cdata(@_) }; | ||||
986 | if ($@) { | ||||
987 | die $@; | ||||
988 | } | ||||
989 | else { | ||||
990 | # I think there's a buggette here... | ||||
991 | # if the first call throws an exception, we don't set it up right. | ||||
992 | # Not fatal, but we might want to address it. | ||||
993 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
994 | $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) }; | ||||
995 | } | ||||
996 | return $res; | ||||
997 | } | ||||
998 | elsif (defined $callbacks->{'Handler'} | ||||
999 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1000 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1001 | ) | ||||
1002 | { | ||||
1003 | my $res = eval { $callbacks->{'Handler'}->end_cdata(@_) }; | ||||
1004 | if ($@) { | ||||
1005 | die $@; | ||||
1006 | } | ||||
1007 | else { | ||||
1008 | # I think there's a buggette here... | ||||
1009 | # if the first call throws an exception, we don't set it up right. | ||||
1010 | # Not fatal, but we might want to address it. | ||||
1011 | my $handler = $callbacks->{'Handler'}; | ||||
1012 | $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) }; | ||||
1013 | } | ||||
1014 | return $res; | ||||
1015 | } | ||||
1016 | else { | ||||
1017 | $self->{Methods}->{'end_cdata'} = sub { }; | ||||
1018 | } | ||||
1019 | } | ||||
1020 | |||||
1021 | } | ||||
1022 | |||||
1023 | sub start_entity { | ||||
1024 | my $self = shift; | ||||
1025 | if (defined $self->{Methods}->{'start_entity'}) { | ||||
1026 | $self->{Methods}->{'start_entity'}->(@_); | ||||
1027 | } | ||||
1028 | else { | ||||
1029 | my $method; | ||||
1030 | my $callbacks; | ||||
1031 | if (exists $self->{ParseOptions}) { | ||||
1032 | $callbacks = $self->{ParseOptions}; | ||||
1033 | } | ||||
1034 | else { | ||||
1035 | $callbacks = $self; | ||||
1036 | } | ||||
1037 | if (0) { # dummy to make elsif's below compile | ||||
1038 | } | ||||
1039 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_entity') ) { | ||||
1040 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1041 | $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) }; | ||||
1042 | return $method->($handler, @_); | ||||
1043 | } | ||||
1044 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_entity') ) { | ||||
1045 | my $handler = $callbacks->{'Handler'}; | ||||
1046 | $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) }; | ||||
1047 | return $method->($handler, @_); | ||||
1048 | } | ||||
1049 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
1050 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
1051 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1052 | ) | ||||
1053 | { | ||||
1054 | my $res = eval { $callbacks->{'LexicalHandler'}->start_entity(@_) }; | ||||
1055 | if ($@) { | ||||
1056 | die $@; | ||||
1057 | } | ||||
1058 | else { | ||||
1059 | # I think there's a buggette here... | ||||
1060 | # if the first call throws an exception, we don't set it up right. | ||||
1061 | # Not fatal, but we might want to address it. | ||||
1062 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1063 | $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) }; | ||||
1064 | } | ||||
1065 | return $res; | ||||
1066 | } | ||||
1067 | elsif (defined $callbacks->{'Handler'} | ||||
1068 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1069 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1070 | ) | ||||
1071 | { | ||||
1072 | my $res = eval { $callbacks->{'Handler'}->start_entity(@_) }; | ||||
1073 | if ($@) { | ||||
1074 | die $@; | ||||
1075 | } | ||||
1076 | else { | ||||
1077 | # I think there's a buggette here... | ||||
1078 | # if the first call throws an exception, we don't set it up right. | ||||
1079 | # Not fatal, but we might want to address it. | ||||
1080 | my $handler = $callbacks->{'Handler'}; | ||||
1081 | $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) }; | ||||
1082 | } | ||||
1083 | return $res; | ||||
1084 | } | ||||
1085 | else { | ||||
1086 | $self->{Methods}->{'start_entity'} = sub { }; | ||||
1087 | } | ||||
1088 | } | ||||
1089 | |||||
1090 | } | ||||
1091 | |||||
1092 | sub start_prefix_mapping { | ||||
1093 | my $self = shift; | ||||
1094 | if (defined $self->{Methods}->{'start_prefix_mapping'}) { | ||||
1095 | $self->{Methods}->{'start_prefix_mapping'}->(@_); | ||||
1096 | } | ||||
1097 | else { | ||||
1098 | my $method; | ||||
1099 | my $callbacks; | ||||
1100 | if (exists $self->{ParseOptions}) { | ||||
1101 | $callbacks = $self->{ParseOptions}; | ||||
1102 | } | ||||
1103 | else { | ||||
1104 | $callbacks = $self; | ||||
1105 | } | ||||
1106 | if (0) { # dummy to make elsif's below compile | ||||
1107 | } | ||||
1108 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_prefix_mapping') ) { | ||||
1109 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1110 | $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) }; | ||||
1111 | return $method->($handler, @_); | ||||
1112 | } | ||||
1113 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_prefix_mapping') ) { | ||||
1114 | my $handler = $callbacks->{'Handler'}; | ||||
1115 | $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) }; | ||||
1116 | return $method->($handler, @_); | ||||
1117 | } | ||||
1118 | elsif (defined $callbacks->{'ContentHandler'} | ||||
1119 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
1120 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1121 | ) | ||||
1122 | { | ||||
1123 | my $res = eval { $callbacks->{'ContentHandler'}->start_prefix_mapping(@_) }; | ||||
1124 | if ($@) { | ||||
1125 | die $@; | ||||
1126 | } | ||||
1127 | else { | ||||
1128 | # I think there's a buggette here... | ||||
1129 | # if the first call throws an exception, we don't set it up right. | ||||
1130 | # Not fatal, but we might want to address it. | ||||
1131 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1132 | $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) }; | ||||
1133 | } | ||||
1134 | return $res; | ||||
1135 | } | ||||
1136 | elsif (defined $callbacks->{'Handler'} | ||||
1137 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1138 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1139 | ) | ||||
1140 | { | ||||
1141 | my $res = eval { $callbacks->{'Handler'}->start_prefix_mapping(@_) }; | ||||
1142 | if ($@) { | ||||
1143 | die $@; | ||||
1144 | } | ||||
1145 | else { | ||||
1146 | # I think there's a buggette here... | ||||
1147 | # if the first call throws an exception, we don't set it up right. | ||||
1148 | # Not fatal, but we might want to address it. | ||||
1149 | my $handler = $callbacks->{'Handler'}; | ||||
1150 | $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) }; | ||||
1151 | } | ||||
1152 | return $res; | ||||
1153 | } | ||||
1154 | else { | ||||
1155 | $self->{Methods}->{'start_prefix_mapping'} = sub { }; | ||||
1156 | } | ||||
1157 | } | ||||
1158 | |||||
1159 | } | ||||
1160 | |||||
1161 | sub error { | ||||
1162 | my $self = shift; | ||||
1163 | if (defined $self->{Methods}->{'error'}) { | ||||
1164 | $self->{Methods}->{'error'}->(@_); | ||||
1165 | } | ||||
1166 | else { | ||||
1167 | my $method; | ||||
1168 | my $callbacks; | ||||
1169 | if (exists $self->{ParseOptions}) { | ||||
1170 | $callbacks = $self->{ParseOptions}; | ||||
1171 | } | ||||
1172 | else { | ||||
1173 | $callbacks = $self; | ||||
1174 | } | ||||
1175 | if (0) { # dummy to make elsif's below compile | ||||
1176 | } | ||||
1177 | elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('error') ) { | ||||
1178 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
1179 | $self->{Methods}->{'error'} = sub { $method->($handler, @_) }; | ||||
1180 | return $method->($handler, @_); | ||||
1181 | } | ||||
1182 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('error') ) { | ||||
1183 | my $handler = $callbacks->{'Handler'}; | ||||
1184 | $self->{Methods}->{'error'} = sub { $method->($handler, @_) }; | ||||
1185 | return $method->($handler, @_); | ||||
1186 | } | ||||
1187 | elsif (defined $callbacks->{'ErrorHandler'} | ||||
1188 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') | ||||
1189 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1190 | ) | ||||
1191 | { | ||||
1192 | my $res = eval { $callbacks->{'ErrorHandler'}->error(@_) }; | ||||
1193 | if ($@) { | ||||
1194 | die $@; | ||||
1195 | } | ||||
1196 | else { | ||||
1197 | # I think there's a buggette here... | ||||
1198 | # if the first call throws an exception, we don't set it up right. | ||||
1199 | # Not fatal, but we might want to address it. | ||||
1200 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
1201 | $self->{Methods}->{'error'} = sub { $handler->error(@_) }; | ||||
1202 | } | ||||
1203 | return $res; | ||||
1204 | } | ||||
1205 | elsif (defined $callbacks->{'Handler'} | ||||
1206 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1207 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1208 | ) | ||||
1209 | { | ||||
1210 | my $res = eval { $callbacks->{'Handler'}->error(@_) }; | ||||
1211 | if ($@) { | ||||
1212 | die $@; | ||||
1213 | } | ||||
1214 | else { | ||||
1215 | # I think there's a buggette here... | ||||
1216 | # if the first call throws an exception, we don't set it up right. | ||||
1217 | # Not fatal, but we might want to address it. | ||||
1218 | my $handler = $callbacks->{'Handler'}; | ||||
1219 | $self->{Methods}->{'error'} = sub { $handler->error(@_) }; | ||||
1220 | } | ||||
1221 | return $res; | ||||
1222 | } | ||||
1223 | else { | ||||
1224 | $self->{Methods}->{'error'} = sub { }; | ||||
1225 | } | ||||
1226 | } | ||||
1227 | |||||
1228 | } | ||||
1229 | |||||
1230 | # spent 283ms (271+12.8) within XML::SAX::Base::start_document which was called 10000 times, avg 28µs/call:
# 5000 times (166ms+117ms) by XML::SAX::Expat::_handle_start_document at line 472 of XML/SAX/Expat.pm, avg 57µs/call
# 5000 times (104ms+-104ms) by XML::SAX::Base::start_document at line 1259, avg 0s/call | ||||
1231 | 85000 | 286ms | my $self = shift; | ||
1232 | if (defined $self->{Methods}->{'start_document'}) { | ||||
1233 | $self->{Methods}->{'start_document'}->(@_); | ||||
1234 | } | ||||
1235 | else { | ||||
1236 | my $method; | ||||
1237 | my $callbacks; | ||||
1238 | if (exists $self->{ParseOptions}) { | ||||
1239 | $callbacks = $self->{ParseOptions}; | ||||
1240 | } | ||||
1241 | else { | ||||
1242 | $callbacks = $self; | ||||
1243 | } | ||||
1244 | 5000 | 12.8ms | if (0) { # dummy to make elsif's below compile # spent 12.8ms making 5000 calls to UNIVERSAL::can, avg 3µs/call | ||
1245 | } | ||||
1246 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_document') ) { | ||||
1247 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1248 | $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) }; | ||||
1249 | return $method->($handler, @_); | ||||
1250 | } | ||||
1251 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_document') ) { | ||||
1252 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1253 | $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) }; | ||||
1254 | return $method->($handler, @_); | ||||
1255 | } | ||||
1256 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_document') ) { | ||||
1257 | my $handler = $callbacks->{'Handler'}; | ||||
1258 | $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) }; | ||||
1259 | 5000 | 0s | return $method->($handler, @_); # spent 104ms making 5000 calls to XML::SAX::Base::start_document, avg 21µs/call, recursion: max depth 1, sum of overlapping time 104ms | ||
1260 | } | ||||
1261 | elsif (defined $callbacks->{'ContentHandler'} | ||||
1262 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
1263 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1264 | ) | ||||
1265 | { | ||||
1266 | my $res = eval { $callbacks->{'ContentHandler'}->start_document(@_) }; | ||||
1267 | if ($@) { | ||||
1268 | die $@; | ||||
1269 | } | ||||
1270 | else { | ||||
1271 | # I think there's a buggette here... | ||||
1272 | # if the first call throws an exception, we don't set it up right. | ||||
1273 | # Not fatal, but we might want to address it. | ||||
1274 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1275 | $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) }; | ||||
1276 | } | ||||
1277 | return $res; | ||||
1278 | } | ||||
1279 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1280 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1281 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1282 | ) | ||||
1283 | { | ||||
1284 | my $res = eval { $callbacks->{'DocumentHandler'}->start_document(@_) }; | ||||
1285 | if ($@) { | ||||
1286 | die $@; | ||||
1287 | } | ||||
1288 | else { | ||||
1289 | # I think there's a buggette here... | ||||
1290 | # if the first call throws an exception, we don't set it up right. | ||||
1291 | # Not fatal, but we might want to address it. | ||||
1292 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1293 | $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) }; | ||||
1294 | } | ||||
1295 | return $res; | ||||
1296 | } | ||||
1297 | elsif (defined $callbacks->{'Handler'} | ||||
1298 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1299 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1300 | ) | ||||
1301 | { | ||||
1302 | my $res = eval { $callbacks->{'Handler'}->start_document(@_) }; | ||||
1303 | if ($@) { | ||||
1304 | die $@; | ||||
1305 | } | ||||
1306 | else { | ||||
1307 | # I think there's a buggette here... | ||||
1308 | # if the first call throws an exception, we don't set it up right. | ||||
1309 | # Not fatal, but we might want to address it. | ||||
1310 | my $handler = $callbacks->{'Handler'}; | ||||
1311 | $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) }; | ||||
1312 | } | ||||
1313 | return $res; | ||||
1314 | } | ||||
1315 | else { | ||||
1316 | $self->{Methods}->{'start_document'} = sub { }; | ||||
1317 | } | ||||
1318 | } | ||||
1319 | |||||
1320 | } | ||||
1321 | |||||
1322 | sub ignorable_whitespace { | ||||
1323 | my $self = shift; | ||||
1324 | if (defined $self->{Methods}->{'ignorable_whitespace'}) { | ||||
1325 | $self->{Methods}->{'ignorable_whitespace'}->(@_); | ||||
1326 | } | ||||
1327 | else { | ||||
1328 | my $method; | ||||
1329 | my $callbacks; | ||||
1330 | if (exists $self->{ParseOptions}) { | ||||
1331 | $callbacks = $self->{ParseOptions}; | ||||
1332 | } | ||||
1333 | else { | ||||
1334 | $callbacks = $self; | ||||
1335 | } | ||||
1336 | if (0) { # dummy to make elsif's below compile | ||||
1337 | } | ||||
1338 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('ignorable_whitespace') ) { | ||||
1339 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1340 | $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) }; | ||||
1341 | return $method->($handler, @_); | ||||
1342 | } | ||||
1343 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('ignorable_whitespace') ) { | ||||
1344 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1345 | $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) }; | ||||
1346 | return $method->($handler, @_); | ||||
1347 | } | ||||
1348 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('ignorable_whitespace') ) { | ||||
1349 | my $handler = $callbacks->{'Handler'}; | ||||
1350 | $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) }; | ||||
1351 | return $method->($handler, @_); | ||||
1352 | } | ||||
1353 | elsif (defined $callbacks->{'ContentHandler'} | ||||
1354 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
1355 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1356 | ) | ||||
1357 | { | ||||
1358 | my $res = eval { $callbacks->{'ContentHandler'}->ignorable_whitespace(@_) }; | ||||
1359 | if ($@) { | ||||
1360 | die $@; | ||||
1361 | } | ||||
1362 | else { | ||||
1363 | # I think there's a buggette here... | ||||
1364 | # if the first call throws an exception, we don't set it up right. | ||||
1365 | # Not fatal, but we might want to address it. | ||||
1366 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1367 | $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) }; | ||||
1368 | } | ||||
1369 | return $res; | ||||
1370 | } | ||||
1371 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1372 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1373 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1374 | ) | ||||
1375 | { | ||||
1376 | my $res = eval { $callbacks->{'DocumentHandler'}->ignorable_whitespace(@_) }; | ||||
1377 | if ($@) { | ||||
1378 | die $@; | ||||
1379 | } | ||||
1380 | else { | ||||
1381 | # I think there's a buggette here... | ||||
1382 | # if the first call throws an exception, we don't set it up right. | ||||
1383 | # Not fatal, but we might want to address it. | ||||
1384 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1385 | $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) }; | ||||
1386 | } | ||||
1387 | return $res; | ||||
1388 | } | ||||
1389 | elsif (defined $callbacks->{'Handler'} | ||||
1390 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1391 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1392 | ) | ||||
1393 | { | ||||
1394 | my $res = eval { $callbacks->{'Handler'}->ignorable_whitespace(@_) }; | ||||
1395 | if ($@) { | ||||
1396 | die $@; | ||||
1397 | } | ||||
1398 | else { | ||||
1399 | # I think there's a buggette here... | ||||
1400 | # if the first call throws an exception, we don't set it up right. | ||||
1401 | # Not fatal, but we might want to address it. | ||||
1402 | my $handler = $callbacks->{'Handler'}; | ||||
1403 | $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) }; | ||||
1404 | } | ||||
1405 | return $res; | ||||
1406 | } | ||||
1407 | else { | ||||
1408 | $self->{Methods}->{'ignorable_whitespace'} = sub { }; | ||||
1409 | } | ||||
1410 | } | ||||
1411 | |||||
1412 | } | ||||
1413 | |||||
1414 | # spent 297ms (282+14.4) within XML::SAX::Base::end_document which was called 10000 times, avg 30µs/call:
# 5000 times (167ms+130ms) by XML::SAX::Expat::_handle_final at line 167 of XML/SAX/Expat.pm, avg 59µs/call
# 5000 times (116ms+-116ms) by XML::SAX::Base::end_document at line 1443, avg 0s/call | ||||
1415 | 85000 | 299ms | my $self = shift; | ||
1416 | if (defined $self->{Methods}->{'end_document'}) { | ||||
1417 | $self->{Methods}->{'end_document'}->(@_); | ||||
1418 | } | ||||
1419 | else { | ||||
1420 | my $method; | ||||
1421 | my $callbacks; | ||||
1422 | if (exists $self->{ParseOptions}) { | ||||
1423 | $callbacks = $self->{ParseOptions}; | ||||
1424 | } | ||||
1425 | else { | ||||
1426 | $callbacks = $self; | ||||
1427 | } | ||||
1428 | 5000 | 14.4ms | if (0) { # dummy to make elsif's below compile # spent 14.4ms making 5000 calls to UNIVERSAL::can, avg 3µs/call | ||
1429 | } | ||||
1430 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_document') ) { | ||||
1431 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1432 | $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) }; | ||||
1433 | return $method->($handler, @_); | ||||
1434 | } | ||||
1435 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_document') ) { | ||||
1436 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1437 | $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) }; | ||||
1438 | return $method->($handler, @_); | ||||
1439 | } | ||||
1440 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_document') ) { | ||||
1441 | my $handler = $callbacks->{'Handler'}; | ||||
1442 | $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) }; | ||||
1443 | 5000 | 0s | return $method->($handler, @_); # spent 116ms making 5000 calls to XML::SAX::Base::end_document, avg 23µs/call, recursion: max depth 1, sum of overlapping time 116ms | ||
1444 | } | ||||
1445 | elsif (defined $callbacks->{'ContentHandler'} | ||||
1446 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
1447 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1448 | ) | ||||
1449 | { | ||||
1450 | my $res = eval { $callbacks->{'ContentHandler'}->end_document(@_) }; | ||||
1451 | if ($@) { | ||||
1452 | die $@; | ||||
1453 | } | ||||
1454 | else { | ||||
1455 | # I think there's a buggette here... | ||||
1456 | # if the first call throws an exception, we don't set it up right. | ||||
1457 | # Not fatal, but we might want to address it. | ||||
1458 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1459 | $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) }; | ||||
1460 | } | ||||
1461 | return $res; | ||||
1462 | } | ||||
1463 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1464 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1465 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1466 | ) | ||||
1467 | { | ||||
1468 | my $res = eval { $callbacks->{'DocumentHandler'}->end_document(@_) }; | ||||
1469 | if ($@) { | ||||
1470 | die $@; | ||||
1471 | } | ||||
1472 | else { | ||||
1473 | # I think there's a buggette here... | ||||
1474 | # if the first call throws an exception, we don't set it up right. | ||||
1475 | # Not fatal, but we might want to address it. | ||||
1476 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1477 | $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) }; | ||||
1478 | } | ||||
1479 | return $res; | ||||
1480 | } | ||||
1481 | elsif (defined $callbacks->{'Handler'} | ||||
1482 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1483 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1484 | ) | ||||
1485 | { | ||||
1486 | my $res = eval { $callbacks->{'Handler'}->end_document(@_) }; | ||||
1487 | if ($@) { | ||||
1488 | die $@; | ||||
1489 | } | ||||
1490 | else { | ||||
1491 | # I think there's a buggette here... | ||||
1492 | # if the first call throws an exception, we don't set it up right. | ||||
1493 | # Not fatal, but we might want to address it. | ||||
1494 | my $handler = $callbacks->{'Handler'}; | ||||
1495 | $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) }; | ||||
1496 | } | ||||
1497 | return $res; | ||||
1498 | } | ||||
1499 | else { | ||||
1500 | $self->{Methods}->{'end_document'} = sub { }; | ||||
1501 | } | ||||
1502 | } | ||||
1503 | |||||
1504 | } | ||||
1505 | |||||
1506 | sub start_cdata { | ||||
1507 | my $self = shift; | ||||
1508 | if (defined $self->{Methods}->{'start_cdata'}) { | ||||
1509 | $self->{Methods}->{'start_cdata'}->(@_); | ||||
1510 | } | ||||
1511 | else { | ||||
1512 | my $method; | ||||
1513 | my $callbacks; | ||||
1514 | if (exists $self->{ParseOptions}) { | ||||
1515 | $callbacks = $self->{ParseOptions}; | ||||
1516 | } | ||||
1517 | else { | ||||
1518 | $callbacks = $self; | ||||
1519 | } | ||||
1520 | if (0) { # dummy to make elsif's below compile | ||||
1521 | } | ||||
1522 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_cdata') ) { | ||||
1523 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1524 | $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) }; | ||||
1525 | return $method->($handler, @_); | ||||
1526 | } | ||||
1527 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_cdata') ) { | ||||
1528 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1529 | $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) }; | ||||
1530 | return $method->($handler, @_); | ||||
1531 | } | ||||
1532 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_cdata') ) { | ||||
1533 | my $handler = $callbacks->{'Handler'}; | ||||
1534 | $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) }; | ||||
1535 | return $method->($handler, @_); | ||||
1536 | } | ||||
1537 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1538 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1539 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1540 | ) | ||||
1541 | { | ||||
1542 | my $res = eval { $callbacks->{'DocumentHandler'}->start_cdata(@_) }; | ||||
1543 | if ($@) { | ||||
1544 | die $@; | ||||
1545 | } | ||||
1546 | else { | ||||
1547 | # I think there's a buggette here... | ||||
1548 | # if the first call throws an exception, we don't set it up right. | ||||
1549 | # Not fatal, but we might want to address it. | ||||
1550 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1551 | $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) }; | ||||
1552 | } | ||||
1553 | return $res; | ||||
1554 | } | ||||
1555 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
1556 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
1557 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1558 | ) | ||||
1559 | { | ||||
1560 | my $res = eval { $callbacks->{'LexicalHandler'}->start_cdata(@_) }; | ||||
1561 | if ($@) { | ||||
1562 | die $@; | ||||
1563 | } | ||||
1564 | else { | ||||
1565 | # I think there's a buggette here... | ||||
1566 | # if the first call throws an exception, we don't set it up right. | ||||
1567 | # Not fatal, but we might want to address it. | ||||
1568 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1569 | $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) }; | ||||
1570 | } | ||||
1571 | return $res; | ||||
1572 | } | ||||
1573 | elsif (defined $callbacks->{'Handler'} | ||||
1574 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1575 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1576 | ) | ||||
1577 | { | ||||
1578 | my $res = eval { $callbacks->{'Handler'}->start_cdata(@_) }; | ||||
1579 | if ($@) { | ||||
1580 | die $@; | ||||
1581 | } | ||||
1582 | else { | ||||
1583 | # I think there's a buggette here... | ||||
1584 | # if the first call throws an exception, we don't set it up right. | ||||
1585 | # Not fatal, but we might want to address it. | ||||
1586 | my $handler = $callbacks->{'Handler'}; | ||||
1587 | $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) }; | ||||
1588 | } | ||||
1589 | return $res; | ||||
1590 | } | ||||
1591 | else { | ||||
1592 | $self->{Methods}->{'start_cdata'} = sub { }; | ||||
1593 | } | ||||
1594 | } | ||||
1595 | |||||
1596 | } | ||||
1597 | |||||
1598 | sub set_document_locator { | ||||
1599 | my $self = shift; | ||||
1600 | if (defined $self->{Methods}->{'set_document_locator'}) { | ||||
1601 | $self->{Methods}->{'set_document_locator'}->(@_); | ||||
1602 | } | ||||
1603 | else { | ||||
1604 | my $method; | ||||
1605 | my $callbacks; | ||||
1606 | if (exists $self->{ParseOptions}) { | ||||
1607 | $callbacks = $self->{ParseOptions}; | ||||
1608 | } | ||||
1609 | else { | ||||
1610 | $callbacks = $self; | ||||
1611 | } | ||||
1612 | if (0) { # dummy to make elsif's below compile | ||||
1613 | } | ||||
1614 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('set_document_locator') ) { | ||||
1615 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1616 | $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) }; | ||||
1617 | return $method->($handler, @_); | ||||
1618 | } | ||||
1619 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('set_document_locator') ) { | ||||
1620 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1621 | $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) }; | ||||
1622 | return $method->($handler, @_); | ||||
1623 | } | ||||
1624 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('set_document_locator') ) { | ||||
1625 | my $handler = $callbacks->{'Handler'}; | ||||
1626 | $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) }; | ||||
1627 | return $method->($handler, @_); | ||||
1628 | } | ||||
1629 | elsif (defined $callbacks->{'ContentHandler'} | ||||
1630 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
1631 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1632 | ) | ||||
1633 | { | ||||
1634 | my $res = eval { $callbacks->{'ContentHandler'}->set_document_locator(@_) }; | ||||
1635 | if ($@) { | ||||
1636 | die $@; | ||||
1637 | } | ||||
1638 | else { | ||||
1639 | # I think there's a buggette here... | ||||
1640 | # if the first call throws an exception, we don't set it up right. | ||||
1641 | # Not fatal, but we might want to address it. | ||||
1642 | my $handler = $callbacks->{'ContentHandler'}; | ||||
1643 | $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) }; | ||||
1644 | } | ||||
1645 | return $res; | ||||
1646 | } | ||||
1647 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1648 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1649 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1650 | ) | ||||
1651 | { | ||||
1652 | my $res = eval { $callbacks->{'DocumentHandler'}->set_document_locator(@_) }; | ||||
1653 | if ($@) { | ||||
1654 | die $@; | ||||
1655 | } | ||||
1656 | else { | ||||
1657 | # I think there's a buggette here... | ||||
1658 | # if the first call throws an exception, we don't set it up right. | ||||
1659 | # Not fatal, but we might want to address it. | ||||
1660 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1661 | $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) }; | ||||
1662 | } | ||||
1663 | return $res; | ||||
1664 | } | ||||
1665 | elsif (defined $callbacks->{'Handler'} | ||||
1666 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1667 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1668 | ) | ||||
1669 | { | ||||
1670 | my $res = eval { $callbacks->{'Handler'}->set_document_locator(@_) }; | ||||
1671 | if ($@) { | ||||
1672 | die $@; | ||||
1673 | } | ||||
1674 | else { | ||||
1675 | # I think there's a buggette here... | ||||
1676 | # if the first call throws an exception, we don't set it up right. | ||||
1677 | # Not fatal, but we might want to address it. | ||||
1678 | my $handler = $callbacks->{'Handler'}; | ||||
1679 | $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) }; | ||||
1680 | } | ||||
1681 | return $res; | ||||
1682 | } | ||||
1683 | else { | ||||
1684 | $self->{Methods}->{'set_document_locator'} = sub { }; | ||||
1685 | } | ||||
1686 | } | ||||
1687 | |||||
1688 | } | ||||
1689 | |||||
1690 | sub attlist_decl { | ||||
1691 | my $self = shift; | ||||
1692 | if (defined $self->{Methods}->{'attlist_decl'}) { | ||||
1693 | $self->{Methods}->{'attlist_decl'}->(@_); | ||||
1694 | } | ||||
1695 | else { | ||||
1696 | my $method; | ||||
1697 | my $callbacks; | ||||
1698 | if (exists $self->{ParseOptions}) { | ||||
1699 | $callbacks = $self->{ParseOptions}; | ||||
1700 | } | ||||
1701 | else { | ||||
1702 | $callbacks = $self; | ||||
1703 | } | ||||
1704 | if (0) { # dummy to make elsif's below compile | ||||
1705 | } | ||||
1706 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('attlist_decl') ) { | ||||
1707 | my $handler = $callbacks->{'DTDHandler'}; | ||||
1708 | $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) }; | ||||
1709 | return $method->($handler, @_); | ||||
1710 | } | ||||
1711 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attlist_decl') ) { | ||||
1712 | my $handler = $callbacks->{'Handler'}; | ||||
1713 | $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) }; | ||||
1714 | return $method->($handler, @_); | ||||
1715 | } | ||||
1716 | elsif (defined $callbacks->{'DTDHandler'} | ||||
1717 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
1718 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1719 | ) | ||||
1720 | { | ||||
1721 | my $res = eval { $callbacks->{'DTDHandler'}->attlist_decl(@_) }; | ||||
1722 | if ($@) { | ||||
1723 | die $@; | ||||
1724 | } | ||||
1725 | else { | ||||
1726 | # I think there's a buggette here... | ||||
1727 | # if the first call throws an exception, we don't set it up right. | ||||
1728 | # Not fatal, but we might want to address it. | ||||
1729 | my $handler = $callbacks->{'DTDHandler'}; | ||||
1730 | $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) }; | ||||
1731 | } | ||||
1732 | return $res; | ||||
1733 | } | ||||
1734 | elsif (defined $callbacks->{'Handler'} | ||||
1735 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1736 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1737 | ) | ||||
1738 | { | ||||
1739 | my $res = eval { $callbacks->{'Handler'}->attlist_decl(@_) }; | ||||
1740 | if ($@) { | ||||
1741 | die $@; | ||||
1742 | } | ||||
1743 | else { | ||||
1744 | # I think there's a buggette here... | ||||
1745 | # if the first call throws an exception, we don't set it up right. | ||||
1746 | # Not fatal, but we might want to address it. | ||||
1747 | my $handler = $callbacks->{'Handler'}; | ||||
1748 | $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) }; | ||||
1749 | } | ||||
1750 | return $res; | ||||
1751 | } | ||||
1752 | else { | ||||
1753 | $self->{Methods}->{'attlist_decl'} = sub { }; | ||||
1754 | } | ||||
1755 | } | ||||
1756 | |||||
1757 | } | ||||
1758 | |||||
1759 | sub start_dtd { | ||||
1760 | my $self = shift; | ||||
1761 | if (defined $self->{Methods}->{'start_dtd'}) { | ||||
1762 | $self->{Methods}->{'start_dtd'}->(@_); | ||||
1763 | } | ||||
1764 | else { | ||||
1765 | my $method; | ||||
1766 | my $callbacks; | ||||
1767 | if (exists $self->{ParseOptions}) { | ||||
1768 | $callbacks = $self->{ParseOptions}; | ||||
1769 | } | ||||
1770 | else { | ||||
1771 | $callbacks = $self; | ||||
1772 | } | ||||
1773 | if (0) { # dummy to make elsif's below compile | ||||
1774 | } | ||||
1775 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_dtd') ) { | ||||
1776 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1777 | $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) }; | ||||
1778 | return $method->($handler, @_); | ||||
1779 | } | ||||
1780 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_dtd') ) { | ||||
1781 | my $handler = $callbacks->{'Handler'}; | ||||
1782 | $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) }; | ||||
1783 | return $method->($handler, @_); | ||||
1784 | } | ||||
1785 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
1786 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
1787 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1788 | ) | ||||
1789 | { | ||||
1790 | my $res = eval { $callbacks->{'LexicalHandler'}->start_dtd(@_) }; | ||||
1791 | if ($@) { | ||||
1792 | die $@; | ||||
1793 | } | ||||
1794 | else { | ||||
1795 | # I think there's a buggette here... | ||||
1796 | # if the first call throws an exception, we don't set it up right. | ||||
1797 | # Not fatal, but we might want to address it. | ||||
1798 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
1799 | $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) }; | ||||
1800 | } | ||||
1801 | return $res; | ||||
1802 | } | ||||
1803 | elsif (defined $callbacks->{'Handler'} | ||||
1804 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1805 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1806 | ) | ||||
1807 | { | ||||
1808 | my $res = eval { $callbacks->{'Handler'}->start_dtd(@_) }; | ||||
1809 | if ($@) { | ||||
1810 | die $@; | ||||
1811 | } | ||||
1812 | else { | ||||
1813 | # I think there's a buggette here... | ||||
1814 | # if the first call throws an exception, we don't set it up right. | ||||
1815 | # Not fatal, but we might want to address it. | ||||
1816 | my $handler = $callbacks->{'Handler'}; | ||||
1817 | $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) }; | ||||
1818 | } | ||||
1819 | return $res; | ||||
1820 | } | ||||
1821 | else { | ||||
1822 | $self->{Methods}->{'start_dtd'} = sub { }; | ||||
1823 | } | ||||
1824 | } | ||||
1825 | |||||
1826 | } | ||||
1827 | |||||
1828 | sub resolve_entity { | ||||
1829 | my $self = shift; | ||||
1830 | if (defined $self->{Methods}->{'resolve_entity'}) { | ||||
1831 | $self->{Methods}->{'resolve_entity'}->(@_); | ||||
1832 | } | ||||
1833 | else { | ||||
1834 | my $method; | ||||
1835 | my $callbacks; | ||||
1836 | if (exists $self->{ParseOptions}) { | ||||
1837 | $callbacks = $self->{ParseOptions}; | ||||
1838 | } | ||||
1839 | else { | ||||
1840 | $callbacks = $self; | ||||
1841 | } | ||||
1842 | if (0) { # dummy to make elsif's below compile | ||||
1843 | } | ||||
1844 | elsif (defined $callbacks->{'EntityResolver'} and $method = $callbacks->{'EntityResolver'}->can('resolve_entity') ) { | ||||
1845 | my $handler = $callbacks->{'EntityResolver'}; | ||||
1846 | $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) }; | ||||
1847 | return $method->($handler, @_); | ||||
1848 | } | ||||
1849 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('resolve_entity') ) { | ||||
1850 | my $handler = $callbacks->{'Handler'}; | ||||
1851 | $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) }; | ||||
1852 | return $method->($handler, @_); | ||||
1853 | } | ||||
1854 | elsif (defined $callbacks->{'EntityResolver'} | ||||
1855 | and $callbacks->{'EntityResolver'}->can('AUTOLOAD') | ||||
1856 | and $callbacks->{'EntityResolver'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1857 | ) | ||||
1858 | { | ||||
1859 | my $res = eval { $callbacks->{'EntityResolver'}->resolve_entity(@_) }; | ||||
1860 | if ($@) { | ||||
1861 | die $@; | ||||
1862 | } | ||||
1863 | else { | ||||
1864 | # I think there's a buggette here... | ||||
1865 | # if the first call throws an exception, we don't set it up right. | ||||
1866 | # Not fatal, but we might want to address it. | ||||
1867 | my $handler = $callbacks->{'EntityResolver'}; | ||||
1868 | $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) }; | ||||
1869 | } | ||||
1870 | return $res; | ||||
1871 | } | ||||
1872 | elsif (defined $callbacks->{'Handler'} | ||||
1873 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1874 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1875 | ) | ||||
1876 | { | ||||
1877 | my $res = eval { $callbacks->{'Handler'}->resolve_entity(@_) }; | ||||
1878 | if ($@) { | ||||
1879 | die $@; | ||||
1880 | } | ||||
1881 | else { | ||||
1882 | # I think there's a buggette here... | ||||
1883 | # if the first call throws an exception, we don't set it up right. | ||||
1884 | # Not fatal, but we might want to address it. | ||||
1885 | my $handler = $callbacks->{'Handler'}; | ||||
1886 | $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) }; | ||||
1887 | } | ||||
1888 | return $res; | ||||
1889 | } | ||||
1890 | else { | ||||
1891 | $self->{Methods}->{'resolve_entity'} = sub { }; | ||||
1892 | } | ||||
1893 | } | ||||
1894 | |||||
1895 | } | ||||
1896 | |||||
1897 | sub entity_reference { | ||||
1898 | my $self = shift; | ||||
1899 | if (defined $self->{Methods}->{'entity_reference'}) { | ||||
1900 | $self->{Methods}->{'entity_reference'}->(@_); | ||||
1901 | } | ||||
1902 | else { | ||||
1903 | my $method; | ||||
1904 | my $callbacks; | ||||
1905 | if (exists $self->{ParseOptions}) { | ||||
1906 | $callbacks = $self->{ParseOptions}; | ||||
1907 | } | ||||
1908 | else { | ||||
1909 | $callbacks = $self; | ||||
1910 | } | ||||
1911 | if (0) { # dummy to make elsif's below compile | ||||
1912 | } | ||||
1913 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('entity_reference') ) { | ||||
1914 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1915 | $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) }; | ||||
1916 | return $method->($handler, @_); | ||||
1917 | } | ||||
1918 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_reference') ) { | ||||
1919 | my $handler = $callbacks->{'Handler'}; | ||||
1920 | $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) }; | ||||
1921 | return $method->($handler, @_); | ||||
1922 | } | ||||
1923 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
1924 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
1925 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1926 | ) | ||||
1927 | { | ||||
1928 | my $res = eval { $callbacks->{'DocumentHandler'}->entity_reference(@_) }; | ||||
1929 | if ($@) { | ||||
1930 | die $@; | ||||
1931 | } | ||||
1932 | else { | ||||
1933 | # I think there's a buggette here... | ||||
1934 | # if the first call throws an exception, we don't set it up right. | ||||
1935 | # Not fatal, but we might want to address it. | ||||
1936 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
1937 | $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) }; | ||||
1938 | } | ||||
1939 | return $res; | ||||
1940 | } | ||||
1941 | elsif (defined $callbacks->{'Handler'} | ||||
1942 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
1943 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1944 | ) | ||||
1945 | { | ||||
1946 | my $res = eval { $callbacks->{'Handler'}->entity_reference(@_) }; | ||||
1947 | if ($@) { | ||||
1948 | die $@; | ||||
1949 | } | ||||
1950 | else { | ||||
1951 | # I think there's a buggette here... | ||||
1952 | # if the first call throws an exception, we don't set it up right. | ||||
1953 | # Not fatal, but we might want to address it. | ||||
1954 | my $handler = $callbacks->{'Handler'}; | ||||
1955 | $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) }; | ||||
1956 | } | ||||
1957 | return $res; | ||||
1958 | } | ||||
1959 | else { | ||||
1960 | $self->{Methods}->{'entity_reference'} = sub { }; | ||||
1961 | } | ||||
1962 | } | ||||
1963 | |||||
1964 | } | ||||
1965 | |||||
1966 | sub element_decl { | ||||
1967 | my $self = shift; | ||||
1968 | if (defined $self->{Methods}->{'element_decl'}) { | ||||
1969 | $self->{Methods}->{'element_decl'}->(@_); | ||||
1970 | } | ||||
1971 | else { | ||||
1972 | my $method; | ||||
1973 | my $callbacks; | ||||
1974 | if (exists $self->{ParseOptions}) { | ||||
1975 | $callbacks = $self->{ParseOptions}; | ||||
1976 | } | ||||
1977 | else { | ||||
1978 | $callbacks = $self; | ||||
1979 | } | ||||
1980 | if (0) { # dummy to make elsif's below compile | ||||
1981 | } | ||||
1982 | elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('element_decl') ) { | ||||
1983 | my $handler = $callbacks->{'DeclHandler'}; | ||||
1984 | $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) }; | ||||
1985 | return $method->($handler, @_); | ||||
1986 | } | ||||
1987 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('element_decl') ) { | ||||
1988 | my $handler = $callbacks->{'Handler'}; | ||||
1989 | $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) }; | ||||
1990 | return $method->($handler, @_); | ||||
1991 | } | ||||
1992 | elsif (defined $callbacks->{'DeclHandler'} | ||||
1993 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') | ||||
1994 | and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
1995 | ) | ||||
1996 | { | ||||
1997 | my $res = eval { $callbacks->{'DeclHandler'}->element_decl(@_) }; | ||||
1998 | if ($@) { | ||||
1999 | die $@; | ||||
2000 | } | ||||
2001 | else { | ||||
2002 | # I think there's a buggette here... | ||||
2003 | # if the first call throws an exception, we don't set it up right. | ||||
2004 | # Not fatal, but we might want to address it. | ||||
2005 | my $handler = $callbacks->{'DeclHandler'}; | ||||
2006 | $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) }; | ||||
2007 | } | ||||
2008 | return $res; | ||||
2009 | } | ||||
2010 | elsif (defined $callbacks->{'Handler'} | ||||
2011 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2012 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2013 | ) | ||||
2014 | { | ||||
2015 | my $res = eval { $callbacks->{'Handler'}->element_decl(@_) }; | ||||
2016 | if ($@) { | ||||
2017 | die $@; | ||||
2018 | } | ||||
2019 | else { | ||||
2020 | # I think there's a buggette here... | ||||
2021 | # if the first call throws an exception, we don't set it up right. | ||||
2022 | # Not fatal, but we might want to address it. | ||||
2023 | my $handler = $callbacks->{'Handler'}; | ||||
2024 | $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) }; | ||||
2025 | } | ||||
2026 | return $res; | ||||
2027 | } | ||||
2028 | else { | ||||
2029 | $self->{Methods}->{'element_decl'} = sub { }; | ||||
2030 | } | ||||
2031 | } | ||||
2032 | |||||
2033 | } | ||||
2034 | |||||
2035 | sub notation_decl { | ||||
2036 | my $self = shift; | ||||
2037 | if (defined $self->{Methods}->{'notation_decl'}) { | ||||
2038 | $self->{Methods}->{'notation_decl'}->(@_); | ||||
2039 | } | ||||
2040 | else { | ||||
2041 | my $method; | ||||
2042 | my $callbacks; | ||||
2043 | if (exists $self->{ParseOptions}) { | ||||
2044 | $callbacks = $self->{ParseOptions}; | ||||
2045 | } | ||||
2046 | else { | ||||
2047 | $callbacks = $self; | ||||
2048 | } | ||||
2049 | if (0) { # dummy to make elsif's below compile | ||||
2050 | } | ||||
2051 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('notation_decl') ) { | ||||
2052 | my $handler = $callbacks->{'DTDHandler'}; | ||||
2053 | $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) }; | ||||
2054 | return $method->($handler, @_); | ||||
2055 | } | ||||
2056 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('notation_decl') ) { | ||||
2057 | my $handler = $callbacks->{'Handler'}; | ||||
2058 | $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) }; | ||||
2059 | return $method->($handler, @_); | ||||
2060 | } | ||||
2061 | elsif (defined $callbacks->{'DTDHandler'} | ||||
2062 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
2063 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2064 | ) | ||||
2065 | { | ||||
2066 | my $res = eval { $callbacks->{'DTDHandler'}->notation_decl(@_) }; | ||||
2067 | if ($@) { | ||||
2068 | die $@; | ||||
2069 | } | ||||
2070 | else { | ||||
2071 | # I think there's a buggette here... | ||||
2072 | # if the first call throws an exception, we don't set it up right. | ||||
2073 | # Not fatal, but we might want to address it. | ||||
2074 | my $handler = $callbacks->{'DTDHandler'}; | ||||
2075 | $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) }; | ||||
2076 | } | ||||
2077 | return $res; | ||||
2078 | } | ||||
2079 | elsif (defined $callbacks->{'Handler'} | ||||
2080 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2081 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2082 | ) | ||||
2083 | { | ||||
2084 | my $res = eval { $callbacks->{'Handler'}->notation_decl(@_) }; | ||||
2085 | if ($@) { | ||||
2086 | die $@; | ||||
2087 | } | ||||
2088 | else { | ||||
2089 | # I think there's a buggette here... | ||||
2090 | # if the first call throws an exception, we don't set it up right. | ||||
2091 | # Not fatal, but we might want to address it. | ||||
2092 | my $handler = $callbacks->{'Handler'}; | ||||
2093 | $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) }; | ||||
2094 | } | ||||
2095 | return $res; | ||||
2096 | } | ||||
2097 | else { | ||||
2098 | $self->{Methods}->{'notation_decl'} = sub { }; | ||||
2099 | } | ||||
2100 | } | ||||
2101 | |||||
2102 | } | ||||
2103 | |||||
2104 | sub skipped_entity { | ||||
2105 | my $self = shift; | ||||
2106 | if (defined $self->{Methods}->{'skipped_entity'}) { | ||||
2107 | $self->{Methods}->{'skipped_entity'}->(@_); | ||||
2108 | } | ||||
2109 | else { | ||||
2110 | my $method; | ||||
2111 | my $callbacks; | ||||
2112 | if (exists $self->{ParseOptions}) { | ||||
2113 | $callbacks = $self->{ParseOptions}; | ||||
2114 | } | ||||
2115 | else { | ||||
2116 | $callbacks = $self; | ||||
2117 | } | ||||
2118 | if (0) { # dummy to make elsif's below compile | ||||
2119 | } | ||||
2120 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('skipped_entity') ) { | ||||
2121 | my $handler = $callbacks->{'ContentHandler'}; | ||||
2122 | $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) }; | ||||
2123 | return $method->($handler, @_); | ||||
2124 | } | ||||
2125 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('skipped_entity') ) { | ||||
2126 | my $handler = $callbacks->{'Handler'}; | ||||
2127 | $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) }; | ||||
2128 | return $method->($handler, @_); | ||||
2129 | } | ||||
2130 | elsif (defined $callbacks->{'ContentHandler'} | ||||
2131 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
2132 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2133 | ) | ||||
2134 | { | ||||
2135 | my $res = eval { $callbacks->{'ContentHandler'}->skipped_entity(@_) }; | ||||
2136 | if ($@) { | ||||
2137 | die $@; | ||||
2138 | } | ||||
2139 | else { | ||||
2140 | # I think there's a buggette here... | ||||
2141 | # if the first call throws an exception, we don't set it up right. | ||||
2142 | # Not fatal, but we might want to address it. | ||||
2143 | my $handler = $callbacks->{'ContentHandler'}; | ||||
2144 | $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) }; | ||||
2145 | } | ||||
2146 | return $res; | ||||
2147 | } | ||||
2148 | elsif (defined $callbacks->{'Handler'} | ||||
2149 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2150 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2151 | ) | ||||
2152 | { | ||||
2153 | my $res = eval { $callbacks->{'Handler'}->skipped_entity(@_) }; | ||||
2154 | if ($@) { | ||||
2155 | die $@; | ||||
2156 | } | ||||
2157 | else { | ||||
2158 | # I think there's a buggette here... | ||||
2159 | # if the first call throws an exception, we don't set it up right. | ||||
2160 | # Not fatal, but we might want to address it. | ||||
2161 | my $handler = $callbacks->{'Handler'}; | ||||
2162 | $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) }; | ||||
2163 | } | ||||
2164 | return $res; | ||||
2165 | } | ||||
2166 | else { | ||||
2167 | $self->{Methods}->{'skipped_entity'} = sub { }; | ||||
2168 | } | ||||
2169 | } | ||||
2170 | |||||
2171 | } | ||||
2172 | |||||
2173 | # spent 12.7s (1.85+10.8) within XML::SAX::Base::end_element which was called 185299 times, avg 68µs/call:
# 185299 times (1.85s+10.8s) by XML::SAX::Expat::_handle_end at line 237 of XML/SAX/Expat.pm, avg 68µs/call | ||||
2174 | 405598 | 1.79s | my $self = shift; | ||
2175 | 180299 | 10.6s | if (defined $self->{Methods}->{'end_element'}) { # spent 10.6s making 180299 calls to XML::SAX::Base::__ANON__[XML/SAX/Base.pm:2201], avg 59µs/call | ||
2176 | $self->{Methods}->{'end_element'}->(@_); | ||||
2177 | } | ||||
2178 | else { | ||||
2179 | my $method; | ||||
2180 | my $callbacks; | ||||
2181 | if (exists $self->{ParseOptions}) { | ||||
2182 | $callbacks = $self->{ParseOptions}; | ||||
2183 | } | ||||
2184 | else { | ||||
2185 | $callbacks = $self; | ||||
2186 | } | ||||
2187 | 5000 | 12.1ms | if (0) { # dummy to make elsif's below compile # spent 12.1ms making 5000 calls to UNIVERSAL::can, avg 2µs/call | ||
2188 | } | ||||
2189 | elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_element') ) { | ||||
2190 | my $handler = $callbacks->{'ContentHandler'}; | ||||
2191 | $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) }; | ||||
2192 | return $method->($handler, @_); | ||||
2193 | } | ||||
2194 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_element') ) { | ||||
2195 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
2196 | $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) }; | ||||
2197 | return $method->($handler, @_); | ||||
2198 | } | ||||
2199 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_element') ) { | ||||
2200 | my $handler = $callbacks->{'Handler'}; | ||||
2201 | 180299 | 1.24s | 180299 | 9.21s | # spent 10.6s (1.40+9.21) within XML::SAX::Base::__ANON__[/usr/share/perl5/XML/SAX/Base.pm:2201] which was called 180299 times, avg 59µs/call:
# 180299 times (1.40s+9.21s) by XML::SAX::Base::end_element at line 2175, avg 59µs/call # spent 9.21s making 180299 calls to MARC::File::SAX::end_element, avg 51µs/call |
2202 | 5000 | 179ms | return $method->($handler, @_); # spent 179ms making 5000 calls to MARC::File::SAX::end_element, avg 36µs/call | ||
2203 | } | ||||
2204 | elsif (defined $callbacks->{'ContentHandler'} | ||||
2205 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') | ||||
2206 | and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2207 | ) | ||||
2208 | { | ||||
2209 | my $res = eval { $callbacks->{'ContentHandler'}->end_element(@_) }; | ||||
2210 | if ($@) { | ||||
2211 | die $@; | ||||
2212 | } | ||||
2213 | else { | ||||
2214 | # I think there's a buggette here... | ||||
2215 | # if the first call throws an exception, we don't set it up right. | ||||
2216 | # Not fatal, but we might want to address it. | ||||
2217 | my $handler = $callbacks->{'ContentHandler'}; | ||||
2218 | $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) }; | ||||
2219 | } | ||||
2220 | return $res; | ||||
2221 | } | ||||
2222 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
2223 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
2224 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2225 | ) | ||||
2226 | { | ||||
2227 | my $res = eval { $callbacks->{'DocumentHandler'}->end_element(@_) }; | ||||
2228 | if ($@) { | ||||
2229 | die $@; | ||||
2230 | } | ||||
2231 | else { | ||||
2232 | # I think there's a buggette here... | ||||
2233 | # if the first call throws an exception, we don't set it up right. | ||||
2234 | # Not fatal, but we might want to address it. | ||||
2235 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
2236 | $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) }; | ||||
2237 | } | ||||
2238 | return $res; | ||||
2239 | } | ||||
2240 | elsif (defined $callbacks->{'Handler'} | ||||
2241 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2242 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2243 | ) | ||||
2244 | { | ||||
2245 | my $res = eval { $callbacks->{'Handler'}->end_element(@_) }; | ||||
2246 | if ($@) { | ||||
2247 | die $@; | ||||
2248 | } | ||||
2249 | else { | ||||
2250 | # I think there's a buggette here... | ||||
2251 | # if the first call throws an exception, we don't set it up right. | ||||
2252 | # Not fatal, but we might want to address it. | ||||
2253 | my $handler = $callbacks->{'Handler'}; | ||||
2254 | $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) }; | ||||
2255 | } | ||||
2256 | return $res; | ||||
2257 | } | ||||
2258 | else { | ||||
2259 | $self->{Methods}->{'end_element'} = sub { }; | ||||
2260 | } | ||||
2261 | } | ||||
2262 | |||||
2263 | } | ||||
2264 | |||||
2265 | sub doctype_decl { | ||||
2266 | my $self = shift; | ||||
2267 | if (defined $self->{Methods}->{'doctype_decl'}) { | ||||
2268 | $self->{Methods}->{'doctype_decl'}->(@_); | ||||
2269 | } | ||||
2270 | else { | ||||
2271 | my $method; | ||||
2272 | my $callbacks; | ||||
2273 | if (exists $self->{ParseOptions}) { | ||||
2274 | $callbacks = $self->{ParseOptions}; | ||||
2275 | } | ||||
2276 | else { | ||||
2277 | $callbacks = $self; | ||||
2278 | } | ||||
2279 | if (0) { # dummy to make elsif's below compile | ||||
2280 | } | ||||
2281 | elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('doctype_decl') ) { | ||||
2282 | my $handler = $callbacks->{'DTDHandler'}; | ||||
2283 | $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) }; | ||||
2284 | return $method->($handler, @_); | ||||
2285 | } | ||||
2286 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('doctype_decl') ) { | ||||
2287 | my $handler = $callbacks->{'Handler'}; | ||||
2288 | $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) }; | ||||
2289 | return $method->($handler, @_); | ||||
2290 | } | ||||
2291 | elsif (defined $callbacks->{'DTDHandler'} | ||||
2292 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') | ||||
2293 | and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2294 | ) | ||||
2295 | { | ||||
2296 | my $res = eval { $callbacks->{'DTDHandler'}->doctype_decl(@_) }; | ||||
2297 | if ($@) { | ||||
2298 | die $@; | ||||
2299 | } | ||||
2300 | else { | ||||
2301 | # I think there's a buggette here... | ||||
2302 | # if the first call throws an exception, we don't set it up right. | ||||
2303 | # Not fatal, but we might want to address it. | ||||
2304 | my $handler = $callbacks->{'DTDHandler'}; | ||||
2305 | $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) }; | ||||
2306 | } | ||||
2307 | return $res; | ||||
2308 | } | ||||
2309 | elsif (defined $callbacks->{'Handler'} | ||||
2310 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2311 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2312 | ) | ||||
2313 | { | ||||
2314 | my $res = eval { $callbacks->{'Handler'}->doctype_decl(@_) }; | ||||
2315 | if ($@) { | ||||
2316 | die $@; | ||||
2317 | } | ||||
2318 | else { | ||||
2319 | # I think there's a buggette here... | ||||
2320 | # if the first call throws an exception, we don't set it up right. | ||||
2321 | # Not fatal, but we might want to address it. | ||||
2322 | my $handler = $callbacks->{'Handler'}; | ||||
2323 | $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) }; | ||||
2324 | } | ||||
2325 | return $res; | ||||
2326 | } | ||||
2327 | else { | ||||
2328 | $self->{Methods}->{'doctype_decl'} = sub { }; | ||||
2329 | } | ||||
2330 | } | ||||
2331 | |||||
2332 | } | ||||
2333 | |||||
2334 | sub comment { | ||||
2335 | my $self = shift; | ||||
2336 | if (defined $self->{Methods}->{'comment'}) { | ||||
2337 | $self->{Methods}->{'comment'}->(@_); | ||||
2338 | } | ||||
2339 | else { | ||||
2340 | my $method; | ||||
2341 | my $callbacks; | ||||
2342 | if (exists $self->{ParseOptions}) { | ||||
2343 | $callbacks = $self->{ParseOptions}; | ||||
2344 | } | ||||
2345 | else { | ||||
2346 | $callbacks = $self; | ||||
2347 | } | ||||
2348 | if (0) { # dummy to make elsif's below compile | ||||
2349 | } | ||||
2350 | elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('comment') ) { | ||||
2351 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
2352 | $self->{Methods}->{'comment'} = sub { $method->($handler, @_) }; | ||||
2353 | return $method->($handler, @_); | ||||
2354 | } | ||||
2355 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('comment') ) { | ||||
2356 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
2357 | $self->{Methods}->{'comment'} = sub { $method->($handler, @_) }; | ||||
2358 | return $method->($handler, @_); | ||||
2359 | } | ||||
2360 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('comment') ) { | ||||
2361 | my $handler = $callbacks->{'Handler'}; | ||||
2362 | $self->{Methods}->{'comment'} = sub { $method->($handler, @_) }; | ||||
2363 | return $method->($handler, @_); | ||||
2364 | } | ||||
2365 | elsif (defined $callbacks->{'DocumentHandler'} | ||||
2366 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') | ||||
2367 | and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2368 | ) | ||||
2369 | { | ||||
2370 | my $res = eval { $callbacks->{'DocumentHandler'}->comment(@_) }; | ||||
2371 | if ($@) { | ||||
2372 | die $@; | ||||
2373 | } | ||||
2374 | else { | ||||
2375 | # I think there's a buggette here... | ||||
2376 | # if the first call throws an exception, we don't set it up right. | ||||
2377 | # Not fatal, but we might want to address it. | ||||
2378 | my $handler = $callbacks->{'DocumentHandler'}; | ||||
2379 | $self->{Methods}->{'comment'} = sub { $handler->comment(@_) }; | ||||
2380 | } | ||||
2381 | return $res; | ||||
2382 | } | ||||
2383 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
2384 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
2385 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2386 | ) | ||||
2387 | { | ||||
2388 | my $res = eval { $callbacks->{'LexicalHandler'}->comment(@_) }; | ||||
2389 | if ($@) { | ||||
2390 | die $@; | ||||
2391 | } | ||||
2392 | else { | ||||
2393 | # I think there's a buggette here... | ||||
2394 | # if the first call throws an exception, we don't set it up right. | ||||
2395 | # Not fatal, but we might want to address it. | ||||
2396 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
2397 | $self->{Methods}->{'comment'} = sub { $handler->comment(@_) }; | ||||
2398 | } | ||||
2399 | return $res; | ||||
2400 | } | ||||
2401 | elsif (defined $callbacks->{'Handler'} | ||||
2402 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2403 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2404 | ) | ||||
2405 | { | ||||
2406 | my $res = eval { $callbacks->{'Handler'}->comment(@_) }; | ||||
2407 | if ($@) { | ||||
2408 | die $@; | ||||
2409 | } | ||||
2410 | else { | ||||
2411 | # I think there's a buggette here... | ||||
2412 | # if the first call throws an exception, we don't set it up right. | ||||
2413 | # Not fatal, but we might want to address it. | ||||
2414 | my $handler = $callbacks->{'Handler'}; | ||||
2415 | $self->{Methods}->{'comment'} = sub { $handler->comment(@_) }; | ||||
2416 | } | ||||
2417 | return $res; | ||||
2418 | } | ||||
2419 | else { | ||||
2420 | $self->{Methods}->{'comment'} = sub { }; | ||||
2421 | } | ||||
2422 | } | ||||
2423 | |||||
2424 | } | ||||
2425 | |||||
2426 | sub end_entity { | ||||
2427 | my $self = shift; | ||||
2428 | if (defined $self->{Methods}->{'end_entity'}) { | ||||
2429 | $self->{Methods}->{'end_entity'}->(@_); | ||||
2430 | } | ||||
2431 | else { | ||||
2432 | my $method; | ||||
2433 | my $callbacks; | ||||
2434 | if (exists $self->{ParseOptions}) { | ||||
2435 | $callbacks = $self->{ParseOptions}; | ||||
2436 | } | ||||
2437 | else { | ||||
2438 | $callbacks = $self; | ||||
2439 | } | ||||
2440 | if (0) { # dummy to make elsif's below compile | ||||
2441 | } | ||||
2442 | elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_entity') ) { | ||||
2443 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
2444 | $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) }; | ||||
2445 | return $method->($handler, @_); | ||||
2446 | } | ||||
2447 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_entity') ) { | ||||
2448 | my $handler = $callbacks->{'Handler'}; | ||||
2449 | $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) }; | ||||
2450 | return $method->($handler, @_); | ||||
2451 | } | ||||
2452 | elsif (defined $callbacks->{'LexicalHandler'} | ||||
2453 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') | ||||
2454 | and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2455 | ) | ||||
2456 | { | ||||
2457 | my $res = eval { $callbacks->{'LexicalHandler'}->end_entity(@_) }; | ||||
2458 | if ($@) { | ||||
2459 | die $@; | ||||
2460 | } | ||||
2461 | else { | ||||
2462 | # I think there's a buggette here... | ||||
2463 | # if the first call throws an exception, we don't set it up right. | ||||
2464 | # Not fatal, but we might want to address it. | ||||
2465 | my $handler = $callbacks->{'LexicalHandler'}; | ||||
2466 | $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) }; | ||||
2467 | } | ||||
2468 | return $res; | ||||
2469 | } | ||||
2470 | elsif (defined $callbacks->{'Handler'} | ||||
2471 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2472 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2473 | ) | ||||
2474 | { | ||||
2475 | my $res = eval { $callbacks->{'Handler'}->end_entity(@_) }; | ||||
2476 | if ($@) { | ||||
2477 | die $@; | ||||
2478 | } | ||||
2479 | else { | ||||
2480 | # I think there's a buggette here... | ||||
2481 | # if the first call throws an exception, we don't set it up right. | ||||
2482 | # Not fatal, but we might want to address it. | ||||
2483 | my $handler = $callbacks->{'Handler'}; | ||||
2484 | $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) }; | ||||
2485 | } | ||||
2486 | return $res; | ||||
2487 | } | ||||
2488 | else { | ||||
2489 | $self->{Methods}->{'end_entity'} = sub { }; | ||||
2490 | } | ||||
2491 | } | ||||
2492 | |||||
2493 | } | ||||
2494 | |||||
2495 | sub warning { | ||||
2496 | my $self = shift; | ||||
2497 | if (defined $self->{Methods}->{'warning'}) { | ||||
2498 | $self->{Methods}->{'warning'}->(@_); | ||||
2499 | } | ||||
2500 | else { | ||||
2501 | my $method; | ||||
2502 | my $callbacks; | ||||
2503 | if (exists $self->{ParseOptions}) { | ||||
2504 | $callbacks = $self->{ParseOptions}; | ||||
2505 | } | ||||
2506 | else { | ||||
2507 | $callbacks = $self; | ||||
2508 | } | ||||
2509 | if (0) { # dummy to make elsif's below compile | ||||
2510 | } | ||||
2511 | elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('warning') ) { | ||||
2512 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
2513 | $self->{Methods}->{'warning'} = sub { $method->($handler, @_) }; | ||||
2514 | return $method->($handler, @_); | ||||
2515 | } | ||||
2516 | elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('warning') ) { | ||||
2517 | my $handler = $callbacks->{'Handler'}; | ||||
2518 | $self->{Methods}->{'warning'} = sub { $method->($handler, @_) }; | ||||
2519 | return $method->($handler, @_); | ||||
2520 | } | ||||
2521 | elsif (defined $callbacks->{'ErrorHandler'} | ||||
2522 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') | ||||
2523 | and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2524 | ) | ||||
2525 | { | ||||
2526 | my $res = eval { $callbacks->{'ErrorHandler'}->warning(@_) }; | ||||
2527 | if ($@) { | ||||
2528 | die $@; | ||||
2529 | } | ||||
2530 | else { | ||||
2531 | # I think there's a buggette here... | ||||
2532 | # if the first call throws an exception, we don't set it up right. | ||||
2533 | # Not fatal, but we might want to address it. | ||||
2534 | my $handler = $callbacks->{'ErrorHandler'}; | ||||
2535 | $self->{Methods}->{'warning'} = sub { $handler->warning(@_) }; | ||||
2536 | } | ||||
2537 | return $res; | ||||
2538 | } | ||||
2539 | elsif (defined $callbacks->{'Handler'} | ||||
2540 | and $callbacks->{'Handler'}->can('AUTOLOAD') | ||||
2541 | and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '') | ||||
2542 | ) | ||||
2543 | { | ||||
2544 | my $res = eval { $callbacks->{'Handler'}->warning(@_) }; | ||||
2545 | if ($@) { | ||||
2546 | die $@; | ||||
2547 | } | ||||
2548 | else { | ||||
2549 | # I think there's a buggette here... | ||||
2550 | # if the first call throws an exception, we don't set it up right. | ||||
2551 | # Not fatal, but we might want to address it. | ||||
2552 | my $handler = $callbacks->{'Handler'}; | ||||
2553 | $self->{Methods}->{'warning'} = sub { $handler->warning(@_) }; | ||||
2554 | } | ||||
2555 | return $res; | ||||
2556 | } | ||||
2557 | else { | ||||
2558 | $self->{Methods}->{'warning'} = sub { }; | ||||
2559 | } | ||||
2560 | } | ||||
2561 | |||||
2562 | } | ||||
2563 | |||||
2564 | #-------------------------------------------------------------------# | ||||
2565 | # Class->new(%options) | ||||
2566 | #-------------------------------------------------------------------# | ||||
2567 | # spent 486ms (118+368) within XML::SAX::Base::new which was called 5000 times, avg 97µs/call:
# 5000 times (118ms+368ms) by XML::SAX::ParserFactory::parser at line 43 of XML/SAX/ParserFactory.pm, avg 97µs/call | ||||
2568 | 35000 | 114ms | my $proto = shift; | ||
2569 | my $class = ref($proto) || $proto; | ||||
2570 | my $options = ($#_ == 0) ? shift : { @_ }; | ||||
2571 | |||||
2572 | unless ( defined( $options->{Handler} ) or | ||||
2573 | defined( $options->{ContentHandler} ) or | ||||
2574 | defined( $options->{DTDHandler} ) or | ||||
2575 | defined( $options->{DocumentHandler} ) or | ||||
2576 | defined( $options->{LexicalHandler} ) or | ||||
2577 | defined( $options->{ErrorHandler} ) or | ||||
2578 | defined( $options->{DeclHandler} ) ) { | ||||
2579 | |||||
2580 | $options->{Handler} = XML::SAX::Base::NoHandler->new; | ||||
2581 | } | ||||
2582 | |||||
2583 | my $self = bless $options, $class; | ||||
2584 | # turn NS processing on by default | ||||
2585 | 5000 | 368ms | $self->set_feature('http://xml.org/sax/features/namespaces', 1); # spent 368ms making 5000 calls to XML::SAX::Base::set_feature, avg 74µs/call | ||
2586 | return $self; | ||||
2587 | } | ||||
2588 | #-------------------------------------------------------------------# | ||||
2589 | |||||
2590 | #-------------------------------------------------------------------# | ||||
2591 | # $p->parse(%options) | ||||
2592 | #-------------------------------------------------------------------# | ||||
2593 | # spent 88.7s (158ms+88.6) within XML::SAX::Base::parse which was called 5000 times, avg 17.7ms/call:
# 5000 times (158ms+88.6s) by XML::SAX::Base::parse_string at line 2655, avg 17.7ms/call | ||||
2594 | 30000 | 163ms | my $self = shift; | ||
2595 | 5000 | 44.1ms | my $parse_options = $self->get_options(@_); # spent 44.1ms making 5000 calls to XML::SAX::Base::get_options, avg 9µs/call | ||
2596 | local $self->{ParseOptions} = $parse_options; | ||||
2597 | if ($self->{Parent}) { # calling parse on a filter for some reason | ||||
2598 | return $self->{Parent}->parse($parse_options); | ||||
2599 | } | ||||
2600 | else { | ||||
2601 | my $method; | ||||
2602 | 10000 | 88.5s | if (defined $parse_options->{Source}{CharacterStream} and $method = $self->can('_parse_characterstream')) { # spent 88.5s making 5000 calls to XML::SAX::Expat::_parse_string, avg 17.7ms/call
# spent 14.2ms making 5000 calls to UNIVERSAL::can, avg 3µs/call | ||
2603 | warn("parse charstream???\n"); | ||||
2604 | return $method->($self, $parse_options->{Source}{CharacterStream}); | ||||
2605 | } | ||||
2606 | elsif (defined $parse_options->{Source}{ByteStream} and $method = $self->can('_parse_bytestream')) { | ||||
2607 | return $method->($self, $parse_options->{Source}{ByteStream}); | ||||
2608 | } | ||||
2609 | elsif (defined $parse_options->{Source}{String} and $method = $self->can('_parse_string')) { | ||||
2610 | return $method->($self, $parse_options->{Source}{String}); | ||||
2611 | } | ||||
2612 | elsif (defined $parse_options->{Source}{SystemId} and $method = $self->can('_parse_systemid')) { | ||||
2613 | return $method->($self, $parse_options->{Source}{SystemId}); | ||||
2614 | } | ||||
2615 | else { | ||||
2616 | die "No _parse_* routine defined on this driver (If it is a filter, remember to set the Parent property. If you call the parse() method, make sure to set a Source. You may want to call parse_uri, parse_string or parse_file instead.) [$self]"; | ||||
2617 | } | ||||
2618 | } | ||||
2619 | } | ||||
2620 | #-------------------------------------------------------------------# | ||||
2621 | |||||
2622 | #-------------------------------------------------------------------# | ||||
2623 | # $p->parse_file(%options) | ||||
2624 | #-------------------------------------------------------------------# | ||||
2625 | sub parse_file { | ||||
2626 | my $self = shift; | ||||
2627 | my $file = shift; | ||||
2628 | return $self->parse_uri($file, @_) if ref(\$file) eq 'SCALAR'; | ||||
2629 | my $parse_options = $self->get_options(@_); | ||||
2630 | $parse_options->{Source}{ByteStream} = $file; | ||||
2631 | return $self->parse($parse_options); | ||||
2632 | } | ||||
2633 | #-------------------------------------------------------------------# | ||||
2634 | |||||
2635 | #-------------------------------------------------------------------# | ||||
2636 | # $p->parse_uri(%options) | ||||
2637 | #-------------------------------------------------------------------# | ||||
2638 | sub parse_uri { | ||||
2639 | my $self = shift; | ||||
2640 | my $file = shift; | ||||
2641 | my $parse_options = $self->get_options(@_); | ||||
2642 | $parse_options->{Source}{SystemId} = $file; | ||||
2643 | return $self->parse($parse_options); | ||||
2644 | } | ||||
2645 | #-------------------------------------------------------------------# | ||||
2646 | |||||
2647 | #-------------------------------------------------------------------# | ||||
2648 | # $p->parse_string(%options) | ||||
2649 | #-------------------------------------------------------------------# | ||||
2650 | # spent 88.9s (130ms+88.8) within XML::SAX::Base::parse_string which was called 5000 times, avg 17.8ms/call:
# 5000 times (130ms+88.8s) by MARC::File::XML::decode at line 445 of MARC/File/XML.pm, avg 17.8ms/call | ||||
2651 | 25000 | 125ms | my $self = shift; | ||
2652 | my $string = shift; | ||||
2653 | 5000 | 48.0ms | my $parse_options = $self->get_options(@_); # spent 48.0ms making 5000 calls to XML::SAX::Base::get_options, avg 10µs/call | ||
2654 | $parse_options->{Source}{String} = $string; | ||||
2655 | 5000 | 88.7s | return $self->parse($parse_options); # spent 88.7s making 5000 calls to XML::SAX::Base::parse, avg 17.7ms/call | ||
2656 | } | ||||
2657 | #-------------------------------------------------------------------# | ||||
2658 | |||||
2659 | #-------------------------------------------------------------------# | ||||
2660 | # get_options | ||||
2661 | #-------------------------------------------------------------------# | ||||
2662 | sub get_options { | ||||
2663 | 25000 | 106ms | my $self = shift; | ||
2664 | |||||
2665 | if (@_ == 1) { | ||||
2666 | return { %$self, %{$_[0]} }; | ||||
2667 | } else { | ||||
2668 | return { %$self, @_ }; | ||||
2669 | } | ||||
2670 | } | ||||
2671 | #-------------------------------------------------------------------# | ||||
2672 | |||||
2673 | #-------------------------------------------------------------------# | ||||
2674 | # get_features | ||||
2675 | #-------------------------------------------------------------------# | ||||
2676 | sub get_features { | ||||
2677 | return ( | ||||
2678 | 15000 | 156ms | 'http://xml.org/sax/features/external-general-entities' => undef, | ||
2679 | 'http://xml.org/sax/features/external-parameter-entities' => undef, | ||||
2680 | 'http://xml.org/sax/features/is-standalone' => undef, | ||||
2681 | 'http://xml.org/sax/features/lexical-handler' => undef, | ||||
2682 | 'http://xml.org/sax/features/parameter-entities' => undef, | ||||
2683 | 'http://xml.org/sax/features/namespaces' => 1, | ||||
2684 | 'http://xml.org/sax/features/namespace-prefixes' => 0, | ||||
2685 | 'http://xml.org/sax/features/string-interning' => undef, | ||||
2686 | 'http://xml.org/sax/features/use-attributes2' => undef, | ||||
2687 | 'http://xml.org/sax/features/use-locator2' => undef, | ||||
2688 | 'http://xml.org/sax/features/validation' => undef, | ||||
2689 | |||||
2690 | 'http://xml.org/sax/properties/dom-node' => undef, | ||||
2691 | 'http://xml.org/sax/properties/xml-string' => undef, | ||||
2692 | ); | ||||
2693 | } | ||||
2694 | #-------------------------------------------------------------------# | ||||
2695 | |||||
2696 | #-------------------------------------------------------------------# | ||||
2697 | # get_feature | ||||
2698 | #-------------------------------------------------------------------# | ||||
2699 | # spent 602ms (357+245) within XML::SAX::Base::get_feature which was called 10000 times, avg 60µs/call:
# 10000 times (357ms+245ms) by XML::SAX::Expat::_create_parser at line 93 of XML/SAX/Expat.pm, avg 60µs/call | ||||
2700 | 60000 | 341ms | my $self = shift; | ||
2701 | my $feat = shift; | ||||
2702 | |||||
2703 | # check %FEATURES to see if it's there, and return it if so | ||||
2704 | # throw XML::SAX::Exception::NotRecognized if it's not there | ||||
2705 | # throw XML::SAX::Exception::NotSupported if it's there but we | ||||
2706 | # don't support it | ||||
2707 | |||||
2708 | 10000 | 78.3ms | my %features = $self->get_features(); # spent 78.3ms making 10000 calls to XML::SAX::Base::get_features, avg 8µs/call | ||
2709 | if (exists $features{$feat}) { | ||||
2710 | 10000 | 167ms | my %supported = map { $_ => 1 } $self->supported_features(); # spent 167ms making 10000 calls to XML::SAX::Expat::supported_features, avg 17µs/call | ||
2711 | if ($supported{$feat}) { | ||||
2712 | return $self->{__PACKAGE__ . "::Features"}{$feat}; | ||||
2713 | } | ||||
2714 | throw XML::SAX::Exception::NotSupported( | ||||
2715 | Message => "The feature '$feat' is not supported by " . ref($self), | ||||
2716 | Exception => undef, | ||||
2717 | ); | ||||
2718 | } | ||||
2719 | throw XML::SAX::Exception::NotRecognized( | ||||
2720 | Message => "The feature '$feat' is not recognized by " . ref($self), | ||||
2721 | Exception => undef, | ||||
2722 | ); | ||||
2723 | } | ||||
2724 | #-------------------------------------------------------------------# | ||||
2725 | |||||
2726 | #-------------------------------------------------------------------# | ||||
2727 | # set_feature | ||||
2728 | #-------------------------------------------------------------------# | ||||
2729 | # spent 368ms (217+151) within XML::SAX::Base::set_feature which was called 5000 times, avg 74µs/call:
# 5000 times (217ms+151ms) by XML::SAX::Base::new at line 2585, avg 74µs/call | ||||
2730 | 35000 | 208ms | my $self = shift; | ||
2731 | my $feat = shift; | ||||
2732 | my $value = shift; | ||||
2733 | # check %FEATURES to see if it's there, and set it if so | ||||
2734 | # throw XML::SAX::Exception::NotRecognized if it's not there | ||||
2735 | # throw XML::SAX::Exception::NotSupported if it's there but we | ||||
2736 | # don't support it | ||||
2737 | |||||
2738 | 5000 | 51.6ms | my %features = $self->get_features(); # spent 51.6ms making 5000 calls to XML::SAX::Base::get_features, avg 10µs/call | ||
2739 | if (exists $features{$feat}) { | ||||
2740 | 5000 | 99.4ms | my %supported = map { $_ => 1 } $self->supported_features(); # spent 99.4ms making 5000 calls to XML::SAX::Expat::supported_features, avg 20µs/call | ||
2741 | if ($supported{$feat}) { | ||||
2742 | return $self->{__PACKAGE__ . "::Features"}{$feat} = $value; | ||||
2743 | } | ||||
2744 | throw XML::SAX::Exception::NotSupported( | ||||
2745 | Message => "The feature '$feat' is not supported by " . ref($self), | ||||
2746 | Exception => undef, | ||||
2747 | ); | ||||
2748 | } | ||||
2749 | throw XML::SAX::Exception::NotRecognized( | ||||
2750 | Message => "The feature '$feat' is not recognized by " . ref($self), | ||||
2751 | Exception => undef, | ||||
2752 | ); | ||||
2753 | } | ||||
2754 | #-------------------------------------------------------------------# | ||||
2755 | |||||
2756 | #-------------------------------------------------------------------# | ||||
2757 | # get_handler and friends | ||||
2758 | #-------------------------------------------------------------------# | ||||
2759 | sub get_handler { | ||||
2760 | my $self = shift; | ||||
2761 | my $handler_type = shift; | ||||
2762 | $handler_type ||= 'Handler'; | ||||
2763 | return defined( $self->{$handler_type} ) ? $self->{$handler_type} : undef; | ||||
2764 | } | ||||
2765 | |||||
2766 | sub get_document_handler { | ||||
2767 | my $self = shift; | ||||
2768 | return $self->get_handler('DocumentHandler', @_); | ||||
2769 | } | ||||
2770 | |||||
2771 | sub get_content_handler { | ||||
2772 | my $self = shift; | ||||
2773 | return $self->get_handler('ContentHandler', @_); | ||||
2774 | } | ||||
2775 | |||||
2776 | sub get_dtd_handler { | ||||
2777 | my $self = shift; | ||||
2778 | return $self->get_handler('DTDHandler', @_); | ||||
2779 | } | ||||
2780 | |||||
2781 | sub get_lexical_handler { | ||||
2782 | my $self = shift; | ||||
2783 | return $self->get_handler('LexicalHandler', @_); | ||||
2784 | } | ||||
2785 | |||||
2786 | sub get_decl_handler { | ||||
2787 | my $self = shift; | ||||
2788 | return $self->get_handler('DeclHandler', @_); | ||||
2789 | } | ||||
2790 | |||||
2791 | sub get_error_handler { | ||||
2792 | my $self = shift; | ||||
2793 | return $self->get_handler('ErrorHandler', @_); | ||||
2794 | } | ||||
2795 | |||||
2796 | sub get_entity_resolver { | ||||
2797 | my $self = shift; | ||||
2798 | return $self->get_handler('EntityResolver', @_); | ||||
2799 | } | ||||
2800 | #-------------------------------------------------------------------# | ||||
2801 | |||||
2802 | #-------------------------------------------------------------------# | ||||
2803 | # set_handler and friends | ||||
2804 | #-------------------------------------------------------------------# | ||||
2805 | sub set_handler { | ||||
2806 | my $self = shift; | ||||
2807 | my ($new_handler, $handler_type) = reverse @_; | ||||
2808 | $handler_type ||= 'Handler'; | ||||
2809 | $self->{Methods} = {} if $self->{Methods}; | ||||
2810 | $self->{$handler_type} = $new_handler; | ||||
2811 | $self->{ParseOptions}->{$handler_type} = $new_handler; | ||||
2812 | return 1; | ||||
2813 | } | ||||
2814 | |||||
2815 | sub set_document_handler { | ||||
2816 | my $self = shift; | ||||
2817 | return $self->set_handler('DocumentHandler', @_); | ||||
2818 | } | ||||
2819 | |||||
2820 | sub set_content_handler { | ||||
2821 | my $self = shift; | ||||
2822 | return $self->set_handler('ContentHandler', @_); | ||||
2823 | } | ||||
2824 | sub set_dtd_handler { | ||||
2825 | my $self = shift; | ||||
2826 | return $self->set_handler('DTDHandler', @_); | ||||
2827 | } | ||||
2828 | sub set_lexical_handler { | ||||
2829 | my $self = shift; | ||||
2830 | return $self->set_handler('LexicalHandler', @_); | ||||
2831 | } | ||||
2832 | sub set_decl_handler { | ||||
2833 | my $self = shift; | ||||
2834 | return $self->set_handler('DeclHandler', @_); | ||||
2835 | } | ||||
2836 | sub set_error_handler { | ||||
2837 | my $self = shift; | ||||
2838 | return $self->set_handler('ErrorHandler', @_); | ||||
2839 | } | ||||
2840 | sub set_entity_resolver { | ||||
2841 | my $self = shift; | ||||
2842 | return $self->set_handler('EntityResolver', @_); | ||||
2843 | } | ||||
2844 | |||||
2845 | #-------------------------------------------------------------------# | ||||
2846 | |||||
2847 | #-------------------------------------------------------------------# | ||||
2848 | # supported_features | ||||
2849 | #-------------------------------------------------------------------# | ||||
2850 | # spent 73.8ms within XML::SAX::Base::supported_features which was called 15000 times, avg 5µs/call:
# 15000 times (73.8ms+0s) by XML::SAX::Expat::supported_features at line 483 of XML/SAX/Expat.pm, avg 5µs/call | ||||
2851 | 30000 | 98.7ms | my $self = shift; | ||
2852 | # Only namespaces are required by all parsers | ||||
2853 | return ( | ||||
2854 | 'http://xml.org/sax/features/namespaces', | ||||
2855 | ); | ||||
2856 | } | ||||
2857 | #-------------------------------------------------------------------# | ||||
2858 | |||||
2859 | sub no_op { | ||||
2860 | # this space intentionally blank | ||||
2861 | } | ||||
2862 | |||||
2863 | |||||
2864 | package XML::SAX::Base::NoHandler; | ||||
2865 | |||||
2866 | # we need a fake handler that doesn't implement anything, this | ||||
2867 | # simplifies the code a lot (though given the recent changes, | ||||
2868 | # it may be better to do without) | ||||
2869 | sub new { | ||||
2870 | #warn "no handler called\n"; | ||||
2871 | return bless {}; | ||||
2872 | } | ||||
2873 | |||||
2874 | 1 | 6µs | 1; | ||
2875 | |||||
2876 | __END__ |