[30313] in Perl-Users-Digest
Perl-Users Digest, Issue: 1556 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 09:14:26 2008
Date: Mon, 19 May 2008 06:14:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 19 May 2008 Volume: 11 Number: 1556
Today's topics:
Re: floating bar in the line chart <zentara@highstream.net>
new CPAN modules on Mon May 19 2008 (Randal Schwartz)
Re: Order of operations <ben@morrow.me.uk>
Re: Strawberry <rvtol+news@isolution.nl>
Re: testing (Randal L. Schwartz)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 May 2008 08:19:48 -0400
From: zentara <zentara@highstream.net>
Subject: Re: floating bar in the line chart
Message-Id: <m0s234pi357mqmin67f5frca2ljbh72dij@4ax.com>
On Mon, 19 May 2008 01:32:38 +0000 (UTC), dkcombs@panix.com (David
Combs) wrote:
>>>
>>>How can create a line chart with bar in the graph ?
>>>I am using perl+win32
>>
>>You can make anything you want on a Tk::Canvas( or a similar widget
>>like Tk::Zinc, Goo::Canvas, etc).
>>
>>Of course, you will have to do the work of making your own axis.
>>
>>zentara
>
>Sure would be nice -- VERY, VERY USEFUL, TOO -- if someone who
>familiar with tk, as well as with various CPAN chart/graph-drawing
>stuff, would, as a tutorial example, code-up such a thing (a simple one,
>of course),
>
>
>OR, maybe a more effective and "cost-effective" (time+effort being the costs)
>way to go would be to have the .pl-program simply do the drawing, etc,
>via the (open-source) "R" system, an (the?) open-source replacement for
>the (non-free) "S" ("the NEW S Language" was its name) package?
>
>Opinions?
I've been thinking about making a Canvas based graphing module, but just
havn't been motivated lately. :-(
The biggest problem, as far as I'm concerned, is figuring out a
foolproof axis with labels, that are accurate and expand and contract
properly without smearing and overlap.
The Goo::Canvas, which is a fairly recent canvas based on Gtk2 and
Cairo, looks to be the best bet, since the Canvas supports zoomable
text, pixel zoom (zooming of canvas or selection), and
semi-transparency.
If you are interested, this is the result of my last experiment to test
the idea. It uses a drawing_area for the graph and accepts data thru a
socket. So start the charter first, press Open Connection, then start
the data sender script. It has moving axis, modifiable axis (probably
still buggy), and "scroll-in-view" where the y scrollbar will pull
itself to a point where the current data is in view. I've also tried to
include some color control for each point, but don't let that confuse
you.
I think the Goo::Canvas will be better than a drawing area.
watch out for wordwrap errors when copying
####################################
# the charter script
#!/usr/bin/perl
use warnings;
use strict;
use Glib qw/TRUE FALSE/;
use Gtk2 -init;
use IO::Socket;
#use Data::Dumper;
#use diagnostics;
#$SIG{PIPE} = 'IGNORE';
#use GMeM;
$|++;
my $tag;
my $start = 0;
my $YBASE; # globals for origin of graph
my $XBASE; #
my @y_ave = ();
my $xm = 75; # pixels on left-right margins
my $ym = 75; # pixels on top-bottom margins
# setup y axis # 32767 is (8bit int max) -1
my $ysize = 1000; # total desired size of the y dimension of graph
# not the scrollable window size, but real size
# this affects how huge the saved file will be.
my $ymax = $ysize - 2 * $ym; #size of
pixmap's graph
my @y_range = ( 0, 400 ); # low, high of
y-axis
my $y_tot_units = $y_range[ 1 ] - $y_range[ 0 ];
my $y_pix_per_unit = abs( $ymax / $y_tot_units );
my $y_unit_per_grad_1 = 10; # finest
markers
my $y_unit_per_grad_2 = 100; # secondary
markers
my $y_unit_per_grad_3 = 500; # tertiary
markers
# setup x axis, the timeline,
# gtk2 pixmaps have a current limit of short unsigned INT
# attempting highest resolution possible for time line, x-axis
# 32767 is (8bit int max) -1
my $xsize = 3000; # 32767 is (8bit int max) -1
my $xmax = $xsize - 2 * $xm; # 9 x 3600... 9 pixels width per
second
my @x_range = ( 0, 1000 ); # low, high of y-axis
my $x_tot_units = $x_range[ 1 ] - $x_range[ 0 ];
my $x_pix_per_unit = abs( $xmax / $x_tot_units );
my $x_unit_per_grad_1 = 5; # finest
markers
my $x_unit_per_grad_2 = 50; # secondary
markers
my $x_unit_per_grad_3 = 100; # tertiary
markers
my $y_intercept = 0;
my $x_intercept = 0; #normally 0 :-)
my $xsizenew; # allow for resizing window before building
my $ysizenew; # graph axis
my ( $x0, $y0, $x1, $y1, $width, ) = ( 0, 0, 0, 0 );
# Backing pixmap for drawing area
my %area;
my %pixmap;
my %gc;
my %colormap;
my %allocated_colors;
my %pango_layout;
my $linecolor = 'red';
my $axiscolor = 'black';
my %background = (
'm' => 'white',
't' => 'cornsilk',
'l' => 'lightcyan',
'c' => 'blue',
);
# Create the window
my $window = new Gtk2::Window( "toplevel" );
$window->signal_connect( "delete_event", sub { Gtk2->main_quit; } );
$window->set_border_width( 10 );
#$window->set_size_request( 640, 480 );
$window->set_position( 'center' );
my $vbox = Gtk2::VBox->new( 0, 0 );
$window->add( $vbox );
$vbox->set_border_width( 2 );
my $hbox = Gtk2::HBox->new( 0, 0 );
$vbox->pack_start( $hbox, 1, 1, 0 );
#$hbox->set_size_request( 320, 240 );
$hbox->set_border_width( 2 );
my $hbox1 = Gtk2::HBox->new( 0, 0 );
$vbox->pack_start( $hbox1, 0, 0, 0 );
$hbox1->set_border_width( 2 );
my $button1 = Gtk2::Button->new( 'Modify Axis' );
$hbox1->pack_start( $button1, FALSE, FALSE, 2 );
$button1->signal_connect( clicked => \&clicked );
my $button1a = Gtk2::Button->new( 'Open Connection' );
$hbox1->pack_start( $button1a, FALSE, FALSE, 2 );
$button1a->signal_connect( clicked => \&collect_data );
my $button2 = Gtk2::Button->new( 'Quit' );
$hbox1->pack_end( $button2, FALSE, FALSE, 6 );
$button2->signal_connect( clicked => sub { exit; } );
my $button3 = Gtk2::Button->new( 'Save' );
$hbox1->pack_end( $button3, FALSE, FALSE, 2 );
$button3->signal_connect( clicked => \&save_it );
my $yentry = Gtk2::Entry->new;
$hbox1->pack_end( $yentry, FALSE, FALSE, 2 );
my $ylabel = Gtk2::Label->new();
$ylabel->set_markup('<span foreground="DarkRed"
size="x-large"><b>Y:</b></span>');
$hbox1->pack_end( $ylabel, FALSE, FALSE, 0 );
my $xentry = Gtk2::Entry->new;
$hbox1->pack_end( $xentry, FALSE, FALSE, 2 );
my $xlabel = Gtk2::Label->new();
$xlabel->set_markup('<span foreground="DarkGreen"
size="x-large"><b>X:</b></span>');
$hbox1->pack_end( $xlabel, FALSE, FALSE, 0 );
my $table = new Gtk2::Table( 4, 4, FALSE );
$hbox->pack_start( $table, 1, 1, 0 );
########### main ##########################
my $vp = Gtk2::Viewport->new();
$vp->set_size_request( 500, 400 );
$table->attach(
$vp, 1, 3, 1, 3,
[ 'expand', 'fill' ],
[ 'expand', 'fill' ],
0, 0
);
# Create the drawing area.
$area{ 'm' } = new Gtk2::DrawingArea;
$area{ 'm' }->size( $xsize, $ysize );
$vp->add( $area{ 'm' } );
$area{ 'm' }->show;
# Signals used to handle backing pixmap
$area{ 'm' }->signal_connect( expose_event => \&expose_event, 'm'
);
$area{ 'm' }->signal_connect( configure_event => \&configure_event, 'm'
);
$area{ 'm' }->set_events( [qw/exposure-mask leave-notify-mask
button-press-mask pointer-motion-mask pointer-motion-hint-mask/
]);
$area{ 'm' }->signal_connect( button_press_event => \&button_press_event
);
$pango_layout{ 'm' } = $area{ 'm' }->create_pango_layout( "" ); #
global for text
##################################################
######### top ####################################
my $vpt = Gtk2::Viewport->new( undef, undef );
$vpt->set_size_request( 400, 100 );
$table->attach( $vpt, 1, 3, 0, 1, [ 'expand', 'shrink', 'fill' ], [], 0,
0 );
# Create the drawing area.
$area{ 't' } = new Gtk2::DrawingArea;
$area{ 't' }->size( $xsize, 100 );
$vpt->add( $area{ 't' } );
$area{ 't' }->show;
# Signals used to handle backing pixmap
$area{ 't' }->signal_connect( expose_event => \&expose_event, 't'
);
$area{ 't' }->signal_connect( configure_event => \&configure_event, 't'
);
$pango_layout{ 't' } = $area{ 't' }->create_pango_layout( "" ); #
global for text
#############################################################
######### left ####################################
my $vpl = Gtk2::Viewport->new( undef, undef );
$vpl->set_size_request( 100, 300 );
$table->attach( $vpl, 0, 1, 1, 3, [], [ 'expand', 'shrink', 'fill' ], 0,
0 );
# Create the drawing area.
$area{ 'l' } = new Gtk2::DrawingArea;
$area{ 'l' }->size( 100, $ysize );
$vpl->add( $area{ 'l' } );
$area{ 'l' }->show;
# Signals used to handle backing pixmap
$area{ 'l' }->signal_connect( expose_event => \&expose_event, 'l'
);
$area{ 'l' }->signal_connect( configure_event => \&configure_event, 'l'
);
$pango_layout{ 'l' } = $area{ 'l' }->create_pango_layout( "" ); #
global for text
#############################################################
######### upper left corner fill ####################################
my $vpc = Gtk2::Viewport->new( undef, undef );
$vpc->set_size_request( 100, 100 );
$table->attach( $vpc, 0, 1, 0, 1, [],[], 0, 0 );
# Create the drawing area.
$area{ 'c' } = new Gtk2::DrawingArea;
$area{ 'c' }->size( 100, 100 );
$vpc->add( $area{ 'c' } );
$area{ 'c' }->show;
# Signals used to handle backing pixmap
$area{ 'c' }->signal_connect( expose_event => \&expose_event, 'c'
);
$area{ 'c' }->signal_connect( configure_event => \&configure_event, 'c'
);
$pango_layout{ 'c' } = $area{ 'c' }->create_pango_layout( "" ); #
global for text
#############################################################
#scrollbars
my $ha1 = $vp->get_hadjustment;
my $hscrollbar = Gtk2::HScrollBar->new( $ha1 );
$hscrollbar->set_update_policy( 'continuous' );
$table->attach( $hscrollbar, 1, 3, 3, 4, [ 'expand', 'shrink', 'fill' ],
[], 0, 0 );
my $va1 = $vp->get_vadjustment;
my $vscrollbar = Gtk2::VScrollBar->new( $va1 );
$vscrollbar->set_update_policy( 'continuous' );
$table->attach( $vscrollbar, 3, 4, 1, 3, [], [ 'fill', 'expand',
'shrink' ],
0, 0 );
$vpl->set_vadjustment( $va1 );
$vpt->set_hadjustment( $ha1 );
$window->show_all;
&start;
Gtk2->main;
#######################################################
sub start {
#get current window size and freeze it, so y scaling is constant
my ( undef, undef, $width0, $height0, undef ) =
$window->window->get_geometry;
$window->set_size_request( $width0, $height0 );
# $window->set_resizable( 0 );
( undef, undef, $xsizenew, $ysizenew, undef ) = $area{ 'm'
}->window->get_geometry;
# print "$xsizenew $ysizenew\n";
&draw_axis();
}
########################################################
sub get_color {
my ( $name, $id ) = @_;
$id ||='m';
my $ret;
if ( $ret = $allocated_colors{ $name } ) { return $ret }
my $color = Gtk2::Gdk::Color->parse( $name );
$colormap{ $id }->alloc_color( $color, TRUE, TRUE );
$allocated_colors{ $name } = $color;
return $color;
}
##########################################################
sub mydraw_linec {
my ( $id, $line, $color ,$attr, $dashattr) = @_;
$color ||= get_color('black',$id);
# $gc->set_line_attributes ($line_width, $line_style, $cap_style,
$join_style)
if(! defined $attr ){ $attr = [ 1, 'solid', 'round', 'round' ] }
if( $attr->[1] =~ /dash/i ){ $gc{$id}->set_dashes(@$dashattr) }
#$gc{$id}->set_dashes ($dash_offset, ... (list) of dash lengths
$colormap{ $id }->alloc_color( $color, TRUE, TRUE );
$gc{$id}->set_foreground( $color );
$gc{$id}->set_line_attributes (@$attr);
$pixmap{ $id }->draw_line( $gc{ $id }, @$line );
$area{ $id }->queue_draw;
return 0;
}
##########################################################
sub mydraw_points{
my ( $id, $coords, $color ) = @_;
$colormap{ $id }->alloc_color( $color, TRUE, TRUE );
$gc{$id}->set_foreground( $color );
$pixmap{ $id }->draw_points( $gc{ $id }, @$coords );
$area{ $id }->queue_draw;
return 0;
}
#########################################################
sub draw_ptext {
my ( $id, $x, $y, $markup, $redraw ) = @_;
$redraw ||= 1; # set to 0 if undef
# see Gdk::Gdk::Window, Gtk2::Gdk::Drawable, Gtk2::Gdk::GC
$pango_layout{ $id }->set_alignment( 'center' );
$pango_layout{ $id }->set_markup( $$markup );
$pixmap{ $id }->draw_layout( $gc{ $id }, $x, $y, $pango_layout{ $id }
);
if ( $redraw == 1 ) { $area{ $id }->queue_draw } #updates actual
visual
}
#####################################################################
sub collect_data {
$gc{ 'm' }->set_line_attributes( 1, 'solid', 'round', 'round' );
print "start $XBASE $YBASE\n";
my $sock = IO::Socket::INET->new(
Proto => 'tcp',
LocalPort => 7070,
Listen => 1,
Reuse => 1,
) or die "Can't create listen socket : $@\n";
Glib::IO->add_watch (fileno $sock, 'in', \&new_con, $sock);
print "Awaiting TCP messages on port 7070\n";
return 0;
}
##################################################################
sub new_con {
my ($fd, $condition, $fh) = @_;
my $new_sock = $fh->accept();
$tag = Glib::IO->add_watch (fileno $new_sock, 'in', \&handle_con,
$new_sock);
return 0;
}
##################################################################
sub handle_con {
my ($fd, $condition,$fh) = @_;
my $buffer;
if ( not sysread( $fh, $buffer, 4096) ) {
# obviously the connected pipe was closed
Glib::Source->remove($tag) or warn "couldnt remove watcher $!\n";
warn "signal lost\n";
close($fh);
return 1;
}
&plot($buffer);
#always return TRUE to continue the callback
return TRUE;
}
############################################################3
sub plot{
my ($buffer) = @_;
print "$buffer\n";
#$x0 = $XBASE + $x_range[0] * $x_pix_per_unit;
#$y0 = $YBASE - $y * $y_pix_per_unit;
my ($xin,$y,$r,$g,$b,$mode) = split /\s+/, $buffer;
my $color = Gtk2::Gdk::Color->new ($r,$g,$b);
$xentry->set_text($xin);
$yentry->set_text($y);
$x1 = $XBASE + $xin * $x_pix_per_unit;
$y1 = $YBASE - $y * $y_pix_per_unit;
#check out of bounds
return if ( ($xin > $x_range[1] ) or ($xin < $x_range[0]) );
#check out of bounds
# return if ( ($y1 > $y_range[1] ) or ($y1 < $y_range[0]) );
if($mode eq 'line'){
&mydraw_linec( 'm' , [ $x0, $y0, $x1, $y1 ], $color ) if $start;
$x0 = $x1;
$y0 = $y1;
$area{ 'm' }->queue_draw;
if ( $x1 > $xsize - $ym ) { return 0 }
}
if($mode eq 'point'){
&mydraw_points('m',[$x1,$y1,
$x1,$y1-1,
$x1,$y1+1,
# $x1,$y1-2,
# $x1,$y1+2,
# $x1,$y1-3,
# $x1,$y1+3,
$x1-1,$y1,
$x1+1,$y1,
# $x1-2,$y1,
# $x1+2,$y1,
# $x1-3,$y1,
# $x1+3,$y1,
], $color ) if $start;
}
#autoscroll x
my $hinc = $ha1->page_increment();
if ( ( $x1 > .75 * $hinc ) and ( $x1 < $xsize ) ) {
$ha1->set_value( $x1 - $hinc );
}
#autoscroll y
#keep runing pseudo average of last 10 y values
#keep last 10 values in array and average first and last
my $vinc = $va1->page_increment();
push @y_ave,$y1;
if( scalar @y_ave > 100){
my $min = $y_ave[0];
my $max = $y_ave[0];
for my $x (@y_ave) {
if ($x < $min) { $min = $x }
elsif ($x > $max) { $max = $x }
}
my $mid_y = ($min + $max)/2;
shift @y_ave;
#check out of bounds
my $value = $mid_y - $hinc/2;
if ( ($value > $y_range[0] - $hinc/2 ) and ($value <
$y_range[1]) - $hinc/2 ){
$va1->set_value($value);
}
}
$start = 1; #allow first point to be computed
return 1;
}
############################################################
sub button_press_event {
my $widget = shift; # GtkWidget *widget
my $event = shift; # GdkEventButton *event
if ( $event->button == 1 ) {
print join ' ', $event->coords, "\n";
}
return TRUE;
}
###############################################################
# Create a new backing pixmap of the appropriate size
sub configure_event {
my $widget = shift; # GtkWidget *widget
my $event = shift; # GdkEventConfigure *event
my $id = shift;
$pixmap{ $id } = Gtk2::Gdk::Pixmap->new(
$widget->window,
$widget->allocation->width,
$widget->allocation->height, -1
);
$gc{ $id } = Gtk2::Gdk::GC->new( $pixmap{ $id } );
$colormap{ $id } = $pixmap{ $id }->get_colormap;
# set a default foreground for the rectangle color
$gc{ $id }->set_foreground( get_color( $background{ $id }, $id ) );
#corksilk lightcyan white
$pixmap{ $id }->draw_rectangle(
$gc{ $id },
TRUE, 0, 0,
$widget->allocation->width,
$widget->allocation->height
);
#make corner decorations
if( $id eq 'c'){
$gc{ 'c' }->set_foreground( get_color( $background{ 't' }, 'c' ) );
$pixmap{$id}->draw_polygon($gc{'c'},1, 0,0,100,0,100,100 ,
$background{'t'} );
}
if( $id eq 'c'){
$gc{ 'c' }->set_foreground( get_color( $background{ 'l' }, 'c' ) );
$pixmap{$id}->draw_polygon($gc{'c'},1, 0,0,100,100,0,100 ,
$background{'l'} );
}
return TRUE;
}
##############################################################
# Redraw the screen from the backing pixmap
sub expose_event {
my $widget = shift; # GtkWidget *widget
my $event = shift; # GdkEventExpose *event
my $id = shift;
$widget->window->draw_drawable(
$widget->style->fg_gc( $widget->state ), $pixmap{ $id },
$event->area->x, $event->area->y,
$event->area->x, $event->area->y,
$event->area->width, $event->area->height
);
return FALSE;
}
##############################################################
sub save_it {
my ( $width, $height ) = $area{ 'm' }->window->get_size;
my ( $x, $y, $width1, $height1, $depth ) = $vp->window->get_geometry;
#my ($x,$y,$width1, $height1,$depth) = $vp->window->get_geometry;
print "$width $height\n";
print "$width1 $height1\n";
# create blank pixbuf to hold the whole image
my $lpixbuf = Gtk2::Gdk::Pixbuf->new( 'rgb', 0, 8, $width, $height );
$lpixbuf->get_from_drawable( $pixmap{ 'm' },
undef, 0, 0, 0, 0, $width, $height );
#only jpeg and png is supported !!!! it's 'jpeg', not 'jpg'
$lpixbuf->save( "$0-large.jpg", 'jpeg', quality => 100 );
return FALSE;
}
################################################################
sub clicked {
my $dialog = Gtk2::Dialog->new(
'Axis Settings',
undef,
[ qw/modal destroy-with-parent/ ],
'gtk-cancel' => 'cancel',
'Ok' => 'ok',
);
$dialog->set_response_sensitive( 'reject', FALSE );
$dialog->set_response_sensitive( 'accept', FALSE );
$dialog->signal_connect( 'delete-event' => sub { $dialog->destroy }
);
$dialog->set_position( 'center-always' );
&fill_dialog( $dialog );
$dialog->show();
}
##########################################################################
sub fill_dialog {
my ( $dialog ) = @_;
my $vbox = $dialog->vbox;
$vbox->set_border_width( 5 );
my $frame0 = Gtk2::Frame->new( 'Axis Controls' );
$frame0->set_shadow_type( 'in' );
$vbox->pack_start( $frame0, FALSE, FALSE, 0 );
$frame0->set_border_width( 3 );
my $table = Gtk2::Table->new( 4, 4, FALSE );
$table->set_row_spacings( 4 );
$table->set_col_spacings( 4 );
$frame0->add( $table );
$table->show;
my @defaults = ( [ qw/expand fill shrink/ ], [ qw/expand fill shrink/
] );
my $zl = Gtk2::Label->new( 'X-Total-Pixels->' );
my $adj = Gtk2::Adjustment->new( $xsize, 50, 32767, 1, 50, 50 );
# $value, $lower, $upper, $step_inc, page_increment, $page_size
$adj->signal_connect( value_changed => \&axis_changed, \$xsize );
my $za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 0, 1, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 0, 1, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-Total-Pixels->' );
$adj = Gtk2::Adjustment->new( $ysize, 50, 32767, 1, 50, 50 );
$adj->signal_connect( value_changed => \&axis_changed, \$ysize );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 0, 1, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 0, 1, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-margin->' );
$adj = Gtk2::Adjustment->new( $xm, 50, 200, 1, 1, 1 );
# $value, $lower, $upper, $step_inc, page_increment, $page_size
$adj->signal_connect( value_changed => \&axis_changed, \$xm );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 1, 2, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 1, 2, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-margin->' );
$adj = Gtk2::Adjustment->new( $ym, 50, 200, 1, 1, 1 );
$adj->signal_connect( value_changed => \&axis_changed, \$ym );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 1, 2, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 1, 2, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-Upper-Range-limit->' );
$adj = Gtk2::Adjustment->new( $x_range[ 1 ], 50, 100000, 1, 50, 50 );
$adj->signal_connect( value_changed => \&axis_changed, \$x_range[ 1 ]
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 2, 3, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 2, 3, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-Upper-Range-limit->' );
$adj = Gtk2::Adjustment->new( $y_range[ 1 ], 50, 100000, 1, 50, 50 );
$adj->signal_connect( value_changed => \&axis_changed, \$y_range[ 1 ]
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 2, 3, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 2, 3, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-Lower-Range-limit->' );
$adj = Gtk2::Adjustment->new( $x_range[ 0 ], -100000, 100000, 1, 50,
50 );
$adj->signal_connect( value_changed => \&axis_changed, \$x_range[ 0 ]
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 3, 4, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 3, 4, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-Lower-Range-limit->' );
$adj = Gtk2::Adjustment->new( $y_range[ 0 ], -100000, 100000, 1, 50,
50 );
$adj->signal_connect( value_changed => \&axis_changed, \$y_range[ 0 ]
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 3, 4, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 3, 4, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-units-per-grad1->' );
$adj = Gtk2::Adjustment->new( $x_unit_per_grad_1, 1, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$x_unit_per_grad_1 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 4, 5, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 4, 5, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-units-per-grad1->' );
$adj = Gtk2::Adjustment->new( $y_unit_per_grad_1, 1, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$y_unit_per_grad_1 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 4, 5, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 4, 5, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-units-per-grad2->' );
$adj = Gtk2::Adjustment->new( $x_unit_per_grad_2, 5, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$x_unit_per_grad_2 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 5, 6, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 5, 6, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-units-per-grad2->' );
$adj = Gtk2::Adjustment->new( $y_unit_per_grad_2, 5, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$y_unit_per_grad_2 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 5, 6, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 5, 6, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-units-per-grad3->' );
$adj = Gtk2::Adjustment->new( $x_unit_per_grad_3, 5, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$x_unit_per_grad_3 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 6, 7, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 6, 7, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-units-per-grad3->' );
$adj = Gtk2::Adjustment->new( $y_unit_per_grad_3, 5, 1000, 1, 50, 50
);
$adj->signal_connect( value_changed => \&axis_changed,
\$y_unit_per_grad_3 );
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 6, 7, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 6, 7, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'X-intercept->' );
$adj = Gtk2::Adjustment->new( $x_intercept, 0, 1000, 1, 50, 50 );
$adj->signal_connect( value_changed => \&axis_changed, \$x_intercept
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 0, 1, 7, 8, @defaults, 0, 0 );
$table->attach( $za, 1, 2, 7, 8, @defaults, 0, 0 );
$zl = Gtk2::Label->new( 'Y-intercept->' );
$adj = Gtk2::Adjustment->new( $y_intercept, 0, 1000, 1, 50, 50 );
$adj->signal_connect( value_changed => \&axis_changed, \$y_intercept
);
$za = Gtk2::SpinButton->new( $adj, 0.0, 2 );
$table->attach( $zl, 2, 3, 7, 8, @defaults, 0, 0 );
$table->attach( $za, 3, 4, 7, 8, @defaults, 0, 0 );
#response (Gtk2::Dialog, integer) - second element generated during
#the signal emitting will be the button's name
$dialog->signal_connect(
response => sub {
if ( $_[ 1 ] =~ m/ok/ ) {
# print "YOU CLICKED: " . $_[ 1 ] . "\n";
foreach my $id('m','l','t'){
&configure_event( $area{$id},undef,$id );
}
$x_tot_units = $x_range[ 1 ] - $x_range[ 0 ];
$x_pix_per_unit = abs( $xmax / $x_tot_units );
$y_tot_units = $y_range[ 1 ] - $y_range[ 0 ];
$y_pix_per_unit = abs( $ymax / $y_tot_units );
&start;
$dialog->destroy;
}
if ( $_[ 1 ] =~ m/cancel/ ) {
$dialog->destroy;
}
}
);
$vbox->show_all();
return $vbox;
}
##############################################################################
sub axis_changed {
my ( $adj, $varref ) = @_;
$$varref = $adj->get_value;
}
##########################################################################
sub draw_axis {
my $ybase0; my $xbase0;
for my $id('m','t','l'){
$ybase0 = $ysize - $ym - ( $y_intercept - $y_range[ 0 ] ) *
$y_pix_per_unit;
$xbase0 = $xm + ( $x_intercept - $x_range[ 0 ] ) * $x_pix_per_unit;
if( $id eq 'm'){
&mydraw_linec( 'm' , [$xm, $ybase0, $xsize - $xm, $ybase0 ],
get_color('green'),[ 2, 'solid', 'round', 'round' ] );
&mydraw_linec( 'm' , [$xbase0, $ysize - $ym, $xbase0, $ym ],
get_color('green'),[ 2, 'solid', 'round', 'round' ] );
}
if( $id eq 't'){ &mydraw_linec('t', [$xm, 50, $xsize - $xm, 50 ],
get_color('green','t'),[ 2, 'solid', 'round', 'round' ] )
}
if( $id eq 'l'){ &mydraw_linec('l', [75, $ysize - $ym, 75, $ym],
get_color('green','l'),[ 2, 'solid', 'round', 'round' ] );
}
$area{ $id }->queue_draw;
if(( $id eq 'm')or($id eq 't')){
# x-axis-ticks ##################################################
my $tflag;
my $tlength;
my $labflag;
my $text = '';
my $xbase = $xm;
my $count = 0;
for ( $x_range[ 0 ] .. $x_range[ 1 ] ) {
my $xpos = $xbase + $count * $x_pix_per_unit;
$tflag = 0;
$tlength = 5;
$labflag = 0;
$text = '';
if ( $count == 0 ) {
$tflag = 1;
$tlength = 25;
$labflag = 1;
$text = 0;
}
else {
if ( ( $count % $x_unit_per_grad_1 ) == 0 ) {
$tflag = 1;
}
if ( ( $count % $x_unit_per_grad_2 ) == 0 ) {
$tflag = 1;
$tlength = 10;
$labflag = 1;
}
if ( ( $count % $x_unit_per_grad_3 ) == 0 ) {
$tflag = 1;
$tlength = 25;
$labflag = 1;
}
if ( $count == $x_range[ 1 ] ) {
$tflag = 1;
$tlength = 25;
$labflag = 1;
}
}
if ( $tflag ) {
$text = $_;
&mydraw_linec( 'm', [$xpos, $ybase0, $xpos, $ybase0 +
$tlength],
get_color('black'),[ 1, 'solid', 'round', 'round' ] );
&mydraw_linec( 't', [$xpos, 50, $xpos, 50 + $tlength],
get_color('black'),[ 1, 'solid', 'round', 'round' ] );
$area{ $id }->queue_draw;
if ( $labflag ) {
my $markup;
if ( $tlength == 25 ) {
$markup = "<span foreground = '#0000FF'
size = '15000' weight = 'light' >$text </span>";
}
else {
$markup = "<span foreground = '#000000'
size = '10000' weight = 'ultralight' >$text </span>";
}
#&draw_ptext( $id, $xpos, $ybase0 + $tlength, \$markup, 0 );
&draw_ptext( 'm', $xpos, $ybase0 + $tlength, \$markup, 0 );
&draw_ptext( 't', $xpos, 50 + $tlength, \$markup, 0 );
}
}
$count++;
}
}
if(( $id eq 'm')or($id eq 'l')){
# y-axis-ticks ##################################################
my $fudge = 1;
my $ybase = $ysize - $ym;
my $count = 0;
for ( $y_range[ 0 ] .. $y_range[ 1 ] ) {
my $ypos = $ybase - $count * $y_pix_per_unit;
return if $ypos < $ym;
my $tflag = 0;
my $tlength = 5;
my $labflag = 0;
my $text = '';
my $fudge = 1;
if ( $count == 0 ) {
$tflag = 1;
$labflag = 1;
$text = 0;
$tlength = 15;
}
else {
if ( ( $count % $y_unit_per_grad_1 ) == 0 ) {
$tflag = 1;
$labflag = 1;
$tlength = 5;
$fudge = 2;
}
if ( ( $count % $y_unit_per_grad_2 ) == 0 ) {
$tflag = 1;
$labflag = 1;
$tlength = 15;
$fudge = 1;
}
}
if ( $tflag ) {
$text = $_;
&mydraw_linec( 'm', [$xbase0, $ypos, $xbase0 - $tlength,
$ypos],
get_color( 'black'),[ 1, 'solid', 'round', 'round' ] );
&mydraw_linec( 'l', [75, $ypos, 75 - $tlength, $ypos],
get_color( 'black'),[ 1, 'solid', 'round', 'round' ] );
$area{ $id }->queue_draw;
if ( $labflag ) {
my $markup;
if ( $tlength == 15 ) {
$markup = "<span foreground = '#FF0000'
size = '10000' weight = 'light' >$text
</span>";
}
else {
$markup = "<span foreground = '#000000'
size = '10000' weight = 'ultralight' >$text
</span>";
}
#&draw_ptext( $id, $xbase0 - $fudge * 3.0 * $tlength, $ypos
- 4, \$markup, 0 );
&draw_ptext( 'm', $xbase0 - $fudge * 3.0 * $tlength, $ypos -
4, \$markup, 0 );
&draw_ptext( 'l', 75 - $fudge * 3.0 * $tlength, $ypos - 4,
\$markup, 0 );
}
}
$count++;
}
}
#my $label = Gtk2::Label->new();
# #start with it at 90deg to have max space alllocated to it
# $label->set_angle(90);
# $label->set_markup('<span foreground="DarkRed"
size="x-large"><b>Rotating Label</b></span>');
}
##########################################################################
$gc{ 'm' }->set_foreground( get_color( $linecolor, 'm' ) );
#set scrollbars
my $page_size = $va1->page_size();
my $setting = $ybase0 - $page_size / 2;
my $upper = $va1->upper() - $page_size;
if ( $setting >= $upper ) { $setting = $upper }
$va1->set_value( $setting ); #go to end
$page_size = $ha1->page_size();
$ha1->set_value( $xbase0 - $page_size / 2 );
# set global base position
$YBASE = $ybase0;
$XBASE = $xbase0;
$x0 = $XBASE;
$y0 = $YBASE;
#print "bases $XBASE $YBASE\n";
$start = 0;
return 0;
}
__END__
#################################################
# the data sender
#!/usr/bin/perl
use warnings;
use strict;
use IO::Socket;
my ($xmin, $xmax ) = ($ARGV[0],$ARGV[1]);
$xmin ||= 0;
$xmax ||= 1000;
my $machine_addr = '192.168.0.9';
my $sock = new IO::Socket::INET(
PeerAddr=>$machine_addr,
PeerPort=>7070,
Proto=>'tcp',
);
die "Could not connect: $!" unless $sock;
my $xin = $xmin;
while(1){
# my $r = int rand 65535;
# my $g = int rand 65535;
# my $b = int rand 65535;
my($r,$g,$b) = (65535,0,0);
my $y = 100 + 50*sin(600*$xin); #try 600 too
# my $y = 100 + 50*sin(.01*$xin);
my $send = "$xin $y $r $g $b line";
print $sock "$send\n";
print "$send\n";
# select(undef,undef,undef,.01) ;
select(undef,undef,undef,.05) ;
$xin++;
if( $xin > $xmax){ last }
}
close ($sock);
__END__
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Mon, 19 May 2008 04:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon May 19 2008
Message-Id: <K13MEI.2t3@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
-0.01
http://search.cpan.org/~marcel/-0.01/
----
AnyEvent-FastPing-1.11
http://search.cpan.org/~mlehmann/AnyEvent-FastPing-1.11/
quickly ping a large number of hosts
----
App-Info-0.54
http://search.cpan.org/~dwheeler/App-Info-0.54/
Information about software packages on a system
----
Audio-Analyzer-0.1
http://search.cpan.org/~triddle/Audio-Analyzer-0.1/
----
Audio-Gramofile-0.08
http://search.cpan.org/~bobw/Audio-Gramofile-0.08/
Perl interface to libgramofile, a library derived from Gramofile
----
Audio-GtkGramofile-0.09
http://search.cpan.org/~bobw/Audio-GtkGramofile-0.09/
a Gtk2-Perl interface to libgramofile.
----
CPANPLUS-0.85_02
http://search.cpan.org/~kane/CPANPLUS-0.85_02/
API & CLI access to the CPAN mirrors
----
Catalyst-Plugin-Config-Multi-0.01
http://search.cpan.org/~tomyhero/Catalyst-Plugin-Config-Multi-0.01/
Catalyst Config Plugin using Config::Multi
----
Catalyst-Plugin-Config-Multi-0.02
http://search.cpan.org/~tomyhero/Catalyst-Plugin-Config-Multi-0.02/
Catalyst Config Plugin using Config::Multi
----
Class-Std-Fast_XS-0.2
http://search.cpan.org/~mkutter/Class-Std-Fast_XS-0.2/
speed up Class::Std::Fast by adding some XS code
----
Coat-0.320
http://search.cpan.org/~sukria/Coat-0.320/
A light and self-dependent meta-class for Perl5
----
Config-Multi-0.04
http://search.cpan.org/~tomyhero/Config-Multi-0.04/
load multiple config files.
----
CouchDB-View-0.002
http://search.cpan.org/~hdp/CouchDB-View-0.002/
handle and create CouchDB views in Perl
----
CouchDB-View-0.003
http://search.cpan.org/~hdp/CouchDB-View-0.003/
handle and create CouchDB views in Perl
----
Crypt-Cracklib-1.4
http://search.cpan.org/~daniel/Crypt-Cracklib-1.4/
Perl interface to Alec Muffett's Cracklib.
----
Crypt-OpenSSL-PKCS12-0.5
http://search.cpan.org/~daniel/Crypt-OpenSSL-PKCS12-0.5/
Perl extension to OpenSSL's PKCS12 API.
----
Data-Hexdumper-1.4
http://search.cpan.org/~dcantrell/Data-Hexdumper-1.4/
Make binary data human-readable
----
DataExtract-FixedWidth-0.06
http://search.cpan.org/~ecarroll/DataExtract-FixedWidth-0.06/
The one stop shop for parsing static column width text tables!
----
DateTime-0.43
http://search.cpan.org/~drolsky/DateTime-0.43/
A date and time object
----
DateTime-0.4301
http://search.cpan.org/~drolsky/DateTime-0.4301/
A date and time object
----
DateTime-Locale-0.40
http://search.cpan.org/~drolsky/DateTime-Locale-0.40/
Localization support for DateTime.pm
----
DateTime-TimeZone-0.76
http://search.cpan.org/~drolsky/DateTime-TimeZone-0.76/
Time zone object base class and factory
----
Devel-Profit-0.32
http://search.cpan.org/~lbrocard/Devel-Profit-0.32/
----
Device-USB-TranceVibrator-0.01
http://search.cpan.org/~hirose/Device-USB-TranceVibrator-0.01/
interface to toy Trance Vibrator
----
Dowse-BadSSH-0.08
http://search.cpan.org/~samv/Dowse-BadSSH-0.08/
----
EV-3.33
http://search.cpan.org/~mlehmann/EV-3.33/
perl interface to libev, a high performance full-featured event loop
----
File-Fetch-0.15_02
http://search.cpan.org/~kane/File-Fetch-0.15_02/
A generic file fetching mechanism
----
File-LibMagic-0.86
http://search.cpan.org/~fitzner/File-LibMagic-0.86/
Perlwrapper for libmagic
----
File-LibMagic-0.88
http://search.cpan.org/~fitzner/File-LibMagic-0.88/
Perlwrapper for libmagic
----
Games-RolePlay-MapGen-1.2.14
http://search.cpan.org/~jettero/Games-RolePlay-MapGen-1.2.14/
The base object for generating dungeons and maps
----
HTTP-Engine-0.0.8
http://search.cpan.org/~yappo/HTTP-Engine-0.0.8/
Web Server Gateway Interface and HTTP Server Engine Drivers (Yet Another Catalyst::Engine)
----
IO-Lambda-0.15
http://search.cpan.org/~karasik/IO-Lambda-0.15/
non-blocking I/O in lambda style
----
IPC-Cmd-0.41_01
http://search.cpan.org/~kane/IPC-Cmd-0.41_01/
finding and running system commands made easy
----
List-Compare-0.35
http://search.cpan.org/~jkeenan/List-Compare-0.35/
Compare elements of two or more lists
----
List-Enumerator-0.01
http://search.cpan.org/~satoh/List-Enumerator-0.01/
list construct library
----
Mail-ClamAV-0.22
http://search.cpan.org/~sabeck/Mail-ClamAV-0.22/
Perl extension for the clamav virus scanner
----
Module-Install-AutoManifest-0.002
http://search.cpan.org/~hdp/Module-Install-AutoManifest-0.002/
generate MANIFEST automatically
----
Module-Install-AutoManifest-0.003
http://search.cpan.org/~hdp/Module-Install-AutoManifest-0.003/
generate MANIFEST automatically
----
Object-Accessor-0.34
http://search.cpan.org/~kane/Object-Accessor-0.34/
----
POE-Component-Client-Nowa-0.01
http://search.cpan.org/~woremacx/POE-Component-Client-Nowa-0.01/
POE Client of the Nowa
----
POSIX-Regex-0.90.1
http://search.cpan.org/~jettero/POSIX-Regex-0.90.1/
OO interface for the gnu regex engine
----
Parse-BBCode-0.04
http://search.cpan.org/~tinita/Parse-BBCode-0.04/
Module to turn BBCode into HTML or plain text
----
Perl-Critic-1.083_004
http://search.cpan.org/~elliotjs/Perl-Critic-1.083_004/
Critique Perl source code for best-practices.
----
Perl-Critic-More-0.999_002
http://search.cpan.org/~elliotjs/Perl-Critic-More-0.999_002/
Supplemental policies for Perl::Critic
----
Persistence-Entity-0.01
http://search.cpan.org/~adrianwit/Persistence-Entity-0.01/
Entity persistence abstraction layer.
----
Proc-Exists-0.11
http://search.cpan.org/~brianski/Proc-Exists-0.11/
quickly check for process existence
----
SOAP-WSDL-2.00.03
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00.03/
SOAP with WSDL support
----
SQL-Entity-0.01
http://search.cpan.org/~adrianwit/SQL-Entity-0.01/
Entity sql abstraction layer.
----
SQL-Entity-0.02
http://search.cpan.org/~adrianwit/SQL-Entity-0.02/
Entity sql abstraction layer.
----
SQL-Entity-0.03
http://search.cpan.org/~adrianwit/SQL-Entity-0.03/
Entity sql abstraction layer.
----
SVN-Notify-2.75
http://search.cpan.org/~dwheeler/SVN-Notify-2.75/
Subversion activity notification
----
SVN-Notify-Filter-Markdown-0.03
http://search.cpan.org/~dwheeler/SVN-Notify-Filter-Markdown-0.03/
Convert SVN::Notify log messages from Markdown to HTML
----
Simple-SAX-Serializer-0.04
http://search.cpan.org/~adrianwit/Simple-SAX-Serializer-0.04/
Simple XML serializer
----
Statistics-Gtest-0.06
http://search.cpan.org/~dcfleck/Statistics-Gtest-0.06/
calculate G-statistic for tabular data
----
TAP-Formatter-HTML-0.01
http://search.cpan.org/~spurkis/TAP-Formatter-HTML-0.01/
TAP Test Harness output delegate for html output
----
TAP-Formatter-HTML-0.02
http://search.cpan.org/~spurkis/TAP-Formatter-HTML-0.02/
TAP Test Harness output delegate for html output
----
TM-Corpus-0.03
http://search.cpan.org/~drrho/TM-Corpus-0.03/
Topic Maps, Document Corpus
----
Template-Plugin-WikiFormat-0.01
http://search.cpan.org/~ivorw/Template-Plugin-WikiFormat-0.01/
TT wrapper for Text::WikiFormat
----
Template-Plugin-WikiFormat-0.02
http://search.cpan.org/~ivorw/Template-Plugin-WikiFormat-0.02/
TT wrapper for Text::WikiFormat
----
Test-HTML-W3C-0.03
http://search.cpan.org/~victorf/Test-HTML-W3C-0.03/
Perform W3C HTML validation testing
----
Tie-File-Hashify-0.02
http://search.cpan.org/~jkramer/Tie-File-Hashify-0.02/
----
Tk-TextVi-0.012
http://search.cpan.org/~jstrom/Tk-TextVi-0.012/
Tk::Text widget with Vi-like commands
----
Unix-Syslog-1.1
http://search.cpan.org/~mharnisch/Unix-Syslog-1.1/
Perl interface to the UNIX syslog(3) calls
----
WWW-Search-PubChem-0.01
http://search.cpan.org/~diberri/WWW-Search-PubChem-0.01/
Access PubChem's database of chemicals
----
WWW-Search-PubMedLite-0.02
http://search.cpan.org/~diberri/WWW-Search-PubMedLite-0.02/
Access PubMed's database of journal articles
----
WWW-Wikipedia-TemplateFiller-0.01
http://search.cpan.org/~diberri/WWW-Wikipedia-TemplateFiller-0.01/
Fill Wikipedia templates with your eyes closed
----
WebService-Nowa-0.01
http://search.cpan.org/~woremacx/WebService-Nowa-0.01/
Perl interface to the Nowa
----
the-0.12
http://search.cpan.org/~ingy/the-0.12/
This is teh, best module evar!
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Mon, 19 May 2008 13:05:18 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Order of operations
Message-Id: <u078g5-et1.ln1@osiris.mauzo.dyndns.org>
Quoth "John W. Krahn" <krahnj@telus.net>:
> Ben Morrow wrote:
> >
> > That's not the correct interpretation. Assignments happen as they are
> > needed, with the whole expression being evaluated in order of
> > precedence.
>
> I've had this discussion on c.l.p.misc before and it has been (rightly)
> pointed out to me that precedence does not determine order of evaluation.
Can you give me an example? I can't really see how the yacc parser can
produce anything else...
Ben
--
I have two words that are going to make all your troubles go away.
"Miniature". "Golf".
[ben@morrow.me.uk]
------------------------------
Date: Mon, 19 May 2008 11:56:57 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Strawberry
Message-Id: <g0rqbl.u8.1@news.isolution.nl>
Jürgen Exner schreef:
> Dr.Ruud:
>> Jürgen Exner:
>>> sanozuke:
>>>> Do I put it(#!/usr/bin/perl ) on the strawberry scripts or is a
>>>> diferent shebang line?
>>>
>>> If your Perl interpreter resides in /usr/bin/perl, then that is the
>>> correct line. If it resides in a different place then use the path
>>> to that place.
>>
>> On Windows, that doesn't necessarily work that way.
>
> Well, big surprise there. Of course Windows doesn't use the shebang
> line in the first place but relies on bindings of the file extension
> instead to achive the same goal.
Still, the shebang line is valid for its flags, like -T.
And it's good to be able to use the same version of a script on multiple
platforms, without the need to change the shebang line.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 19 May 2008 05:56:01 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: testing
Message-Id: <86tzgucv1a.fsf@blue.stonehenge.com>
>>>>> "Jürgen" == Jürgen Exner <jurgenex@hotmail.com> writes:
Jürgen> Paul Richardson <prich@earthlink.net> wrote:
>> 1 2 3 4
Jürgen> Your Newsreader or -server must be badly misconfigured because your
Jürgen> posting went to CLPM instead of to one of the many test NGs.
Or as we like to say... "test failed: PEBCAK". :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1556
***************************************