| 1 | use strictscip-perl cpan PGPLOT 2.36 strict/; use warningsscip-perl cpan PGPLOT 2.36 warnings/; |
| 2 | use Test::Morescip-perl cpan PGPLOT 2.36 Test/More/; |
| 3 | use Configscip-perl cpan PGPLOT 2.36 Config/; |
| 4 | # Stop f77-linking causing spurious undefined symbols (alpha) |
| 5 | $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{'PERL_DL_NONLAZY'}=0 if $Configscip-perl cpan PGPLOT 2.36 main/`%Config`.{'osname'} eq "dec_osf"; |
| 6 | requirescip-perl cpan PGPLOT 2.36 main/require(). PGPLOT; |
| 7 | |
| 8 | my $dev = $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{PGPLOT_DEV} || '/NULL'; |
| 9 | |
| 10 | $ENVscip-perl cpan PGPLOT 2.36 main/`%ENV`.{PGPLOT_XW_WIDTH}=0.3; |
| 11 | |
| 12 | PGPLOT::pgbeginscip-perl cpan PGPLOT 2.36 PGPLOT/pgbegin().(0,$dev,2,2); |
| 13 | |
| 14 | PGPLOT::pgsciscip-perl cpan PGPLOT 2.36 PGPLOT/pgsci().(3); PGPLOT::pgscfscip-perl cpan PGPLOT 2.36 PGPLOT/pgscf().(2); PGPLOT::pgschscip-perl cpan PGPLOT 2.36 PGPLOT/pgsch().(1.4); |
| 15 | |
| 16 | my $pi=3.141592654; |
| 17 | |
| 18 | # Anonymous subs! |
| 19 | |
| 20 | PGPLOT::pgfunxscip-perl cpan PGPLOT 2.36 PGPLOT/pgfunx().(sub{ sqrtscip-perl cpan PGPLOT 2.36 main/sqrt().($_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]) }, 500, 0, 10, 0); |
| 21 | PGPLOT::pgfunyscip-perl cpan PGPLOT 2.36 PGPLOT/pgfuny().(sub{ sinscip-perl cpan PGPLOT 2.36 main/sin().(4*$_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]) }, 360, 0, 2*$pi, 0); |
| 22 | |
| 23 | # Pass by name and pass by reference |
| 24 | |
| 25 | PGPLOT::pgfuntscip-perl cpan PGPLOT 2.36 PGPLOT/pgfunt().("funt_x", "funt_y", 360,0, 2*$pi, 0); |
| 26 | PGPLOT::pgfuntscip-perl cpan PGPLOT 2.36 PGPLOT/pgfunt().(\&funt_x2scip-perl cpan PGPLOT 2.36 main/funt_x2()., \&funt_y2scip-perl cpan PGPLOT 2.36 main/funt_y2()., 360,0, 2*$pi, 0); |
| 27 | |
| 28 | PGPLOT::pgendscip-perl cpan PGPLOT 2.36 PGPLOT/pgend().(); |
| 29 | |
| 30 | pass; |
| 31 | done_testing; |
| 32 | |
| 33 | sub funt_xscip-perl cpan PGPLOT 2.36 main/funt_x(). { |
| 34 | my($t)=$_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]; |
| 35 | return cosscip-perl cpan PGPLOT 2.36 main/cos().($t);; |
| 36 | } |
| 37 | |
| 38 | sub funt_yscip-perl cpan PGPLOT 2.36 main/funt_y(). { |
| 39 | my($t)=$_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]; |
| 40 | return sinscip-perl cpan PGPLOT 2.36 main/sin().($t); |
| 41 | } |
| 42 | |
| 43 | sub funt_x2scip-perl cpan PGPLOT 2.36 main/funt_x2(). { |
| 44 | my($t)=$_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]; |
| 45 | return cosscip-perl cpan PGPLOT 2.36 main/cos().(4*$t)*cosscip-perl cpan PGPLOT 2.36 main/cos().($t);; |
| 46 | } |
| 47 | |
| 48 | sub funt_y2scip-perl cpan PGPLOT 2.36 main/funt_y2(). { |
| 49 | my($t)=$_scip-perl cpan PGPLOT 2.36 main/`@_`.[0]; |
| 50 | return cosscip-perl cpan PGPLOT 2.36 main/cos().(4*$t)*sinscip-perl cpan PGPLOT 2.36 main/sin().($t); |
| 51 | } |