Driver.pm 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. package Test::Selenium::Remote::Driver;
  2. # ABSTRACT: Useful testing subclass for Selenium::Remote::Driver
  3. use Moo;
  4. use Test::Selenium::Remote::WebElement;
  5. use Test::LongString;
  6. use IO::Socket;
  7. use Sub::Install;
  8. use Try::Tiny;
  9. extends 'Selenium::Remote::Driver';
  10. # move_mouse_to_location_ok # TODO # move_to_ok # TODO
  11. has func_list => (
  12. is => 'lazy',
  13. builder => sub {
  14. return [
  15. 'alert_text_is', 'alert_text_isnt', 'alert_text_like',
  16. 'alert_text_unlike', 'current_window_handle_is',
  17. 'current_window_handle_isnt', 'current_window_handle_like',
  18. 'current_window_handle_unlike', 'window_handles_is',
  19. 'window_handles_isnt', 'window_handles_like',
  20. 'window_handles_unlike', 'window_size_is', 'window_size_isnt',
  21. 'window_size_like', 'window_size_unlike', 'window_position_is',
  22. 'window_position_isnt', 'window_position_like',
  23. 'window_position_unlike', 'current_url_is', 'current_url_isnt',
  24. 'current_url_like', 'current_url_unlike', 'title_is',
  25. 'title_isnt', 'title_like', 'title_unlike', 'active_element_is',
  26. 'active_element_isnt', 'active_element_like',
  27. 'active_element_unlike', 'send_keys_to_active_element_ok',
  28. 'send_keys_to_alert_ok', 'send_keys_to_prompt_ok',
  29. 'send_modifier_ok', 'accept_alert_ok', 'dismiss_alert_ok',
  30. 'get_ok', 'go_back_ok', 'go_forward_ok', 'add_cookie_ok',
  31. 'get_page_source_ok', 'find_element_ok', 'find_elements_ok',
  32. 'find_child_element_ok', 'find_child_elements_ok', 'find_no_element_ok',
  33. 'compare_elements_ok', 'click_ok', 'double_click_ok',
  34. 'body_like',
  35. ];
  36. },
  37. );
  38. sub has_args {
  39. my $self = shift;
  40. my $fun_name = shift;
  41. my $hash_fun_args = {
  42. 'find_element' => 2,
  43. 'find_no_element' => 2,
  44. 'find_child_element' => 3,
  45. 'find_child_elements' => 3,
  46. 'find_element' => 2,
  47. 'find_elements' => 2,
  48. 'compare_elements' => 2,
  49. 'get' => 1,
  50. };
  51. return ( $hash_fun_args->{$fun_name} // 0 );
  52. }
  53. with 'Test::Selenium::Remote::Role::DoesTesting';
  54. has verbose => (
  55. is => 'rw',
  56. );
  57. sub BUILD {
  58. my $self = shift;
  59. foreach my $method_name ( @{ $self->func_list } ) {
  60. unless ( defined( __PACKAGE__->can($method_name) ) ) {
  61. my $sub = $self->_build_sub($method_name);
  62. Sub::Install::install_sub(
  63. { code => $sub,
  64. into => __PACKAGE__,
  65. as => $method_name
  66. }
  67. );
  68. }
  69. }
  70. }
  71. =head1 NAME
  72. Test::Selenium::Remote::Driver
  73. =head1 DESCRIPTION
  74. A subclass of L<Selenium::Remote::Driver>. which provides useful testing
  75. functions.
  76. This is an I<experimental> addition to the Selenium::Remote::Driver
  77. distribution, and some interfaces may change.
  78. =head1 Methods
  79. =head2 new ( %opts )
  80. This will create a new Test::Selenium::Remote::Driver object, which subclasses
  81. L<Selenium::Remote::Driver>. This subclass provides useful testing
  82. functions. It is modeled on L<Test::WWW::Selenium>.
  83. Environment vars can be used to specify options to pass to
  84. L<Selenium::Remote::Driver>. ENV vars are prefixed with C<TWD_>.
  85. ( After the old fork name, "Test::WebDriver" )
  86. Set the Selenium server address with C<$TWD_HOST> and C<$TWD_PORT>.
  87. Pick which browser is used using the C<$TWD_BROWSER>, C<$TWD_VERSION>,
  88. C<$TWD_PLATFORM>, C<$TWD_JAVASCRIPT>, C<$TWD_EXTRA_CAPABILITIES>.
  89. See L<Selenium::Driver::Remote> for the meanings of these options.
  90. =cut
  91. sub BUILDARGS {
  92. my ( $class, %p ) = @_;
  93. for my $opt (
  94. qw/remote_server_addr port browser_name version platform
  95. javascript auto_close extra_capabilities/
  96. )
  97. {
  98. $p{$opt} //= $ENV{ 'TWD_' . uc($opt) };
  99. }
  100. $p{browser_name} //= $ENV{TWD_BROWSER}; # ykwim
  101. $p{remote_server_addr} //= $ENV{TWD_HOST}; # ykwim
  102. $p{webelement_class} //= 'Test::Selenium::Remote::WebElement';
  103. return \%p;
  104. }
  105. =head2 server_is_running( $host, $port )
  106. Returns true if a Selenium server is running. The host and port
  107. parameters are optional, and default to C<localhost:4444>.
  108. Environment vars C<TWD_HOST> and C<TWD_PORT> can also be used to
  109. determine the server to check.
  110. =cut
  111. sub server_is_running {
  112. my $class_or_self = shift;
  113. my $host = $ENV{TWD_HOST} || shift || 'localhost';
  114. my $port = $ENV{TWD_PORT} || shift || 4444;
  115. return ( $host, $port )
  116. if IO::Socket::INET->new(
  117. PeerAddr => $host,
  118. PeerPort => $port,
  119. );
  120. return;
  121. }
  122. =head1 Testing Methods
  123. The following testing methods are available. For
  124. more documentation, see the related test methods in L<Selenium::Remote::Driver>
  125. (And feel free to submit a patch to flesh out the documentation for these here).
  126. alert_text_is
  127. alert_text_isnt
  128. alert_text_like
  129. alert_text_unlike
  130. current_window_handle_is
  131. current_window_handle_isnt
  132. current_window_handle_like
  133. current_window_handle_unlike
  134. window_handles_is
  135. window_handles_isnt
  136. window_handles_like
  137. window_handles_unlike
  138. window_size_is
  139. window_size_isnt
  140. window_size_like
  141. window_size_unlike
  142. window_position_is
  143. window_position_isnt
  144. window_position_like
  145. window_position_unlike
  146. current_url_is
  147. current_url_isnt
  148. current_url_like
  149. current_url_unlike
  150. title_is
  151. title_isnt
  152. title_like
  153. title_unlike
  154. active_element_is
  155. active_element_isnt
  156. active_element_like
  157. active_element_unlike
  158. # Basically the same as 'content_like()', but content_like() supports multiple regex's.
  159. page_source_is
  160. page_source_isnt
  161. page_source_like
  162. page_source_unlike
  163. send_keys_to_active_element_ok
  164. send_keys_to_alert_ok
  165. send_keys_to_prompt_ok
  166. send_modifier_ok
  167. accept_alert_ok
  168. dismiss_alert_ok
  169. move_mouse_to_location_ok # TODO
  170. move_to_ok # TODO
  171. get_ok
  172. go_back_ok
  173. go_forward_ok
  174. add_cookie_ok
  175. get_page_source_ok
  176. find_element_ok($search_target)
  177. find_element_ok($search_target)
  178. find_elements_ok
  179. find_child_element_ok
  180. find_child_elements_ok
  181. compare_elements_ok
  182. click_ok
  183. double_click_ok
  184. =cut
  185. # function composing a find_element with locator with a webelement test
  186. sub _find_element_with_action {
  187. my $self = shift;
  188. my $method = shift;
  189. my ($locator,$locator_strategy,$params,$desc) = @_;
  190. # case 4 args
  191. if ($desc) {
  192. $self->croak('Invalid locator strategy') unless ($self->FINDERS->{$locator_strategy});
  193. }
  194. else {
  195. if ($params) {
  196. # means that we called it the 'old way' (no locator strategy)
  197. if (!defined($self->FINDERS->{$locator_strategy})) {
  198. $desc = $params;
  199. $params = $locator_strategy;
  200. $locator_strategy = $self->_get_finder_key($self->default_finder);
  201. }
  202. }
  203. else {
  204. # means it was called with no locator strategy and no desc
  205. if ($locator_strategy) {
  206. if (!defined($self->FINDERS->{$locator_strategy})) {
  207. $params = $locator_strategy;
  208. $locator_strategy = $self->_get_finder_key($self->default_finder);
  209. }
  210. }
  211. else {
  212. $self->croak('Not enough arguments');
  213. }
  214. }
  215. }
  216. unless ($desc) {
  217. $desc = $method;
  218. $desc .= "'" . join( " ", ($params // '') ) . "'";
  219. }
  220. return $self->find_element($locator,$locator_strategy)->$method( $params, $desc );
  221. }
  222. =head2 $twd->type_element_ok($search_target [,$locator], $keys, [, $desc ]);
  223. $twd->type_element_ok( $search_target [,$locator], $keys [, $desc ] );
  224. Use L<Selenium::Remote::Driver/find_element> to resolve the C<$search_target>
  225. to a web element and an optional locator, and then type C<$keys> into it, providing an optional test
  226. label.
  227. =cut
  228. sub type_element_ok {
  229. my $self = shift;
  230. my $method = 'send_keys_ok';
  231. return $self->_find_element_with_action($method,@_);
  232. }
  233. =head2 $twd->element_text_is($search_target[,$finder],$expected_text [,$desc]);
  234. $twd->element_text_is($search_target[,$finder],$expected_text [,$desc]);
  235. =cut
  236. sub element_text_is {
  237. my $self = shift;
  238. my $method = 'text_is';
  239. return $self->_find_element_with_action($method,@_);
  240. }
  241. =head2 $twd->element_value_is($search_target[,$finder],$expected_value [,$desc]);
  242. $twd->element_value_is($search_target[,$finder],$expected_value [,$desc]);
  243. =cut
  244. sub element_value_is {
  245. my $self = shift;
  246. my $method = 'value_is';
  247. return $self->_find_element_with_action($method,@_);
  248. }
  249. =head2 $twd->click_element_ok($search_target [,$desc]);
  250. $twd->click_element_ok($search_target [,$desc]);
  251. Find an element and then click on it.
  252. =cut
  253. sub click_element_ok {
  254. my $self = shift;
  255. my $method = 'click_ok';
  256. return $self->_find_element_with_action($method,@_);
  257. }
  258. =head2 $twd->clear_element_ok($search_target [,$desc]);
  259. $twd->clear_element_ok($search_target [,$desc]);
  260. Find an element and then clear on it.
  261. =cut
  262. sub clear_element_ok {
  263. my $self = shift;
  264. my $method = 'clear_ok';
  265. return $self->_find_element_with_action($method,@_);
  266. }
  267. =head2 $twd->is_element_displayed_ok($search_target [,$desc]);
  268. $twd->is_element_displayed_ok($search_target [,$desc]);
  269. Find an element and check to confirm that it is displayed. (visible)
  270. =cut
  271. sub is_element_displayed_ok {
  272. my $self = shift;
  273. my $method = 'is_displayed_ok';
  274. return $self->_find_element_with_action($method,@_);
  275. }
  276. =head2 $twd->is_element_enabled_ok($search_target [,$desc]);
  277. $twd->is_element_enabled_ok($search_target [,$desc]);
  278. Find an element and check to confirm that it is enabled.
  279. =cut
  280. sub is_element_enabled_ok {
  281. my $self = shift;
  282. my $method = 'is_enabled_ok';
  283. return $self->_find_element_with_action($method,@_);
  284. }
  285. =head2 $twd->find_element_ok($search_target [,$finder, $desc ]);
  286. $twd->find_element_ok( $search_target [,$finder, $desc ] );
  287. Returns true if C<$search_target> is successfully found on the page. C<$search_target>
  288. is passed to L<Selenium::Remote::Driver/find_element> using a finder or the C<default_finder>
  289. if none passed.
  290. See there for more details on the format for C<find_element_ok()>.
  291. =cut
  292. =head2 $twd->find_no_element_ok($search_target [,$finder, $desc ]);
  293. $twd->find_no_element_ok( $search_target [,$finder, $desc ] );
  294. Returns true if C<$search_target> is I<not> found on the page. C<$search_target>
  295. is passed to L<Selenium::Remote::Driver/find_element> using a finder or the
  296. C<default_finder> if none passed.See there for more details on the format.
  297. for C<find_no_element_ok()>.
  298. =cut
  299. =head2 $twd->content_like( $regex [, $desc ] )
  300. $twd->content_like( $regex [, $desc ] )
  301. $twd->content_like( [$regex_1, $regex_2] [, $desc ] )
  302. Tells if the content of the page matches I<$regex>. If an arrayref of regex's
  303. are provided, one 'test' is run for each regex against the content of the
  304. current page.
  305. A default description of 'Content is like "$regex"' will be provided if there
  306. is no description.
  307. =cut
  308. sub content_like {
  309. my $self = shift;
  310. my $regex = shift;
  311. my $desc = shift;
  312. local $Test::Builder::Level = $Test::Builder::Level + 1;
  313. my $content = $self->get_page_source();
  314. if ( not ref $regex eq 'ARRAY' ) {
  315. $desc = qq{Content is like "$regex"} if ( not defined $desc );
  316. return like_string( $content, $regex, $desc );
  317. }
  318. elsif ( ref $regex eq 'ARRAY' ) {
  319. for my $re (@$regex) {
  320. $desc = qq{Content is like "$re"} if ( not defined $desc );
  321. like_string( $content, $re, $desc );
  322. }
  323. }
  324. }
  325. =head2 $twd->content_unlike( $regex [, $desc ] )
  326. $twd->content_unlike( $regex [, $desc ] )
  327. $twd->content_unlike( [$regex_1, $regex_2] [, $desc ] )
  328. Tells if the content of the page does NOT match I<$regex>. If an arrayref of regex's
  329. are provided, one 'test' is run for each regex against the content of the
  330. current page.
  331. A default description of 'Content is unlike "$regex"' will be provided if there
  332. is no description.
  333. =cut
  334. sub content_unlike {
  335. my $self = shift;
  336. my $regex = shift;
  337. my $desc = shift;
  338. local $Test::Builder::Level = $Test::Builder::Level + 1;
  339. my $content = $self->get_page_source();
  340. if ( not ref $regex eq 'ARRAY' ) {
  341. $desc = qq{Content is unlike "$regex"} if ( not defined $desc );
  342. return unlike_string( $content, $regex, $desc );
  343. }
  344. elsif ( ref $regex eq 'ARRAY' ) {
  345. for my $re (@$regex) {
  346. $desc = qq{Content is unlike "$re"} if ( not defined $desc );
  347. unlike_string( $content, $re, $desc );
  348. }
  349. }
  350. }
  351. =head2 $twd->body_text_like( $regex [, $desc ] )
  352. $twd->body_text_like( $regex [, $desc ] )
  353. $twd->body_text_like( [$regex_1, $regex_2] [, $desc ] )
  354. Tells if the text of the page (as returned by C<< get_body() >>) matches
  355. I<$regex>. If an arrayref of regex's are provided, one 'test' is run for each
  356. regex against the content of the current page.
  357. A default description of 'Content is like "$regex"' will be provided if there
  358. is no description.
  359. To also match the HTML see, C<< content_unlike() >>.
  360. =cut
  361. sub body_text_like {
  362. my $self = shift;
  363. my $regex = shift;
  364. my $desc = shift;
  365. local $Test::Builder::Level = $Test::Builder::Level + 1;
  366. my $text = $self->get_body();
  367. if ( not ref $regex eq 'ARRAY' ) {
  368. $desc = qq{Text is like "$regex"} if ( not defined $desc );
  369. return like_string( $text, $regex, $desc );
  370. }
  371. elsif ( ref $regex eq 'ARRAY' ) {
  372. for my $re (@$regex) {
  373. $desc = qq{Text is like "$re"} if ( not defined $desc );
  374. like_string( $text, $re, $desc );
  375. }
  376. }
  377. }
  378. =head2 $twd->body_text_unlike( $regex [, $desc ] )
  379. $twd->body_text_unlike( $regex [, $desc ] )
  380. $twd->body_text_unlike( [$regex_1, $regex_2] [, $desc ] )
  381. Tells if the text of the page (as returned by C<< get_body() >>)
  382. does NOT match I<$regex>. If an arrayref of regex's
  383. are provided, one 'test' is run for each regex against the content of the
  384. current page.
  385. A default description of 'Text is unlike "$regex"' will be provided if there
  386. is no description.
  387. To also match the HTML see, C<< content_unlike() >>.
  388. =cut
  389. sub body_text_unlike {
  390. my $self = shift;
  391. my $regex = shift;
  392. my $desc = shift;
  393. local $Test::Builder::Level = $Test::Builder::Level + 1;
  394. my $text = $self->get_body();
  395. if ( not ref $regex eq 'ARRAY' ) {
  396. $desc = qq{Text is unlike "$regex"} if ( not defined $desc );
  397. return unlike_string( $text, $regex, $desc );
  398. }
  399. elsif ( ref $regex eq 'ARRAY' ) {
  400. for my $re (@$regex) {
  401. $desc = qq{Text is unlike "$re"} if ( not defined $desc );
  402. unlike_string( $text, $re, $desc );
  403. }
  404. }
  405. }
  406. #####
  407. =head2 $twd->content_contains( $str [, $desc ] )
  408. $twd->content_contains( $str [, $desc ] )
  409. $twd->content_contains( [$str_1, $str_2] [, $desc ] )
  410. Tells if the content of the page contains I<$str>. If an arrayref of strngs's
  411. are provided, one 'test' is run for each string against the content of the
  412. current page.
  413. A default description of 'Content contains "$str"' will be provided if there
  414. is no description.
  415. =cut
  416. sub content_contains {
  417. my $self = shift;
  418. my $str = shift;
  419. my $desc = shift;
  420. local $Test::Builder::Level = $Test::Builder::Level + 1;
  421. my $content = $self->get_page_source();
  422. if ( not ref $str eq 'ARRAY' ) {
  423. $desc = qq{Content contains "$str"} if ( not defined $desc );
  424. return contains_string( $content, $str, $desc );
  425. }
  426. elsif ( ref $str eq 'ARRAY' ) {
  427. for my $s (@$str) {
  428. $desc = qq{Content contains "$s"} if ( not defined $desc );
  429. contains_string( $content, $s, $desc );
  430. }
  431. }
  432. }
  433. =head2 $twd->content_lacks( $str [, $desc ] )
  434. $twd->content_lacks( $str [, $desc ] )
  435. $twd->content_lacks( [$str_1, $str_2] [, $desc ] )
  436. Tells if the content of the page does NOT contain I<$str>. If an arrayref of strings
  437. are provided, one 'test' is run for each string against the content of the
  438. current page.
  439. A default description of 'Content lacks "$str"' will be provided if there
  440. is no description.
  441. =cut
  442. sub content_lacks {
  443. my $self = shift;
  444. my $str = shift;
  445. my $desc = shift;
  446. local $Test::Builder::Level = $Test::Builder::Level + 1;
  447. my $content = $self->get_page_source();
  448. if ( not ref $str eq 'ARRAY' ) {
  449. $desc = qq{Content lacks "$str"} if ( not defined $desc );
  450. return lacks_string( $content, $str, $desc );
  451. }
  452. elsif ( ref $str eq 'ARRAY' ) {
  453. for my $s (@$str) {
  454. $desc = qq{Content lacks "$s"} if ( not defined $desc );
  455. lacks_string( $content, $s, $desc );
  456. }
  457. }
  458. }
  459. =head2 $twd->body_text_contains( $str [, $desc ] )
  460. $twd->body_text_contains( $str [, $desc ] )
  461. $twd->body_text_contains( [$str_1, $str_2] [, $desc ] )
  462. Tells if the text of the page (as returned by C<< get_body() >>) contains
  463. I<$str>. If an arrayref of strings are provided, one 'test' is run for each
  464. regex against the content of the current page.
  465. A default description of 'Text contains "$str"' will be provided if there
  466. is no description.
  467. To also match the HTML see, C<< content_uncontains() >>.
  468. =cut
  469. sub body_text_contains {
  470. my $self = shift;
  471. my $str = shift;
  472. my $desc = shift;
  473. local $Test::Builder::Level = $Test::Builder::Level + 1;
  474. my $text = $self->get_body();
  475. if ( not ref $str eq 'ARRAY' ) {
  476. $desc = qq{Text contains "$str"} if ( not defined $desc );
  477. return contains_string( $text, $str, $desc );
  478. }
  479. elsif ( ref $str eq 'ARRAY' ) {
  480. for my $s (@$str) {
  481. $desc = qq{Text contains "$s"} if ( not defined $desc );
  482. contains_string( $text, $s, $desc );
  483. }
  484. }
  485. }
  486. =head2 $twd->body_text_lacks( $str [, $desc ] )
  487. $twd->body_text_lacks( $str [, $desc ] )
  488. $twd->body_text_lacks( [$str_1, $str_2] [, $desc ] )
  489. Tells if the text of the page (as returned by C<< get_body() >>)
  490. does NOT contain I<$str>. If an arrayref of strings
  491. are provided, one 'test' is run for each regex against the content of the
  492. current page.
  493. A default description of 'Text is lacks "$str"' will be provided if there
  494. is no description.
  495. To also match the HTML see, C<< content_lacks() >>.
  496. =cut
  497. sub body_text_lacks {
  498. my $self = shift;
  499. my $str = shift;
  500. my $desc = shift;
  501. local $Test::Builder::Level = $Test::Builder::Level + 1;
  502. my $text = $self->get_body();
  503. if ( not ref $str eq 'ARRAY' ) {
  504. $desc = qq{Text is lacks "$str"} if ( not defined $desc );
  505. return lacks_string( $text, $str, $desc );
  506. }
  507. elsif ( ref $str eq 'ARRAY' ) {
  508. for my $s (@$str) {
  509. $desc = qq{Text is lacks "$s"} if ( not defined $desc );
  510. lacks_string( $text, $s, $desc );
  511. }
  512. }
  513. }
  514. 1;
  515. __END__
  516. =head1 NOTES
  517. This module was forked from Test::WebDriver 0.01.
  518. For Best Practice - I recommend subclassing Test::Selenium::Remote::Driver for your application,
  519. and then refactoring common or app specific methods into MyApp::WebDriver so that
  520. your test files do not have much duplication. As your app changes, you can update
  521. MyApp::WebDriver rather than all the individual test files.
  522. =head1 AUTHORS
  523. =over 4
  524. =item *
  525. Created by: Luke Closs <lukec@cpan.org>, but inspired by
  526. L<Test::WWW::Selenium> and its authors.
  527. =back
  528. =head1 CONTRIBUTORS
  529. Test::WebDriver work was sponsored by Prime Radiant, Inc.
  530. Mark Stosberg <mark@stosberg.com> forked it as Test::Selenium::Remote::Driver
  531. and significantly expanded it.
  532. =head1 COPYRIGHT AND LICENSE
  533. Parts Copyright (c) 2012 Prime Radiant, Inc.
  534. This program is free software; you can redistribute it and/or
  535. modify it under the same terms as Perl itself.