Why doesn't compiled CoffeeScript pass JSHint? [closed] - coffeescript

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I use the examples from the CoffeeScript homepage and it doesn't validate.
The for loop one is a perfect example, if you use the coffeescript statement it doesn't wrap the body in an if statement.
Expected '{' and instead saw 'child'.
Possible strict violation.
A constructor name should start with an uppercase letter.
'insertclassnamehere' is already defined.
Did you mean to return a conditional instead of an assignment?
Expected '===' and instead saw '=='.
Unexpected '~'.
Expected '!==' and instead saw '!='.
The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.

My compiled CoffeeScript won't validate in JShint .. why?
The short answer would be: Because the creators of the CoffeeScript compiler didn't deem it necessary.
It makes sense to lint code which is written and maintained by developers. It avoids human errors by making code readable.
The code generated by a compiler on the other hand has completely different requirements. Readability is usually not a concern. It's more important that the code is efficient and small.
If you really want this then you need to modify the CoffeeScript compiler source.

Related

how to handle when use module [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have one module, such as A.pm, in this A.pm, it will read and write one certain conf file, such A.conf.
Now in my perl script file: 1_perl.pl, I use A.pm to reset certain value in A.conf file and also use A.pm to write this value in 2_perl.pl. So my question is how to hand this process in background? It will produce 2 A.pm instance to handle this or just one instance ?
Please give more details about this , thank you in advance
Perl modules are just loadable blobs of functions and data -- modules are not processes, so your question doesn't really make sense.
If you want your module to create a background process to write out the configuration file, that's certainly doable, but you'll have to implement it yourself. Deciding how to manage these processes is up to you.

calling a perl script from another script [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I need to call a perl script from another script. The constraint is that, few global variables defined in a .pm file is common between the two scripts but the local variables are not shared. Please let me know how to do this
Is there any reason you cant call the code from the second script as a function from the first script? It should work as a single program and thus share global variables.
Check How do I include functions from another file in my Perl script? for the various ways to include one script into another.
It depends how you want this to work.
If you want to share global variables between processes then you are in for a "treat". You will need something like shared-memory (shmget) or some other IPC (Inter-Process Communication) mechanism, see perldoc perlipc. The fun part is is synchronising the two processes so they don't try to update the same thing at the same time. You really don't want to go there if you can avoid it.
Simpler is if you just want to pass those global values to the second process so it can take its own copy. If the values are simple text then you can just pass them as command-line parameters (read them from #ARGV) or as environment variables (%ENV). However, if they are more exotic, like references or file handles, then you need to figure out a different protocol. Creating the child process using fork (you might not need exec) might be a simpler way to go assuming you are not using Windows.
Better yet, consider if you really do need to copy or share those globals.

Perl script to compare two files [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am new to Perl, and I need to write a Perl script to compare two files which shows the matched and unmatched content in the output file. I am supposed to pass the those two files as parameters.
How can I do this?
There are at least the following modules that could be coopted to produce the result:
Text::Diff
Algorithm::Diff
The latter is about a decade old, so the former (updated last year) is a better bet. There are other algorithms out the on CPAN too - Algorithm::LCS might be interesting were it not also most of a decade old. Generally, with Perl, the secret is to find someone else who has already answered the question for you.
Of course, that may not sit so well with teachers at school or university.

How can I use a Perl script to create the plain text file [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How can use a Perl script to create the plain text file. Perl should generate (random 16 bit hex) input data.
If you are new to Perl take a look at http://learn.perl.org
Check out Open, hex, and sprintf.
open a file handle, then print to it.
In addition to the other advice, to generate a random value, use Perl's rand function.
The Perl documentation can also be queried at your command prompt. For example, to access the FAQ:
perldoc -q random

program that takes a string as input from user from command line and printing only list of unique characters [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How to parse the string's individual character for eg " =-. lajadsfdddll ooo532333 ksfoiww0etu - " /.> W#H^*!##~ nsa#". and add each individual character into hash and then count as ohw many times each character has apeared and the only unique character.
As it sounds very much like a homework question, I'll try pushing you in the right direction. Hopefully you know how to take in a line of user input. In this case, your very general algorithm will look like this:
1. Take the input
2. Parse the input into individual characters - Think about Perl built in methods
3. Add characters to the Hash and count.
4. Iterate through the Hash and print the relevant data.
Character counting is a pretty common problem in a variety of languages, so utilizing Google will be your friend. Also consider that Hashes associate a Key with some value, and only stores unique keys, but it can store any value type.
Additionally, the Perl Cookbook has a recipe on the free online book that discusses how to read individual characters of a string, and this tutorial can be found in a variety different sites.
Long story short, there are plenty of resources out there to answer this problem, and you'll learn more if you go out and find them.