@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24



Comments:

<0> obvious++
<1> and as I said, you shouldn't be using it :)
<0> Khisanth: it's in the Parse::RecDescent demo code
<1> hax: keyword being "you" :)
<1> I am quite sure Damian Conway knows all about prototypes
<0> Khisanth: heh
<0> Khisanth: well, i'm trying to understand his code
<2> Khisanth: okay, it's partly my fault
<2> Khisanth: I was creating a macro and a variable with the same name.
<1> trying to understand DCONWAY's code ... that might not be good for one's health
<2> Khisanth: Stash::XS blew up on that, but Stash (not XS) just started an infinite loop.
<2> Khisanth: although it's still a bug.
<3> what exactly do I need to do to have a module inherit methods from another module
<4> use base
<4> in the inheriting package.
<4> or @ISA



<3> I've been trying ISA and the methods aren't showing up in the inheriting object
<4> define 'showing up' ?
<3> when I call the method on the inherited object it says it can't find the method
<4> try 'use base' pragma instead.
<5> Zaphar_ps: if you're using @ISA, you still have to actually load the parent module
<5> 'use base' does that for you.
<3> japhy: yes I knew that I did load the parent module first
<3> just tried use base and it didn't work either
<3> what am I missing here?
<3> I have this feeling I'm going to feel stupid when I figure it out
<6> We can't help you feel stupid unless you pastebot some code for us to criticize.
<7> ereg_replace("[^\-\_]", "", "-_"); <-- why does it strips "-" ?
<8> nikns: that's not Perl
<7> thats not regexp?
<8> nikns: it's not Perl.. this is #perl
<9> perlbot pcre
<10> PCRE is crap. It is hardly comparable to Perl's regular expression engine. Don't bother inquiring for help with a regular expression in perl related channels as the answer you'll get will most likely not work since PCRE is missing most of the "powerful" features that perl's regex engine contains. See also: LPBD
<8> nikns: this isn't #regex, nor #php (or whatever language you are using)
<9> perlbot lpbd
<10> PCRE should really be called LPBD - Like Perl But Different.
<7> clear
<7> thanks
<8> nikns: welcome
<5> Zaphar_ps: use a pastebot to show us the code or something
<3> never mind I just realized something
<3> some of the methods are available
<3> I knew I was going to feel stupid
<11> is there any reason why i would be getting a "Use of uninitialized scalar chomp" error in my script on a variable i have declared with "my" (using strict)?
<11> i've declared it, ***ign it a value, then two lines down try an chomp it, and get the error
<3> one of my methods referenced a variable that wasn't present in the inheriting cl*** :-)
<9> several reasons i'm sure. hard to say without seeing the code
<9> Zaphar_ps that's the primary motivation for inside out cl***es
<11> nevermind! figured it out
<9> one of the primary motivations
<12> Uh, what's a shortcut for: $string2=$string1; $string2 =~ s/xxx/yyy/; (***igning and regex in one statement)?
<13> ($s2=$s1) =~ s/...
<12> thrig: hmm, is that THE way of doing that?
<14> hi, I've ***igned a bunch of variabled in a subroutine that should be available to all of the script. The script uses 'strict'. In the subroutine I've used 'our'. Still when I use the variable in main, I get this error: Variable "$normal" is not imported at ./infoperl.pl line 264.
<14> Global symbol "$normal" requires explicit package name at ./infoperl.pl line 264.
<14> Execution of ./infoperl.pl aborted due to compilation errors.
<11> i keep getting a "Can't use string ("whatever-the-string-is") as symbol ref while "strict refs" in use" error. are there things to look for with this error?
<14> the offending line reads: print $normal;
<14> should use print $main::normal or something
<9> i've got a fever, and the only cure is more pasting (to pastebin)
<14> I*
<9> csb are their pointy braces involved? <>
<14> linuxnohow, do you know an answer?
<11> linuxnohow: yes there are, in fact
<14> btw as a general rule I don't paste more than three lines :)
<11> escape them out?
<5> locsmif: so use a pastebot
<14> I'd use http://sial.org/pbot/perl/ otherwise
<9> csb no, use a filehandle instead of a scalar
<5> locsmif: is your situation like this:
<5> use strict; sub foo { our $x = 10 } foo(); print $x;
<9> locsmif sounds like you forgot to use my
<14> japhy, yes!
<5> if so, you're not doing things properly.
<14> aha
<5> our() is scoped like my() is.
<14> darn



<5> it's not a file-wide declaration
<1> you would need our $x; print $x;
<5> use strict; our $x; sub foo { $x = 100 }; foo(); print $x;
<5> that'll work
<11> linuxnohow: ah, well that would explain why this worked before, and in trying to keep with best practices i am using scalars for filehandles now...but this presents a problem because this is in a sub that is used for all sorts of stuff. is there another way around it?
<1> or just declare the $x at the top
<14> japhy, great, thanks :))
<5> but why our() then?
<5> why not just my()?
<5> you don't need them to be related to a package, do you?
<11> actually, i may have a solution
<1> csb: <$fh> works fine ***uming you are using a version of perl that supports that
<11> well the version i am using is 5.8x
<11> i think. i'll check
<1> then that works fine
<14> japhy, Khisanth, the script is such that, (it's ported from bash) all the design consideration have already been made, over a long period of time. It requires doing some good magic here and there. I've reluctantly accepted to do so :)
<11> khisanth: actually, i was incorrect. the perl version is 5.008007
<5> csb: that's 5.8.7
<1> that is still 5.8
<11> oh ok cool
<11> well as some background, i have a text file that contains the "header" part of an html page. it starts with "<meta http-equiv="Content-Type" content="text/html;">"
<11> i then read that file in line by line and print it so the script creates a page
<1> it would work with anything above 5.6.0
<11> it fails at that first line
<11> when it tries to read that first line, that's where i get the error. it does start with "<"
<1> are you expecting us to guess what your code is?
<11> ah no,
<1> you have been around here long enough ...
<11> i mean it's simple, it just says "while <$input_file> { print $_ }
<9> is $input_file the name of the file??
<11> i can post it to a bot, but that might be overkill
<11> yes, and that works ok because other files use this sub fine
<5> is it the NAME of a file?
<5> or a filehandle?
<11> filehandle
<5> and do you have parens in there?
<5> while (<$input_file) { print $_ }
<5> while (<$input_file>) { print $_ }
<5> csb: you might as well paste
<11> ok, will do (as soon as my system stops freezing up)
<14> suppose I have a command like print docmd "cat /proc/xxx/cmdline" . "\n", how do I prevent the . "\n" to be p***ed as a parameter to docmd() but instead be interpreted by print?
<15> japhy, are you "japhy" from perlmonks?
<5> tlmdn: yeah
<15> ur a hacker : )
<15> hehe
<5> I certainly am
<14> !police japhy
<5> locsmif: use parens?
<5> print docmd("...") . "\n";
<16> "csb" at 24.91.234.13 pasted "issues..." (241 lines, 9.5K) at http://sial.org/pbot/15735
<14> I'll try, just now that resulted in "cmd" and its parameter to be printed literally :)
<11> ok so i posted it. the code is probably pretty ugly to those of you who know what your doing
<14> yup, that still happens
<5> locsmif: what are you trying to do?
<14> print cmd "cat /proc/self/cmdline" . "\n"
<9> csb where is the error??
<14> I could simply use `...` but there is a reason for me not to
<15> What is the ABSOLUTE fastest way of counting occurence of string X in array Y?
<14> cmd() is a wrapper I intend to use and it handles some dirty work
<11> the error is in the "write_html_from_external_file" subroutine
<11> where it says "print ($_ "\n");"
<15> number of occurrences*
<11> which actually should be <br> i guess, instead of "\n"
<11> actaully, that's not right either, it should be in the external file
<5> print ($_ "\n");
<9> csb it's taking $_ as a filehandle
<5> I do not think that means what you think it means
<9> print $_,"\n";
<5> you mean: print "$_\n";
<5> or that.
<5> locsmif: do you want to print the output of cmd()?
<11> hmmm
<9> csb if print is given two arguments separated by whitespace, the first one is considered to be a filehandle
<9> print FOO 'Bar'


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #perl
or
Go to some related logs:

#math
xte xnee
warning azureus did not shutdown tidily
#osdev
#gentoo
#fedora
__imp__boxRGBA
ubuntu xutils apt-get upgrade
netstat show program linux
#web



Home  |  disclaimer  |  contact  |  submit quotes