overload during match
I use a variable which have a method overload to string in regex replace. the result is string only if match success. I thought it should be always string. Could anyone explain how this happen? Thanks. Below is the code use Text::Xslate::Type::Raw; # a wraper of string, provide as_string, which is overloaded to string, return the string. use DDP; sub strip_x { return $_[0]=~s/x//gr } my $raw_a = Text::Xslate::Type::Raw->new("a"); p $raw_a; my $striped_a = strip_x($raw_a); p $striped_a; my $raw_b = Text::Xslate::Type::Raw->new("x"); p $raw_b; $striped_b = strip_x($raw_b); p $striped_b; __END__ Text::Xslate::Type::Raw { public methods (3) : (), as_string, new private methods (0) internals: "a" } Text::Xslate::Type::Raw { public methods (3) : (), as_string, new private methods (0) internals: "a" } Text::Xslate::Type::Raw { public methods (3) : (), as_string, new private methods (0) internals: "x" } ""
Re: DateCalc Problem
Hi Omega, On Thu, 13 Aug 2015 06:48:50 -0400 Omega -1911 <1911...@gmail.com> wrote: > Hi - Can anyone help me understand why the following does not produce the > correct future date? > > my $exp_date = DateCalc('today', "+$membership_period days"); > > It works if I use: > > my $exp_date = DateCalc('today', "+7 days"); > That's not the complete code, so it's hard to reproduce. Please post a self-contained , reproducing example. For example, I don't know what DateCalc is and neither does https://metacpan.org/search?q=datecalc . You can also try using an interactive debugger: http://perl-begin.org/topics/debugging/ Regards, Shlomi Fish -- - Shlomi Fish Chuck Norris was never a newbie! He will kill anyone who implies otherwise. In a very not newbie-like manner. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
DateCalc Problem
Hi - Can anyone help me understand why the following does not produce the correct future date? my $exp_date = DateCalc('today', "+$membership_period days"); It works if I use: my $exp_date = DateCalc('today', "+7 days"); Any help is appreciated !! Eyes have been looking at the screen for a while ;)