you have a question on how to do something in Perl, or
you need a Perl solution to an actual real-life problem, or
you're unsure why something you've tried just isn't working...
then this section is the place to ask. Post a new question!
However, you might consider asking in the chatterbox first (if you're a
registered user). The response time tends to be quicker, and if it turns
out that the problem/solutions are too much for the cb to handle, the
kind monks will be sure to direct you here.
i am new to PERL. so i have a lot of difficulties in conversions.
i am trying to convert Modern numbers to Roman numbers without using the function ROMAN..
also Trying to convert Octal To Hexadecimal number without any oct or hex function.
is it possible?
The function does something, but does not returns anything useful. It returns nothing. I can add "return ;" but this does not change things - function returns nothing and I don't want it to be used in non-void context.
Purpose of the last warning in function is simple: the function returns nothing, and if someone called it in scalar/list context,
he's doing something wrong. So this warning adds more strictness to user's code:
It's the Catalyst action, which return value is ignored, but it's called in list context.
Sometimes action return value is important (see "Any data returned from the action forwarded to, will be returned by the call to forward." in manual), sometimes no.
But catalyst always call actions in list context.
Now the quesions:
(a) Is that good practice to create library, which warns for "defined wantarray" for functions, returning nothing?
(b) Are libraries like catalyst obligated to never call user's callback in non-void context if it's value is ignored?
I assume if (b)=no, then (a)=no.
Is there a convention for such kind of things? (or let me rephrase: if I am getting this warning when using my library with Catalyst, who's fault is that? the library's or Catalyst's)
If you don't get it right, you download something that tells you to click the "accept License" button. Curl always gets the "accept license" button note. So I switched to wget.
I have read numerous responses to LWP::UserAgent, but I am confused as to how to handle the cookie. Is it necessary that this be done with a file? Can it be done directly without a file?
Would some kind person mind showing me an example of the above?
The output should be "10 & 10 are equal", but this gives output "10 & 8 aren't equal". I don't understand this! perhaps because of leading 0's perl converted 0010 to octel i.e. 8
I tried removing leading 0's, still the same output "10 & 8 aren't equal".
Please help to overcome this.
Actually I'm reading values from a file in which lots of values have leading 0's & I have to compare this value to some other from different file which doesn't have leading 0's.
Greetings fellow monks.
After having done some reconfiguring on a server I currently own (as in pay for, not hacked into) and used for a nodejs webapp I have been confronted with the following problem:
One week of on and off working on that project (university work had precedence) I now have a new, more maintainable and elegant web application.
I come here with two questions:
As usual, do you see any way to make the following code better (look at the bottom of the page), its my first time with catalyst so It must be quite smelly.
How does catalyst architecture works? more specifically please do correct (and|or) add to my current understanding
Regarding the second question here is my experience:
I have read The Definitive Guide to Catalyst but I dont think I correctly grasped all the concepts.
The Model part is made of tt files (at least for web views) living in the root folder, those are the templates used to generate pages seen by the clients. Each of those tt files uses variables given to it by the controller using the command $context->stash.
The View part is the one I least understand. Here I only used View Web TT, meaning what is sent back to the client is web pages made from TT models
The Controller part is the engine that make it all run, it is the script where each url request is translated into an action to be taken.
What happens if I want to send back serialized objects instead of a webpage? What kind of model files would I need? What if I need to access a database, should the requests go in the controller?
As you can see I am still struggling and having made a first webapp did not give me more than a hint of the true power of this framework. thanks you for reading!
Greetings! Given today's day, i would like to calculate 3 additional dates:
today - one week
today - one month
today - one year
This should be simple enough with Time::Piece, however i have found that i need to adjust the deltas for one month and one year by some very inconsistent amounts of time. Please consider the following code and its output:
My specific question is why do i have to add 10 hours, 29 minutes and 4 seconds to the delta for last month, and 6 hours minus 11 minutes, 10 seconds to the delta for last year. Surely i am doing something wrong or not taking something into consideration. I have tested this on three separate Linux servers and received the same results.
Thanks in advance!
(the triplet paradiddle with high-hat)
1. A Japanese compressed file(tab separated), Say A having products information (iphone etc), columns: name, description, image, uniqueid, rid1, rid2, url
2. Another file, say B having mid, rid, ntid (column separated).
3. rid1, rid2 => A & rid => B are numerical values.
What I want:
If rid from B matches rid1(from A), get that line form A into third file, Say C. In case, rid is null then rid(from B) to be matched with rid2 (from A). If rid1 & rid2 don't have values, leave that line.
Also I've to add some values to the url (from A) & then it's to be pushed to 3rd file C after rid comparison.
The main problem I've are:
1. How to handle the japanese? Do I have to use any modules? as saving the japanese character to a perl variable turn to junk.
2. There are 30 files like file A, each having 1 million of lines in them. What would be the efficient way to do this in perl?
I have a .cgi script which outputs an HTML page.
The HTML page includes a short jquery script which draws a graph on the HTML page.
The critical line in the jquery script is: <script> var data=[[0,170],[1,27],[2,3],[3,0],[4,0],[5,0],[6,0],[7,0],[8,0],[9,0],[10,0]];
where the bits in square brackets are positions and data.
This works fine as long as the data line is hard coded, but I normally don't know what the data is going to be till the .cgi script has run.
Ideally, I'd like to write a line like this:
<script> var data=$mydata where $mydata is a string prepared by the cgi script. However, jquery seems not to like this. I think this, is because it interprets the $ as a reference to itself.
Does anyone have any suggestions how to solve this?The general question is how do I move smoothly between perl and jquery?