But the problem is that running this gives me errors like:package XAMP; use strict; use warnings; use Milkbone; my $commit = 0; my $last_text; # # Some rather kludgy OS-specific code follows # if($^O =~ /Win32/) { eval ' package XAMP; use Win32::GuiText qw(FindWindowLike GetWindowText); sub get_text { } '; } else { eval " use Xmms::Remote; my $rem = Xmms::Remote->new; sub get_text { my $text = $rem->get_playlist_title($rem->get_playlist_pos); $commit = 1 if $text ne $last_text; $last_text = $text; return $text; } " or die $@; } return $text; } " or die $@; } # and then the code continues and later makes use of get_text()
Any idea why this happens?Couldn't require XAMP.pl for XAMP: Global symbol "$rem" requires expl +icit package name at plugins/XAMP.pl line 30. Global symbol "$text" requires explicit package name at plugins/XAMP.p +l line 30.Global symbol "$rem" requires explicit package name at plug +ins/XAMP.pl line 30. Global symbol "$rem" requires explicit package name at plugins/XAMP.pl + line 30. Global symbol "$text" requires explicit package name at plugins/XAMP.p +l line 30.Global symbol "$text" requires explicit package name at plu +gins/XAMP.pl line 30.Global symbol "$text" requires explicit package +name at plugins/XAMP.pl line 30.Compilation failed in require at (eva +l 26) line 1. main::main() called at /home/bill/milkbone/mos.pl line 64
TIA,
Bill
In reply to defining functions at runtime by batkins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |