This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use Prima qw(Application); | |
my $wDisplay = Prima::MainWindow-> create( | |
text => 'Mouse Test', | |
onMouseDown => sub { | |
print "onMouseDown got args [", join('], [', @_), "]\n"; | |
}, | |
onMouseMove => sub { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=head1 NAME | |
PDL::Transform::Color - Convert between color systems | |
=head1 SYNOPSIS | |
# load an image (in this case the cartographic demo) | |
use PDL::Transform::Cartography; $rgb = earth_image(); | |
# convert the image to CMYK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# This is a simple IRC bot that just rot13 encrypts public messages. | |
# It responds to "rot13 <text to encrypt>". | |
use warnings; | |
use strict; | |
use POE; | |
use POE::Component::IRC::State; | |
use constant CHANNEL => '#pdl'; | |
# Load the current piddlebot functions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use POE; | |
use POE::Component::IRC::State; | |
use POE::Component::IRC::Plugin::AutoJoin; | |
#use POE::Component::IRC::Plugin::BotTraffic; | |
use POE::Component::IRC::Plugin::BotCommand; | |
use POE::Component::IRC::Plugin::CycleEmpty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use PDL; | |
use Inline Pdlpp => Config => | |
INC => "-I$ENV{HOME}/include", | |
LIBS => "-L$ENV{HOME}/lib -ltcc", | |
; | |
use Inline 'Pdlpp'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
our @all_listings; | |
my %actions; | |
# Import the names of the main listings and run the command or print help | |
sub PDL_Checker::import { | |
shift; | |
@all_listings = @_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use PDL; | |
my $data; | |
BEGIN { | |
$data = rfits('20kV_1p45A_14deg_Fourier.fit'); | |
} | |
use PDL::Graphics::Prima::Simple [$data->dims]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
=pod | |
To run, say something like this: | |
perl fit-data.pl data.dat | |
where data.dat is the file created using make-data.pl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
# Create a new person, give him some cash: | |
my $david = Person->new(name => 'David', age => '29'); | |
$david->wallet->cash = 30; | |
print $david->name, ' has $', $david->wallet->cash, "\n"; # $30 | |
# This doesn't work, for reasons not clear to me: | |
$david->wallet->cash -= 10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
open my $in_fh, '<', $file_name; | |
open my $out_fh, '>', "$file_name.new"; | |
while(<$in_fh>) { | |
# Current line is stored in $_ | |
# if current line contains the text 'zend-extensions'... | |
if ($_ =~ m/zend-extensions/) { |
OlderNewer