"There are certain pieces of adolescent mythology that can almost become a necessity, like a lifeline for a kid,” Ezra Miller says. “Perks was that for me.”

Perks is how kids like Miller, wounded teens who barely made it out of high school alive, refer to their tattered copies of The Perks of Being a Wallflower, a novel about Charlie, an achingly lost and lonely high-school freshman and the older band of outsiders -- —Sam, the out-of-his-league girl, and her confident gay stepbrother, Patrick -- who help save him.

To a decade’s outcasts, Perks belongs on a shelf next to The Catcher in the Rye. It pays tribute to that classic indictment of adult hypocrisy, but also tells an updated, unflinching, uncensored story about how many childhoods were not so much the setting of a happy home video as they were fodder for a future PostSecret confession.

“I read this book when I was Charlie’s age,” says Miller. Two older friends who lived down the block from him in Maplewood, N.J., insisted on it. “One said, ‘This is my favorite book.’ The other said, ‘This book saved my life.’ So I read it and I found one of the best mythological maps for being a fucked-up kid.”

That kind of emphatic, evangelical endorsement is how a book like Perks, written by Stephen Chbosky and published in 1999 by MTV Books, ended up being passed around from kid to kid and selling more than a million copies. It’s still one of the most banned books in America, which only serves to heighten its appeal.

The film adaptation­ -- starring Logan Lerman (Percy Jackson & the Olympians, Greg Berlanti’s Jack & Bobby) as Charlie and Harry Potter’s Emma Watson as Sam -- hits theaters this month, with a screenplay written and directed by Chbosky.

Five years after finding solace in the character of Charlie, Miller -- who is now on the cusp of turning 20 and finally, officially, graduating from his own teenage years -- plays Patrick with a beautiful, transcendent self-assurance that recalls the sensitive bravado of a young Johnny Depp. Best known as Tilda Swinton’s sociopath son in 2011’s We Need to Talk About Kevin, Miller turns the role of Patrick into a defiantly optimistic new queer role model.

“I needed Patrick in my life,” says Chbosky, who was 26 when he wrote Perks. “I needed a person who was OK with himself. I looked up to Ferris Bueller because he didn’t seem to be plagued with the insecurities that plagued me. And then—because I did the movie much later, when I was not as crazy—I recognized that Patrick had become something of an iconic character.”

When Miller found the script for Perks at a friend’s house in Los Angeles, “I picked it up and threw it against the wall, then I kicked it and spat on it -- because I was furious that somebody, some idiot somewhere was trying to ruin a great piece of literature.” Then he found out it was Chbosky’s project: “It was no longer Hollywood eating another thing we love. It was maybe a chance for Perks to become a bigger, friendlier, more helpful monster.”

He also realized it was time to stop thinking of himself as Charlie. “Here I am, the age that my friends were when they were recommending the book to me.” As the de facto leader of the school’s “antipack pack,” as Miller calls it, Patrick shows Charlie how to be himself amidst the bullies instead of just standing on the sidelines.

“Top to bottom, I wanted to make a movie where Patrick was the coolest kid—the most self-assured, the least haunted,” Chbosky says. “God knows he has some problems”—the only secret Patrick keeps is that he’s sleeping with the closeted quarterback, Brad—“but you know that he’s going to be OK. If you’re a gay kid and you’re looking for role models like everybody else, there he is. There’s no victim here. And if you’re a straight kid, you’re just going to love Patrick because he’s cool.”

In Perks, after Brad (Johnny Simmons) is savagely beaten by his father when he catches him with Patrick, a forlorn Patrick drunkenly kisses Charlie. Rather than the tired trope of an offended, disgusted reaction, Charlie just hugs Patrick sweetly, with unconditional reassurance.

“Of course there’s nothing wrong with it,” says Chbosky, who says the scene -- and much of both Patrick’s and Brad’s characters -- was inspired by his best friend at college. “Even though I’m a straight guy, I’d always had a real kinship with all of my gay friends.”

Lerman, 20, says he and his generation of friends would respond like Charlie, too. “It’s not offensive -- not at all. And Charlie just cares about Patrick so much, it’s just instinctual for him to accept everyone for who they are.”

Not so sweet is a scene in which Brad calls Patrick a faggot in the middle of the lunchroom. “In these movies, so often the gay teen gets called a name and he feels bad and he walks away,” Chbosky says. “Being where I’m from -- and I’m speaking like a guy from Pittsburgh now -- I said, ‘In this story, I want Patrick to turn around and hit that guy so hard.’ ”

