in reply to Re^3: Switch.pm Failure ( CGI::Switch? )
in thread Switch.pm Failure
"Did you upgrade Perl"
probably, Further, Switch was removed from the core in Perl 5.14 http://stackoverflow.com/questions/2630547/why-is-the-switch-module-deprecated-in-perl
so first they got the message Can't locate Switch.pm in @INC (you may need to install the Switch module), Searched the tree and found a Switch.Pm under CGI, and added use CGI::Switch;, which didnt help a bit.
ok, so since Switch.pm is no longer core, and i didnt want to install it (being depreciated anyway), i took this http://cpansearch.perl.org/src/RGARCIA/Switch-2.16/Switch.pm and put it in its own directory, and then put this into the same directory
and glory be got#!perl -w use strict;use warnings; use Switch; sub Main { Switch {print "hi\n";return;} }
Why, i dunno?hi
ok it wasnt that simple. first i tried
and got#!perl -w use strict;use warnings; use Switch; Switch {my $a=1};
Thinking that all those returns were the reason i went toCan't locate object method "Switch" via package "1" (perhaps you forgo +t to load "1"?) at switch.pl line 4.
and got#!perl -w use strict;use warnings; use Switch; Switch {my $a=1;return};
AHAH, the reason for the sub Main {}Can't return outside a subroutine at switch.pl line 4.
so i cant figure out what Switch {} is doing. there is no sub Switch in Switch.pm (there is a sub switch tho). I figure it has something to do with use Filter::Util::Call and the import and filter subroutines. Can anyone give me a clue?
edit:fixed case in "Can't locate switch.pm" from a typo/wrong-copy-paste
edit2: ok i think i got it if a class is used to invoke the method, that argument will be the name of the class.http://docstore.mik.ua/orelly/perl/prog3/ch12_03.htm. so Switch {} is trying to invoke method Switch with an argument (without parens) that is the result of a block, but the block "never ends?" due to the return. Is that it?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Switch.pm Failure ( CGI::Switch? )
by haukex (Archbishop) on Feb 27, 2017 at 08:12 UTC | |
by huck (Prior) on Apr 25, 2017 at 16:40 UTC | |
|
Re^5: Switch.pm Failure ( CGI::Switch? )
by tultalk (Monk) on Feb 26, 2017 at 01:37 UTC | |
by huck (Prior) on Feb 26, 2017 at 02:31 UTC |