After that first punch, Miller and Simmons -- who plays Brad with a quiet agony, in stark contrast to Patrick’s audacious abandon -- grapple on the cafeteria floor in a brutal, intimate fight. There were no stand-ins and, in secret agreement, they used far more force than either the stunt coordinator or Chbosky had approved.

“Johnny and I would have it no other way,” Miller says. “We really did not want the fight to become something safe or something easy. We just recently admitted to each other that we both took somewhat serious injuries that day.”

“Brad is the one person who doesn’t escape from the boundaries that have been set by what people want of him,” Simmons says. “The tragedy of Brad is that he didn’t become who he really is; he lived up to his image. This movie was my small way of saying, ‘This is insane. This is ridiculous.’ ”

Miller says, “I really think that most violent confrontations are just dudes repeating cycles of abuse from their fathers or testing their own machismo. It’s more of a weird homoerotic animal ritual than anything else. If you look at two dudes who are about to fight, it just looks like they’re going to fuck.”

Like Patrick, Miller, in his hippie heart, is a lover, not a fighter, and he wears his weirdness like a peacock’s plume. “Getting socially outcast can be the best and most informative thing that can ever happen to you,” he says, “because you have to learn who you are separate from the pack.”

As a young child, Miller was mocked for having a speech impediment, which he learned to control by singing opera. (He was in New York’s Metropolitan Opera Children’s Chorus and the premiere of Philip Glass’s White Raven.) “I was trying to kiss boys in school,” he says, and then the best friend he fooled around with turned on him. “He had some macho realization that led him to believe that I was the problem. So I went from having a stutter to being a totally gay little opera singer to being, like, a really confused queer adolescent.”

One of the older kids who introduced him to Perks became his girlfriend, but once she graduated, Miller felt like an outcast again. “[Bullying] does come with the territory of being a lesbian/gay/bi/queer/trans person in the public school system. And that’s been getting a little bit better, for parts of that spectrum, but not really. How far have we really come? I’m not sure. That’s up for debate.”

He left high school at 16 to act full-time and points to the making of this film as a kind of second chance at acting out his adolescence. “I didn’t get scapegoated,” he says, with tender surprise. “I wasn’t the oddball. All of the other kids who made this film are super weird, also! I’ve never been accepted like that, outside of, like, fucking Burning Man.”

He’s balancing an increasingly busy film schedule -- next he’ll appear with Mia Wasikowska (The Kids Are All Right) in Madame Bovary -- and playing with his band, Sons of an Illustrious Father. And though he’s played a gay teen before (in 2010’s Every Day) and is hardly a closed book in interviews, this is the first time he’s speaking quite so clearly about his sexuality.

“I’m queer,” he says, simply. “I have a lot of really wonderful friends who are of very different sexes and genders. I am very much in love with no one in particular. I’ve been trying to figure out relationships, you know? I don’t know if it’s responsible for kids of my age to be so aggressively pursuing monogamous binds, because I don’t think we’re ready for them. The romanticism within our culture dictates that that’s what you’re supposed to be looking for. Then [when] we find what we think is love -- even if it is love -- we do not yet have the tools. I do feel that it’s possible to be at this age unintentionally hurtful, just by being irresponsible -- which is fine. I’m super down with being irresponsible. I’m just trying to make sure my lack of responsibility no longer hurts people. That’s where I’m at in the boyfriend/girlfriend/zefriend type of question.”

Ten years before the “It Gets Better” campaign, Chbosky had kids coming up to him at book signings to say that The Perks of Being a Wallflower saved their lives. The film’s website is collecting similar testimonials, and a quick search on Tumblr turns up hundreds more.

“I wanted to make the movie that celebrated a kid’s life at the same time that it celebrated any adult’s nostalgia. I think that we forget a lot of the pain and remember a lot of the good things,” says Chbosky. “But I wanted to validate the totality of their experience. Sometimes, that’s all it takes to give them one more piece of hope to go and build a better life.”

For Miller, every minute of press the film earns becomes an opportunity to pay that gratitude forward. “I just want kids in all situations to hold on. A lot of [adolescence] left me wanting to end my own life, just give up. It feels like the whole world -- because it is. It’s your whole world. But, man -- life is a really, really cool ride. It’s really amazing the type of shit you can get up to if you endure. Like, you can do anything you want if you can survive.”